diff options
author | Alex Deucher <[email protected]> | 2009-07-15 14:17:07 -0400 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2009-07-15 14:17:07 -0400 |
commit | c5c19919ce627b98d8aab4284da1694573bcccd4 (patch) | |
tree | 2e29b313b79b6a392e020fd5723e3cc00c800fd2 /src | |
parent | a0d4a12614fce072fa1eb5516e626909171c95e1 (diff) | |
parent | 3a3b83e5112b725e22f05b32a273a2351b820944 (diff) |
Merge branch 'master' of git+ssh://[email protected]/git/mesa/mesa into r6xx-rewrite
This builds, but I get an assertion in radeonGetLock() due to
the drawable being null.
Diffstat (limited to 'src')
458 files changed, 36377 insertions, 10298 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c index 0bc77a57287..e6dce3f0e5b 100644 --- a/src/gallium/auxiliary/cso_cache/cso_cache.c +++ b/src/gallium/auxiliary/cso_cache/cso_cache.c @@ -361,6 +361,10 @@ void cso_for_each_state(struct cso_cache *sc, enum cso_cache_type type, void cso_cache_delete(struct cso_cache *sc) { assert(sc); + + if (!sc) + return; + /* delete driver data */ cso_for_each_state(sc, CSO_BLEND, delete_blend_state, 0); cso_for_each_state(sc, CSO_DEPTH_STENCIL_ALPHA, delete_depth_stencil_state, 0); diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index f388bf5d951..36c882acb75 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -55,14 +55,14 @@ struct cso_context { void *samplers[PIPE_MAX_SAMPLERS]; unsigned nr_samplers; - void *samplers_saved[PIPE_MAX_SAMPLERS]; unsigned nr_samplers_saved; + void *samplers_saved[PIPE_MAX_SAMPLERS]; struct pipe_texture *textures[PIPE_MAX_SAMPLERS]; uint nr_textures; - struct pipe_texture *textures_saved[PIPE_MAX_SAMPLERS]; uint nr_textures_saved; + struct pipe_texture *textures_saved[PIPE_MAX_SAMPLERS]; /** Current and saved state. * The saved state is used as a 1-deep stack. diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index 3cde9d36d3a..2e3f5b2fc07 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -216,22 +216,22 @@ void draw_pipeline_run( struct draw_context *draw, ( DRAW_PIPE_RESET_STIPPLE | \ DRAW_PIPE_EDGE_FLAG_0 | \ DRAW_PIPE_EDGE_FLAG_2 ), \ - verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \ - verts + stride * (i1), \ + verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \ + verts + stride * (i1), \ verts + stride * (i3)); \ - do_triangle( draw, \ - ( DRAW_PIPE_EDGE_FLAG_0 | \ - DRAW_PIPE_EDGE_FLAG_1 ), \ - verts + stride * ((i1) & ~DRAW_PIPE_FLAG_MASK), \ - verts + stride * (i2), \ - verts + stride * (i3)) + do_triangle( draw, \ + ( DRAW_PIPE_EDGE_FLAG_0 | \ + DRAW_PIPE_EDGE_FLAG_1 ), \ + verts + stride * ((i1) & ~DRAW_PIPE_FLAG_MASK), \ + verts + stride * (i2), \ + verts + stride * (i3)) #define TRIANGLE(flags,i0,i1,i2) \ do_triangle( draw, \ flags, /* flags */ \ - verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \ - verts + stride * (i1), \ - verts + stride * (i2)) + verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \ + verts + stride * (i1), \ + verts + stride * (i2)) #define LINE(flags,i0,i1) \ do_line( draw, \ diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c index a5d840b96ea..1a5269c0de9 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c +++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c @@ -159,8 +159,19 @@ vbuf_tri( struct draw_stage *stage, check_space( vbuf, 3 ); - for (i = 0; i < 3; i++) { - vbuf->indices[vbuf->nr_indices++] = emit_vertex( vbuf, prim->v[i] ); + if (vbuf->stage.draw->rasterizer->flatshade_first) { + /* Put provoking vertex in position expected by the driver. + * Emit last provoking vertex in first pos. + * Swap verts 0 & 1 to preserve polygon winding. + */ + vbuf->indices[vbuf->nr_indices++] = emit_vertex( vbuf, prim->v[2] ); + vbuf->indices[vbuf->nr_indices++] = emit_vertex( vbuf, prim->v[0] ); + vbuf->indices[vbuf->nr_indices++] = emit_vertex( vbuf, prim->v[1] ); + } + else { + for (i = 0; i < 3; i++) { + vbuf->indices[vbuf->nr_indices++] = emit_vertex( vbuf, prim->v[i] ); + } } } diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index d84bab9eaae..014d8c7346d 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c @@ -181,6 +181,16 @@ static void widepoint_point( struct draw_stage *stage, } +static int +find_fog_input_attrib(struct draw_context *draw) +{ + /* Scan the fragment program's input decls to find the fogcoord + * attribute. The z/w components will store the point coord. + */ + return 0; /* XXX fix this */ +} + + static void widepoint_first_point( struct draw_stage *stage, struct prim_header *header ) { @@ -220,7 +230,7 @@ static void widepoint_first_point( struct draw_stage *stage, wide->num_texcoords = j; /* find fragment shader PointCoord/Fog input */ - wide->point_coord_fs_input = 0; /* XXX fix this! */ + wide->point_coord_fs_input = find_fog_input_attrib(draw); /* setup extra vp output (point coord implemented as a texcoord) */ draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_GENERIC; diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 9ea0cbe5990..dbb5ac71821 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -36,6 +36,7 @@ #include "draw/draw_vs.h" #include "tgsi/tgsi_dump.h" #include "util/u_math.h" +#include "util/u_prim.h" static unsigned trim( unsigned count, unsigned first, unsigned incr ) { @@ -278,7 +279,7 @@ void draw_arrays(struct draw_context *draw, unsigned prim, unsigned start, unsigned count) { - unsigned reduced_prim = draw_pt_reduced_prim(prim); + unsigned reduced_prim = u_reduced_prim(prim); if (reduced_prim != draw->reduced_prim) { draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); draw->reduced_prim = reduced_prim; diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 8ef0ea8011f..7a17a9fb6b2 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -228,7 +228,6 @@ void draw_pt_post_vs_destroy( struct pt_post_vs *pvs ); * Utils: */ void draw_pt_split_prim(unsigned prim, unsigned *first, unsigned *incr); -unsigned draw_pt_reduced_prim(unsigned prim); #endif diff --git a/src/gallium/auxiliary/draw/draw_pt_decompose.h b/src/gallium/auxiliary/draw/draw_pt_decompose.h index 3fb06956878..4ca5b520204 100644 --- a/src/gallium/auxiliary/draw/draw_pt_decompose.h +++ b/src/gallium/auxiliary/draw/draw_pt_decompose.h @@ -47,10 +47,19 @@ static void FUNC( ARGS, case PIPE_PRIM_TRIANGLES: for (i = 0; i+2 < count; i += 3) { - TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, - (i + 0), - (i + 1), - (i + 2 )); + if (flatfirst) { + /* put provoking vertex in last pos for clipper */ + TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, + (i + 1), + (i + 2), + (i + 0 )); + } + else { + TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, + (i + 0), + (i + 1), + (i + 2 )); + } } break; @@ -58,9 +67,9 @@ static void FUNC( ARGS, if (flatfirst) { for (i = 0; i+2 < count; i++) { TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, - (i + 0), (i + 1 + (i&1)), - (i + 2 - (i&1))); + (i + 2 - (i&1)), + (i + 0) ); } } else { @@ -78,9 +87,9 @@ static void FUNC( ARGS, if (flatfirst) { for (i = 0; i+2 < count; i++) { TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, - (i + 1), (i + 2), - (0 )); + 0, + (i + 1) ); } } else { @@ -96,20 +105,40 @@ static void FUNC( ARGS, case PIPE_PRIM_QUADS: - for (i = 0; i+3 < count; i += 4) { - QUAD( (i + 0), - (i + 1), - (i + 2), - (i + 3)); + if (flatfirst) { + for (i = 0; i+3 < count; i += 4) { + QUAD( (i + 1), + (i + 2), + (i + 3), + (i + 0) ); + } + } + else { + for (i = 0; i+3 < count; i += 4) { + QUAD( (i + 0), + (i + 1), + (i + 2), + (i + 3)); + } } break; case PIPE_PRIM_QUAD_STRIP: - for (i = 0; i+3 < count; i += 2) { - QUAD( (i + 2), - (i + 0), - (i + 1), - (i + 3)); + if (flatfirst) { + for (i = 0; i+3 < count; i += 2) { + QUAD( (i + 1), + (i + 3), + (i + 2), + (i + 0) ); + } + } + else { + for (i = 0; i+3 < count; i += 2) { + QUAD( (i + 2), + (i + 0), + (i + 1), + (i + 3)); + } } break; diff --git a/src/gallium/auxiliary/draw/draw_pt_elts.c b/src/gallium/auxiliary/draw/draw_pt_elts.c index b7780fb5073..88f4d9f495a 100644 --- a/src/gallium/auxiliary/draw/draw_pt_elts.c +++ b/src/gallium/auxiliary/draw/draw_pt_elts.c @@ -54,7 +54,8 @@ static unsigned elt_ubyte( const void *elts, unsigned idx ) static unsigned elt_vert( const void *elts, unsigned idx ) { - return (const ubyte *)elts - (const ubyte *)NULL + idx; + /* unsigned index is packed in the pointer */ + return (unsigned)(uintptr_t)elts + idx; } pt_elt_func draw_pt_elt_func( struct draw_context *draw ) diff --git a/src/gallium/auxiliary/draw/draw_pt_util.c b/src/gallium/auxiliary/draw/draw_pt_util.c index 3bc7939c556..b61fa291436 100644 --- a/src/gallium/auxiliary/draw/draw_pt_util.c +++ b/src/gallium/auxiliary/draw/draw_pt_util.c @@ -75,28 +75,3 @@ void draw_pt_split_prim(unsigned prim, unsigned *first, unsigned *incr) break; } } - - -unsigned draw_pt_reduced_prim(unsigned prim) -{ - switch (prim) { - case PIPE_PRIM_POINTS: - return PIPE_PRIM_POINTS; - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_LINE_LOOP: - return PIPE_PRIM_LINES; - case PIPE_PRIM_TRIANGLES: - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_POLYGON: - case PIPE_PRIM_QUADS: - case PIPE_PRIM_QUAD_STRIP: - return PIPE_PRIM_TRIANGLES; - default: - assert(0); - return PIPE_PRIM_POINTS; - } -} - - diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c index 5d268a22264..1a0527be63a 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache.c +++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c @@ -31,6 +31,7 @@ */ #include "util/u_memory.h" +#include "util/u_prim.h" #include "draw/draw_context.h" #include "draw/draw_private.h" #include "draw/draw_pt.h" @@ -193,16 +194,30 @@ vcache_ef_quad( struct vcache_frontend *vcache, unsigned i2, unsigned i3 ) { - vcache_triangle_flags( vcache, - ( DRAW_PIPE_RESET_STIPPLE | - DRAW_PIPE_EDGE_FLAG_0 | - DRAW_PIPE_EDGE_FLAG_2 ), - i0, i1, i3 ); - - vcache_triangle_flags( vcache, - ( DRAW_PIPE_EDGE_FLAG_0 | - DRAW_PIPE_EDGE_FLAG_1 ), - i1, i2, i3 ); + if (vcache->draw->rasterizer->flatshade_first) { + vcache_triangle_flags( vcache, + ( DRAW_PIPE_RESET_STIPPLE | + DRAW_PIPE_EDGE_FLAG_0 | + DRAW_PIPE_EDGE_FLAG_1 ), + i0, i1, i2 ); + + vcache_triangle_flags( vcache, + ( DRAW_PIPE_EDGE_FLAG_2 | + DRAW_PIPE_EDGE_FLAG_1 ), + i0, i2, i3 ); + } + else { + vcache_triangle_flags( vcache, + ( DRAW_PIPE_RESET_STIPPLE | + DRAW_PIPE_EDGE_FLAG_0 | + DRAW_PIPE_EDGE_FLAG_2 ), + i0, i1, i3 ); + + vcache_triangle_flags( vcache, + ( DRAW_PIPE_EDGE_FLAG_0 | + DRAW_PIPE_EDGE_FLAG_1 ), + i1, i2, i3 ); + } } /* At least for now, we're back to using a template include file for @@ -453,7 +468,7 @@ vcache_prepare( struct draw_pt_front_end *frontend, } vcache->input_prim = prim; - vcache->output_prim = draw_pt_reduced_prim(prim); + vcache->output_prim = u_reduced_prim(prim); vcache->middle = middle; vcache->opt = opt; diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h index ec05bbeab40..62822a3d562 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h +++ b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h @@ -118,21 +118,39 @@ static void FUNC( struct draw_pt_front_end *frontend, case PIPE_PRIM_QUADS: for (i = 0; i+3 < count; i += 4) { - QUAD( vcache, - get_elt(elts, i + 0), - get_elt(elts, i + 1), - get_elt(elts, i + 2), - get_elt(elts, i + 3)); + if (flatfirst) { + QUAD( vcache, + get_elt(elts, i + 0), + get_elt(elts, i + 1), + get_elt(elts, i + 2), + get_elt(elts, i + 3) ); + } + else { + QUAD( vcache, + get_elt(elts, i + 0), + get_elt(elts, i + 1), + get_elt(elts, i + 2), + get_elt(elts, i + 3) ); + } } break; case PIPE_PRIM_QUAD_STRIP: for (i = 0; i+3 < count; i += 2) { - QUAD( vcache, - get_elt(elts, i + 2), - get_elt(elts, i + 0), - get_elt(elts, i + 1), - get_elt(elts, i + 3)); + if (flatfirst) { + QUAD( vcache, + get_elt(elts, i + 0), + get_elt(elts, i + 1), + get_elt(elts, i + 3), + get_elt(elts, i + 2) ); + } + else { + QUAD( vcache, + get_elt(elts, i + 2), + get_elt(elts, i + 0), + get_elt(elts, i + 1), + get_elt(elts, i + 3) ); + } } break; @@ -144,19 +162,38 @@ static void FUNC( struct draw_pt_front_end *frontend, const ushort edge_first = DRAW_PIPE_EDGE_FLAG_2; const ushort edge_middle = DRAW_PIPE_EDGE_FLAG_0; const ushort edge_last = DRAW_PIPE_EDGE_FLAG_1; + ushort edge_next, edge_finish; - flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle; + if (flatfirst) { + flags = DRAW_PIPE_RESET_STIPPLE | edge_middle | edge_last; + edge_next = edge_last; + edge_finish = edge_first; + } + else { + flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle; + edge_next = edge_middle; + edge_finish = edge_last; + } - for (i = 0; i+2 < count; i++, flags = edge_middle) { + for (i = 0; i+2 < count; i++, flags = edge_next) { if (i + 3 == count) - flags |= edge_last; + flags |= edge_finish; - TRIANGLE( vcache, - flags, - get_elt(elts, i + 1), - get_elt(elts, i + 2), - get_elt(elts, 0)); + if (flatfirst) { + TRIANGLE( vcache, + flags, + get_elt(elts, 0), + get_elt(elts, i + 1), + get_elt(elts, i + 2) ); + } + else { + TRIANGLE( vcache, + flags, + get_elt(elts, i + 1), + get_elt(elts, i + 2), + get_elt(elts, 0)); + } } } break; diff --git a/src/gallium/auxiliary/indices/u_indices.c b/src/gallium/auxiliary/indices/u_indices.c index 0cf7d88653c..03d7453f303 100644 --- a/src/gallium/auxiliary/indices/u_indices.c +++ b/src/gallium/auxiliary/indices/u_indices.c @@ -244,7 +244,7 @@ int u_index_generator( unsigned hw_mask, default: assert(0); - *out_generate = generate[out_idx][in_pv][out_pv][prim]; + *out_generate = generate[out_idx][in_pv][out_pv][PIPE_PRIM_POINTS]; *out_prim = PIPE_PRIM_POINTS; *out_nr = nr; return U_TRANSLATE_ERROR; diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h index 92b6fd00564..2590546cb4a 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h @@ -72,6 +72,12 @@ struct pb_desc /** + * Size. Regular (32bit) unsigned for now. + */ +typedef unsigned pb_size; + + +/** * Base class for all pb_* buffers. */ struct pb_buffer @@ -126,7 +132,7 @@ struct pb_vtbl */ void (*get_base_buffer)( struct pb_buffer *buf, struct pb_buffer **base_buf, - unsigned *offset ); + pb_size *offset ); }; @@ -177,7 +183,7 @@ pb_unmap(struct pb_buffer *buf) static INLINE void pb_get_base_buffer( struct pb_buffer *buf, struct pb_buffer **base_buf, - unsigned *offset ) + pb_size *offset ) { assert(buf); if(!buf) { @@ -241,7 +247,7 @@ pb_reference(struct pb_buffer **dst, * the requested or not. */ static INLINE boolean -pb_check_alignment(size_t requested, size_t provided) +pb_check_alignment(pb_size requested, pb_size provided) { if(!requested) return TRUE; @@ -269,7 +275,7 @@ pb_check_usage(unsigned requested, unsigned provided) * hardware. */ struct pb_buffer * -pb_malloc_buffer_create(size_t size, +pb_malloc_buffer_create(pb_size size, const struct pb_desc *desc); diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 4698efa69cf..109ac7c9d63 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -65,11 +65,11 @@ struct fenced_buffer_list struct pb_fence_ops *ops; - size_t numDelayed; + pb_size numDelayed; struct list_head delayed; #ifdef DEBUG - size_t numUnfenced; + pb_size numUnfenced; struct list_head unfenced; #endif }; @@ -433,7 +433,7 @@ fenced_buffer_fence(struct pb_buffer *buf, static void fenced_buffer_get_base_buffer(struct pb_buffer *buf, struct pb_buffer **base_buf, - unsigned *offset) + pb_size *offset) { struct fenced_buffer *fenced_buf = fenced_buffer(buf); pb_get_base_buffer(fenced_buf->buffer, base_buf, offset); diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c index 689fd74771f..6bdce5fcb06 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c @@ -53,6 +53,8 @@ static INLINE struct malloc_buffer * malloc_buffer(struct pb_buffer *buf) { assert(buf); + if (!buf) + return NULL; assert(buf->vtbl == &malloc_buffer_vtbl); return (struct malloc_buffer *)buf; } @@ -102,7 +104,7 @@ malloc_buffer_fence(struct pb_buffer *buf, static void malloc_buffer_get_base_buffer(struct pb_buffer *buf, struct pb_buffer **base_buf, - unsigned *offset) + pb_size *offset) { *base_buf = buf; *offset = 0; @@ -121,7 +123,7 @@ malloc_buffer_vtbl = { struct pb_buffer * -pb_malloc_buffer_create(size_t size, +pb_malloc_buffer_create(pb_size size, const struct pb_desc *desc) { struct malloc_buffer *buf; @@ -150,7 +152,7 @@ pb_malloc_buffer_create(size_t size, static struct pb_buffer * pb_malloc_bufmgr_create_buffer(struct pb_manager *mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { return pb_malloc_buffer_create(size, desc); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h index 74077f82774..39ab8e722c1 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h @@ -73,7 +73,7 @@ struct pb_manager struct pb_buffer * (*create_buffer)( struct pb_manager *mgr, - size_t size, + pb_size size, const struct pb_desc *desc); /** @@ -106,7 +106,7 @@ pb_malloc_bufmgr_create(void); */ struct pb_manager * pool_bufmgr_create(struct pb_manager *provider, - size_t n, size_t size, + pb_size n, pb_size size, const struct pb_desc *desc); @@ -119,7 +119,7 @@ pool_bufmgr_create(struct pb_manager *provider, */ struct pb_manager * mm_bufmgr_create(struct pb_manager *provider, - size_t size, size_t align2); + pb_size size, pb_size align2); /** * Same as mm_bufmgr_create. @@ -128,7 +128,7 @@ mm_bufmgr_create(struct pb_manager *provider, */ struct pb_manager * mm_bufmgr_create_from_buffer(struct pb_buffer *buffer, - size_t size, size_t align2); + pb_size size, pb_size align2); /** @@ -136,8 +136,8 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer, */ struct pb_manager * pb_slab_manager_create(struct pb_manager *provider, - size_t bufSize, - size_t slabSize, + pb_size bufSize, + pb_size slabSize, const struct pb_desc *desc); /** @@ -146,9 +146,9 @@ pb_slab_manager_create(struct pb_manager *provider, */ struct pb_manager * pb_slab_range_manager_create(struct pb_manager *provider, - size_t minBufSize, - size_t maxBufSize, - size_t slabSize, + pb_size minBufSize, + pb_size maxBufSize, + pb_size slabSize, const struct pb_desc *desc); @@ -204,7 +204,7 @@ pb_ondemand_manager_create(struct pb_manager *provider); */ struct pb_manager * pb_debug_manager_create(struct pb_manager *provider, - size_t underflow_size, size_t overflow_size); + pb_size underflow_size, pb_size overflow_size); #ifdef __cplusplus diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c index db67d46c561..f60c836f18b 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c @@ -60,7 +60,7 @@ pb_alt_manager(struct pb_manager *mgr) static struct pb_buffer * pb_alt_manager_create_buffer(struct pb_manager *_mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { struct pb_alt_manager *mgr = pb_alt_manager(_mgr); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index 35358430b43..57d1ede45a4 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c @@ -81,7 +81,7 @@ struct pb_cache_manager pipe_mutex mutex; struct list_head delayed; - size_t numDelayed; + pb_size numDelayed; }; @@ -204,7 +204,7 @@ pb_cache_buffer_fence(struct pb_buffer *_buf, static void pb_cache_buffer_get_base_buffer(struct pb_buffer *_buf, struct pb_buffer **base_buf, - unsigned *offset) + pb_size *offset) { struct pb_cache_buffer *buf = pb_cache_buffer(_buf); pb_get_base_buffer(buf->buffer, base_buf, offset); @@ -224,7 +224,7 @@ pb_cache_buffer_vtbl = { static INLINE boolean pb_cache_is_buffer_compat(struct pb_cache_buffer *buf, - size_t size, + pb_size size, const struct pb_desc *desc) { if(buf->base.base.size < size) @@ -246,7 +246,7 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf, static struct pb_buffer * pb_cache_manager_create_buffer(struct pb_manager *_mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { struct pb_cache_manager *mgr = pb_cache_manager(_mgr); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index cedf745bdac..1b4df28c707 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -72,8 +72,8 @@ struct pb_debug_buffer struct pb_buffer *buffer; struct pb_debug_manager *mgr; - size_t underflow_size; - size_t overflow_size; + pb_size underflow_size; + pb_size overflow_size; struct debug_stack_frame create_backtrace[PB_DEBUG_CREATE_BACKTRACE]; @@ -91,8 +91,8 @@ struct pb_debug_manager struct pb_manager *provider; - size_t underflow_size; - size_t overflow_size; + pb_size underflow_size; + pb_size overflow_size; pipe_mutex mutex; struct list_head list; @@ -124,9 +124,9 @@ static const uint8_t random_pattern[32] = { static INLINE void -fill_random_pattern(uint8_t *dst, size_t size) +fill_random_pattern(uint8_t *dst, pb_size size) { - size_t i = 0; + pb_size i = 0; while(size--) { *dst++ = random_pattern[i++]; i &= sizeof(random_pattern) - 1; @@ -135,11 +135,11 @@ fill_random_pattern(uint8_t *dst, size_t size) static INLINE boolean -check_random_pattern(const uint8_t *dst, size_t size, - size_t *min_ofs, size_t *max_ofs) +check_random_pattern(const uint8_t *dst, pb_size size, + pb_size *min_ofs, pb_size *max_ofs) { boolean result = TRUE; - size_t i; + pb_size i; *min_ofs = size; *max_ofs = 0; for(i = 0; i < size; ++i) { @@ -183,7 +183,7 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf) assert(map); if(map) { boolean underflow, overflow; - size_t min_ofs, max_ofs; + pb_size min_ofs, max_ofs; underflow = !check_random_pattern(map, buf->underflow_size, &min_ofs, &max_ofs); @@ -287,7 +287,7 @@ pb_debug_buffer_unmap(struct pb_buffer *_buf) static void pb_debug_buffer_get_base_buffer(struct pb_buffer *_buf, struct pb_buffer **base_buf, - unsigned *offset) + pb_size *offset) { struct pb_debug_buffer *buf = pb_debug_buffer(_buf); pb_get_base_buffer(buf->buffer, base_buf, offset); @@ -363,13 +363,13 @@ pb_debug_manager_dump(struct pb_debug_manager *mgr) static struct pb_buffer * pb_debug_manager_create_buffer(struct pb_manager *_mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { struct pb_debug_manager *mgr = pb_debug_manager(_mgr); struct pb_debug_buffer *buf; struct pb_desc real_desc; - size_t real_size; + pb_size real_size; buf = CALLOC_STRUCT(pb_debug_buffer); if(!buf) @@ -455,7 +455,7 @@ pb_debug_manager_destroy(struct pb_manager *_mgr) struct pb_manager * pb_debug_manager_create(struct pb_manager *provider, - size_t underflow_size, size_t overflow_size) + pb_size underflow_size, pb_size overflow_size) { struct pb_debug_manager *mgr; @@ -485,7 +485,7 @@ pb_debug_manager_create(struct pb_manager *provider, struct pb_manager * pb_debug_manager_create(struct pb_manager *provider, - size_t underflow_size, size_t overflow_size) + pb_size underflow_size, pb_size overflow_size) { return provider; } diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c index 144db5669b6..97dd1427fda 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c @@ -62,7 +62,7 @@ fenced_pb_manager(struct pb_manager *mgr) static struct pb_buffer * fenced_bufmgr_create_buffer(struct pb_manager *mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c index d8decba49df..6400fc5b0a3 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c @@ -55,10 +55,10 @@ struct mm_pb_manager pipe_mutex mutex; - size_t size; + pb_size size; struct mem_block *heap; - size_t align2; + pb_size align2; struct pb_buffer *buffer; void *map; @@ -148,7 +148,7 @@ mm_buffer_fence(struct pb_buffer *buf, static void mm_buffer_get_base_buffer(struct pb_buffer *buf, struct pb_buffer **base_buf, - unsigned *offset) + pb_size *offset) { struct mm_buffer *mm_buf = mm_buffer(buf); struct mm_pb_manager *mm = mm_buf->mgr; @@ -170,15 +170,15 @@ mm_buffer_vtbl = { static struct pb_buffer * mm_bufmgr_create_buffer(struct pb_manager *mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { struct mm_pb_manager *mm = mm_pb_manager(mgr); struct mm_buffer *mm_buf; /* We don't handle alignments larger then the one initially setup */ - assert(pb_check_alignment(desc->alignment, 1 << mm->align2)); - if(!pb_check_alignment(desc->alignment, 1 << mm->align2)) + assert(pb_check_alignment(desc->alignment, (pb_size)1 << mm->align2)); + if(!pb_check_alignment(desc->alignment, (pb_size)1 << mm->align2)) return NULL; pipe_mutex_lock(mm->mutex); @@ -198,7 +198,7 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr, mm_buf->mgr = mm; - mm_buf->block = u_mmAllocMem(mm->heap, size, mm->align2, 0); + mm_buf->block = u_mmAllocMem(mm->heap, (int)size, (int)mm->align2, 0); if(!mm_buf->block) { #if 0 debug_printf("warning: heap full\n"); @@ -210,8 +210,8 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr, } /* Some sanity checks */ - assert(0 <= (unsigned)mm_buf->block->ofs && (unsigned)mm_buf->block->ofs < mm->size); - assert(size <= (unsigned)mm_buf->block->size && (unsigned)mm_buf->block->ofs + (unsigned)mm_buf->block->size <= mm->size); + assert(0 <= (pb_size)mm_buf->block->ofs && (pb_size)mm_buf->block->ofs < mm->size); + assert(size <= (pb_size)mm_buf->block->size && (pb_size)mm_buf->block->ofs + (pb_size)mm_buf->block->size <= mm->size); pipe_mutex_unlock(mm->mutex); return SUPER(mm_buf); @@ -245,7 +245,7 @@ mm_bufmgr_destroy(struct pb_manager *mgr) struct pb_manager * mm_bufmgr_create_from_buffer(struct pb_buffer *buffer, - size_t size, size_t align2) + pb_size size, pb_size align2) { struct mm_pb_manager *mm; @@ -273,7 +273,7 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer, if(!mm->map) goto failure; - mm->heap = u_mmInit(0, size); + mm->heap = u_mmInit(0, (int)size); if (!mm->heap) goto failure; @@ -292,7 +292,7 @@ if(mm->heap) struct pb_manager * mm_bufmgr_create(struct pb_manager *provider, - size_t size, size_t align2) + pb_size size, pb_size align2) { struct pb_buffer *buffer; struct pb_manager *mgr; diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c index 4f7e6b1c4df..cb32d251367 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c @@ -55,7 +55,7 @@ struct pb_ondemand_buffer /** Real buffer */ struct pb_buffer *buffer; - size_t size; + pb_size size; struct pb_desc desc; }; @@ -74,6 +74,8 @@ static INLINE struct pb_ondemand_buffer * pb_ondemand_buffer(struct pb_buffer *buf) { assert(buf); + if (!buf) + return NULL; assert(buf->vtbl == &pb_ondemand_buffer_vtbl); return (struct pb_ondemand_buffer *)buf; } @@ -204,7 +206,7 @@ pb_ondemand_buffer_fence(struct pb_buffer *_buf, static void pb_ondemand_buffer_get_base_buffer(struct pb_buffer *_buf, struct pb_buffer **base_buf, - unsigned *offset) + pb_size *offset) { struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf); @@ -232,7 +234,7 @@ pb_ondemand_buffer_vtbl = { static struct pb_buffer * pb_ondemand_manager_create_buffer(struct pb_manager *_mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { struct pb_ondemand_manager *mgr = pb_ondemand_manager(_mgr); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c index 07fd1a22d93..7fd65ed2261 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c @@ -58,11 +58,11 @@ struct pool_pb_manager pipe_mutex mutex; - size_t bufSize; - size_t bufAlign; + pb_size bufSize; + pb_size bufAlign; - size_t numFree; - size_t numTot; + pb_size numFree; + pb_size numTot; struct list_head free; @@ -89,7 +89,7 @@ struct pool_buffer struct list_head head; - size_t start; + pb_size start; }; @@ -162,7 +162,7 @@ pool_buffer_fence(struct pb_buffer *buf, static void pool_buffer_get_base_buffer(struct pb_buffer *buf, struct pb_buffer **base_buf, - unsigned *offset) + pb_size *offset) { struct pool_buffer *pool_buf = pool_buffer(buf); struct pool_pb_manager *pool = pool_buf->mgr; @@ -184,7 +184,7 @@ pool_buffer_vtbl = { static struct pb_buffer * pool_bufmgr_create_buffer(struct pb_manager *mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { struct pool_pb_manager *pool = pool_pb_manager(mgr); @@ -251,13 +251,13 @@ pool_bufmgr_destroy(struct pb_manager *mgr) struct pb_manager * pool_bufmgr_create(struct pb_manager *provider, - size_t numBufs, - size_t bufSize, + pb_size numBufs, + pb_size bufSize, const struct pb_desc *desc) { struct pool_pb_manager *pool; struct pool_buffer *pool_buf; - size_t i; + pb_size i; if(!provider) return NULL; diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c index 724aaadb436..e7352e90db9 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c @@ -68,7 +68,7 @@ struct pb_slab_buffer unsigned mapCount; /** Offset relative to the start of the slab buffer. */ - size_t start; + pb_size start; /** Use when validating, to signal that all mappings are finished */ /* TODO: Actually validation does not reach this stage yet */ @@ -83,8 +83,8 @@ struct pb_slab { struct list_head head; struct list_head freeBuffers; - size_t numBuffers; - size_t numFree; + pb_size numBuffers; + pb_size numFree; struct pb_slab_buffer *buffers; struct pb_slab_manager *mgr; @@ -108,10 +108,10 @@ struct pb_slab_manager struct pb_manager *provider; /** Size of the buffers we hand on downstream */ - size_t bufSize; + pb_size bufSize; /** Size of the buffers we request upstream */ - size_t slabSize; + pb_size slabSize; /** * Alignment, usage to be used to allocate the slab buffers. @@ -150,14 +150,14 @@ struct pb_slab_range_manager struct pb_manager *provider; - size_t minBufSize; - size_t maxBufSize; + pb_size minBufSize; + pb_size maxBufSize; /** @sa pb_slab_manager::desc */ struct pb_desc desc; unsigned numBuckets; - size_t *bucketSizes; + pb_size *bucketSizes; /** Array of pb_slab_manager, one for each bucket size */ struct pb_manager **buckets; @@ -270,7 +270,7 @@ pb_slab_buffer_fence(struct pb_buffer *_buf, static void pb_slab_buffer_get_base_buffer(struct pb_buffer *_buf, struct pb_buffer **base_buf, - unsigned *offset) + pb_size *offset) { struct pb_slab_buffer *buf = pb_slab_buffer(_buf); pb_get_base_buffer(buf->slab->bo, base_buf, offset); @@ -369,7 +369,7 @@ out_err0: static struct pb_buffer * pb_slab_manager_create_buffer(struct pb_manager *_mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { struct pb_slab_manager *mgr = pb_slab_manager(_mgr); @@ -450,8 +450,8 @@ pb_slab_manager_destroy(struct pb_manager *_mgr) struct pb_manager * pb_slab_manager_create(struct pb_manager *provider, - size_t bufSize, - size_t slabSize, + pb_size bufSize, + pb_size slabSize, const struct pb_desc *desc) { struct pb_slab_manager *mgr; @@ -479,11 +479,11 @@ pb_slab_manager_create(struct pb_manager *provider, static struct pb_buffer * pb_slab_range_manager_create_buffer(struct pb_manager *_mgr, - size_t size, + pb_size size, const struct pb_desc *desc) { struct pb_slab_range_manager *mgr = pb_slab_range_manager(_mgr); - size_t bufSize; + pb_size bufSize; unsigned i; bufSize = mgr->minBufSize; @@ -527,13 +527,13 @@ pb_slab_range_manager_destroy(struct pb_manager *_mgr) struct pb_manager * pb_slab_range_manager_create(struct pb_manager *provider, - size_t minBufSize, - size_t maxBufSize, - size_t slabSize, + pb_size minBufSize, + pb_size maxBufSize, + pb_size slabSize, const struct pb_desc *desc) { struct pb_slab_range_manager *mgr; - size_t bufSize; + pb_size bufSize; unsigned i; if(!provider) diff --git a/src/gallium/auxiliary/rtasm/rtasm_ppc.c b/src/gallium/auxiliary/rtasm/rtasm_ppc.c index e3586482db4..ef4b306cb67 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_ppc.c +++ b/src/gallium/auxiliary/rtasm/rtasm_ppc.c @@ -168,7 +168,7 @@ ppc_allocate_register(struct ppc_function *p) { unsigned i; for (i = 0; i < PPC_NUM_REGS; i++) { - const uint64_t mask = 1 << i; + const uint32_t mask = 1 << i; if ((p->reg_used & mask) == 0) { p->reg_used |= mask; return i; @@ -200,7 +200,7 @@ ppc_allocate_fp_register(struct ppc_function *p) { unsigned i; for (i = 0; i < PPC_NUM_FP_REGS; i++) { - const uint64_t mask = 1 << i; + const uint32_t mask = 1 << i; if ((p->fp_used & mask) == 0) { p->fp_used |= mask; return i; @@ -232,7 +232,7 @@ ppc_allocate_vec_register(struct ppc_function *p) { unsigned i; for (i = 0; i < PPC_NUM_VEC_REGS; i++) { - const uint64_t mask = 1 << i; + const uint32_t mask = 1 << i; if ((p->vec_used & mask) == 0) { p->vec_used |= mask; return i; diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index a1891a140ac..d272533d63c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -139,8 +139,8 @@ tgsi_build_declaration( { struct tgsi_declaration declaration; - assert( file <= TGSI_FILE_IMMEDIATE ); - assert( interpolate <= TGSI_INTERPOLATE_PERSPECTIVE ); + assert( file < TGSI_FILE_COUNT ); + assert( interpolate < TGSI_INTERPOLATE_COUNT ); declaration = tgsi_default_declaration(); declaration.File = file; @@ -584,6 +584,7 @@ tgsi_build_full_instruction( *dst_register = tgsi_build_dst_register( reg->DstRegister.File, reg->DstRegister.WriteMask, + reg->DstRegister.Indirect, reg->DstRegister.Index, instruction, header ); @@ -631,6 +632,28 @@ tgsi_build_full_instruction( header ); prev_token = (struct tgsi_token *) dst_register_ext_modulate; } + + if( reg->DstRegister.Indirect ) { + struct tgsi_src_register *ind; + + if( maxsize <= size ) + return 0; + ind = (struct tgsi_src_register *) &tokens[size]; + size++; + + *ind = tgsi_build_src_register( + reg->DstRegisterInd.File, + reg->DstRegisterInd.SwizzleX, + reg->DstRegisterInd.SwizzleY, + reg->DstRegisterInd.SwizzleZ, + reg->DstRegisterInd.SwizzleW, + reg->DstRegisterInd.Negate, + reg->DstRegisterInd.Indirect, + reg->DstRegisterInd.Dimension, + reg->DstRegisterInd.Index, + instruction, + header ); + } } for( i = 0; i < full_inst->Instruction.NumSrcRegs; i++ ) { @@ -973,7 +996,7 @@ tgsi_build_src_register( { struct tgsi_src_register src_register; - assert( file <= TGSI_FILE_IMMEDIATE ); + assert( file < TGSI_FILE_COUNT ); assert( swizzle_x <= TGSI_SWIZZLE_W ); assert( swizzle_y <= TGSI_SWIZZLE_W ); assert( swizzle_z <= TGSI_SWIZZLE_W ); @@ -1194,13 +1217,14 @@ struct tgsi_dst_register tgsi_build_dst_register( unsigned file, unsigned mask, + unsigned indirect, int index, struct tgsi_instruction *instruction, struct tgsi_header *header ) { struct tgsi_dst_register dst_register; - assert( file <= TGSI_FILE_IMMEDIATE ); + assert( file < TGSI_FILE_COUNT ); assert( mask <= TGSI_WRITEMASK_XYZW ); assert( index >= -32768 && index <= 32767 ); @@ -1208,6 +1232,7 @@ tgsi_build_dst_register( dst_register.File = file; dst_register.WriteMask = mask; dst_register.Index = index; + dst_register.Indirect = indirect; instruction_grow( instruction, header ); @@ -1220,6 +1245,7 @@ tgsi_default_full_dst_register( void ) struct tgsi_full_dst_register full_dst_register; full_dst_register.DstRegister = tgsi_default_dst_register(); + full_dst_register.DstRegisterInd = tgsi_default_src_register(); full_dst_register.DstRegisterExtConcode = tgsi_default_dst_register_ext_concode(); full_dst_register.DstRegisterExtModulate = diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h index 0fd6fabd83d..9a3a077cf2b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.h +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h @@ -289,6 +289,7 @@ struct tgsi_dst_register tgsi_build_dst_register( unsigned file, unsigned mask, + unsigned indirect, int index, struct tgsi_instruction *instruction, struct tgsi_header *header ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index a784b7cc3c1..a6994ecd48b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -27,6 +27,8 @@ #include "util/u_debug.h" #include "util/u_string.h" +#include "util/u_math.h" +#include "util/u_memory.h" #include "tgsi_dump.h" #include "tgsi_info.h" #include "tgsi_iterate.h" @@ -107,7 +109,8 @@ static const char *semantic_names[] = "FOG", "PSIZE", "GENERIC", - "NORMAL" + "NORMAL", + "FACE" }; static const char *immediate_type_names[] = @@ -223,6 +226,9 @@ iter_declaration( { struct dump_ctx *ctx = (struct dump_ctx *)iter; + assert(Elements(semantic_names) == TGSI_SEMANTIC_COUNT); + assert(Elements(interpolate_names) == TGSI_INTERPOLATE_COUNT); + TXT( "DCL " ); _dump_register( @@ -354,11 +360,22 @@ iter_instruction( CHR( ',' ); CHR( ' ' ); - _dump_register( - ctx, - dst->DstRegister.File, - dst->DstRegister.Index, - dst->DstRegister.Index ); + if (dst->DstRegister.Indirect) { + _dump_register_ind( + ctx, + dst->DstRegister.File, + dst->DstRegister.Index, + dst->DstRegisterInd.File, + dst->DstRegisterInd.Index, + dst->DstRegisterInd.SwizzleX ); + } + else { + _dump_register( + ctx, + dst->DstRegister.File, + dst->DstRegister.Index, + dst->DstRegister.Index ); + } ENM( dst->DstRegisterExtModulate.Modulate, modulate_names ); _dump_writemask( ctx, dst->DstRegister.WriteMask ); @@ -516,7 +533,7 @@ struct str_dump_ctx struct dump_ctx base; char *str; char *ptr; - size_t left; + int left; }; static void @@ -525,13 +542,20 @@ str_dump_ctx_printf(struct dump_ctx *ctx, const char *format, ...) struct str_dump_ctx *sctx = (struct str_dump_ctx *)ctx; if(sctx->left > 1) { - size_t written; + int written; va_list ap; va_start(ap, format); written = util_vsnprintf(sctx->ptr, sctx->left, format, ap); va_end(ap); - sctx->ptr += written; - sctx->left -= written; + + /* Some complicated logic needed to handle the return value of + * vsnprintf: + */ + if (written > 0) { + written = MIN2(sctx->left, written); + sctx->ptr += written; + sctx->left -= written; + } } } @@ -556,7 +580,7 @@ tgsi_dump_str( ctx.str = str; ctx.str[0] = 0; ctx.ptr = str; - ctx.left = size; + ctx.left = (int)size; tgsi_iterate_shader( tokens, &ctx.base.iter ); } diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index aba7a3f9374..5cb322a5fa2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1395,28 +1395,69 @@ store_dest( union tgsi_exec_channel null; union tgsi_exec_channel *dst; uint execmask = mach->ExecMask; + int offset = 0; /* indirection offset */ + int index; #ifdef DEBUG check_inf_or_nan(chan); #endif + /* There is an extra source register that indirectly subscripts + * a register file. The direct index now becomes an offset + * that is being added to the indirect register. + * + * file[ind[2].x+1], + * where: + * ind = DstRegisterInd.File + * [2] = DstRegisterInd.Index + * .x = DstRegisterInd.SwizzleX + */ + if (reg->DstRegister.Indirect) { + union tgsi_exec_channel index; + union tgsi_exec_channel indir_index; + uint swizzle; + + /* which address register (always zero for now) */ + index.i[0] = + index.i[1] = + index.i[2] = + index.i[3] = reg->DstRegisterInd.Index; + + /* get current value of address register[swizzle] */ + swizzle = tgsi_util_get_src_register_swizzle( ®->DstRegisterInd, CHAN_X ); + + /* fetch values from the address/indirection register */ + fetch_src_file_channel( + mach, + reg->DstRegisterInd.File, + swizzle, + &index, + &indir_index ); + + /* save indirection offset */ + offset = (int) indir_index.f[0]; + } + switch (reg->DstRegister.File) { case TGSI_FILE_NULL: dst = &null; break; case TGSI_FILE_OUTPUT: - dst = &mach->Outputs[mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] - + reg->DstRegister.Index].xyzw[chan_index]; + index = mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] + + reg->DstRegister.Index; + dst = &mach->Outputs[offset + index].xyzw[chan_index]; break; case TGSI_FILE_TEMPORARY: - assert( reg->DstRegister.Index < TGSI_EXEC_NUM_TEMPS ); - dst = &mach->Temps[reg->DstRegister.Index].xyzw[chan_index]; + index = reg->DstRegister.Index; + assert( index < TGSI_EXEC_NUM_TEMPS ); + dst = &mach->Temps[offset + index].xyzw[chan_index]; break; case TGSI_FILE_ADDRESS: - dst = &mach->Addrs[reg->DstRegister.Index].xyzw[chan_index]; + index = reg->DstRegister.Index; + dst = &mach->Addrs[index].xyzw[chan_index]; break; default: diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 0081f74ffc4..7f2cfb7988f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -219,7 +219,6 @@ tgsi_parse_token( /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->FullDstRegisters[i].DstRegister.Indirect ); assert( !inst->FullDstRegisters[i].DstRegister.Dimension ); extended = inst->FullDstRegisters[i].DstRegister.Extended; @@ -246,6 +245,17 @@ tgsi_parse_token( extended = token.Extended; } + + if( inst->FullDstRegisters[i].DstRegister.Indirect ) { + next_token( ctx, &inst->FullDstRegisters[i].DstRegisterInd ); + + /* + * No support for indirect or multi-dimensional addressing. + */ + assert( !inst->FullDstRegisters[i].DstRegisterInd.Indirect ); + assert( !inst->FullDstRegisters[i].DstRegisterInd.Dimension ); + assert( !inst->FullDstRegisters[i].DstRegisterInd.Extended ); + } } assert( inst->Instruction.NumSrcRegs <= TGSI_FULL_MAX_SRC_REGISTERS ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index 054350712d8..a289e26e3ac 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -48,6 +48,7 @@ struct tgsi_full_header struct tgsi_full_dst_register { struct tgsi_dst_register DstRegister; + struct tgsi_src_register DstRegisterInd; struct tgsi_dst_register_ext_concode DstRegisterExtConcode; struct tgsi_dst_register_ext_modulate DstRegisterExtModulate; }; diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index a40fcab2126..a76bbc91400 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -26,6 +26,7 @@ **************************************************************************/ #include "util/u_debug.h" +#include "util/u_memory.h" #include "tgsi_text.h" #include "tgsi_build.h" #include "tgsi_info.h" @@ -927,7 +928,8 @@ static const char *semantic_names[TGSI_SEMANTIC_COUNT] = "FOG", "PSIZE", "GENERIC", - "NORMAL" + "NORMAL", + "FACE" }; static const char *interpolate_names[TGSI_INTERPOLATE_COUNT] = @@ -947,6 +949,9 @@ static boolean parse_declaration( struct translate_ctx *ctx ) const char *cur; uint advance; + assert(Elements(semantic_names) == TGSI_SEMANTIC_COUNT); + assert(Elements(interpolate_names) == TGSI_INTERPOLATE_COUNT); + if (!eat_white( &ctx->cur )) { report_error( ctx, "Syntax error" ); return FALSE; diff --git a/src/gallium/auxiliary/trace/trace_drm.h b/src/gallium/auxiliary/trace/trace_drm.h deleted file mode 100644 index 892bd9860c6..00000000000 --- a/src/gallium/auxiliary/trace/trace_drm.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2009 Jakob Bornecrantz <[email protected]> - * Corbin Simpson <[email protected]> - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHOR(S) 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 TRACE_DRM_H -#define TRACE_DRM_H - -#include "state_tracker/drm_api.h" - -#include "trace/tr_buffer.h" -#include "trace/tr_context.h" -#include "trace/tr_screen.h" -#include "trace/tr_texture.h" - -struct drm_api hooks; - -static struct pipe_screen * -trace_drm_create_screen(int fd, struct drm_create_screen_arg *arg) -{ - struct pipe_screen *screen; - - if (arg && arg->mode != DRM_CREATE_NORMAL) - return NULL; - - screen = hooks.create_screen(fd, arg); - - return trace_screen_create(screen); -}; - -static struct pipe_context * -trace_drm_create_context(struct pipe_screen *_screen) -{ - struct pipe_screen *screen; - struct pipe_context *pipe; - - if (trace_enabled()) - screen = trace_screen(_screen)->screen; - else - screen = _screen; - - pipe = hooks.create_context(screen); - - if (trace_enabled()) - pipe = trace_context_create(_screen, pipe); - - return pipe; -}; - -static boolean -trace_drm_buffer_from_texture(struct pipe_texture *_texture, - struct pipe_buffer **_buffer, - unsigned *stride) -{ - struct pipe_texture *texture; - struct pipe_buffer *buffer = NULL; - boolean result; - - if (trace_enabled()) - texture = trace_texture(_texture)->texture; - else - texture = _texture; - - result = hooks.buffer_from_texture(texture, &buffer, stride); - - if (result && _buffer) - buffer = trace_buffer_create(trace_screen(texture->screen), buffer); - - if (_buffer) - *_buffer = buffer; - else - pipe_buffer_reference(&buffer, NULL); - - return result; -} - -static struct pipe_buffer * -trace_drm_buffer_from_handle(struct pipe_screen *_screen, - const char *name, - unsigned handle) -{ - struct pipe_screen *screen; - struct pipe_buffer *result; - - if (trace_enabled()) - screen = trace_screen(_screen)->screen; - else - screen = _screen; - - result = hooks.buffer_from_handle(screen, name, handle); - - if (trace_enabled()) - result = trace_buffer_create(trace_screen(_screen), result); - - return result; -} - -static boolean -trace_drm_handle_from_buffer(struct pipe_screen *_screen, - struct pipe_buffer *_buffer, - unsigned *handle) -{ - struct pipe_screen *screen; - struct pipe_buffer *buffer; - - if (trace_enabled()) { - screen = trace_screen(_screen)->screen; - buffer = trace_buffer(_buffer)->buffer; - } else { - screen = _screen; - buffer = _buffer; - } - - return hooks.handle_from_buffer(screen, buffer, handle); -} - -static boolean -trace_drm_global_handle_from_buffer(struct pipe_screen *_screen, - struct pipe_buffer *_buffer, - unsigned *handle) -{ - struct pipe_screen *screen; - struct pipe_buffer *buffer; - - if (trace_enabled()) { - screen = trace_screen(_screen)->screen; - buffer = trace_buffer(_buffer)->buffer; - } else { - screen = _screen; - buffer = _buffer; - } - - return hooks.global_handle_from_buffer(screen, buffer, handle); -} - -struct drm_api drm_api_hooks = -{ - .create_screen = trace_drm_create_screen, - .create_context = trace_drm_create_context, - - .buffer_from_texture = trace_drm_buffer_from_texture, - .buffer_from_handle = trace_drm_buffer_from_handle, - .handle_from_buffer = trace_drm_handle_from_buffer, - .global_handle_from_buffer = trace_drm_global_handle_from_buffer, -}; - -#endif /* TRACE_DRM_H */ diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c index 41cd38171fa..47c16b1c927 100644 --- a/src/gallium/auxiliary/util/u_cache.c +++ b/src/gallium/auxiliary/util/u_cache.c @@ -137,6 +137,8 @@ util_cache_set(struct util_cache *cache, struct util_cache_entry *entry; assert(cache); + if (!cache) + return; entry = util_cache_entry_get(cache, key); util_cache_entry_destroy(cache, entry); @@ -158,6 +160,8 @@ util_cache_get(struct util_cache *cache, struct util_cache_entry *entry; assert(cache); + if (!cache) + return NULL; entry = util_cache_entry_get(cache, key); if(!entry->key && !entry->value) @@ -176,7 +180,9 @@ util_cache_clear(struct util_cache *cache) uint32_t i; assert(cache); - + if (!cache) + return; + for(i = 0; i < cache->size; ++i) util_cache_entry_destroy(cache, &cache->entries[i]); } @@ -186,6 +192,8 @@ void util_cache_destroy(struct util_cache *cache) { assert(cache); + if (!cache) + return; #ifdef DEBUG if(cache->count >= 20*cache->size) { diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 18597ef8395..a5ca0b72bd7 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -97,10 +97,8 @@ void _debug_vprintf(const char *format, va_list ap) buf[0] = '\0'; } #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) - /* EngDebugPrint does not handle float point arguments, so we need to use - * our own vsnprintf implementation. It is also very slow, so buffer until - * we find a newline. */ - static char buf[512 + 1] = {'\0'}; + /* OutputDebugStringA can be very slow, so buffer until we find a newline. */ + static char buf[4096] = {'\0'}; size_t len = strlen(buf); int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap); if(ret > (int)(sizeof(buf) - len - 1) || util_strchr(buf + len, '\n')) { diff --git a/src/gallium/auxiliary/util/u_handle_table.c b/src/gallium/auxiliary/util/u_handle_table.c index 6da7353e259..3703718a621 100644 --- a/src/gallium/auxiliary/util/u_handle_table.c +++ b/src/gallium/auxiliary/util/u_handle_table.c @@ -87,6 +87,8 @@ handle_table_set_destroy(struct handle_table *ht, void (*destroy)(void *object)) { assert(ht); + if (!ht) + return; ht->destroy = destroy; } @@ -155,7 +157,7 @@ handle_table_add(struct handle_table *ht, assert(ht); assert(object); - if(!object) + if(!object || !ht) return 0; /* linear search for an empty handle */ @@ -193,7 +195,7 @@ handle_table_set(struct handle_table *ht, assert(ht); assert(handle); - if(!handle) + if(!handle || !ht) return 0; assert(object); @@ -222,7 +224,7 @@ handle_table_get(struct handle_table *ht, assert(ht); assert(handle); - if(!handle || handle > ht->size) + if(!handle || !ht || handle > ht->size) return NULL; object = ht->objects[handle - 1]; @@ -240,7 +242,7 @@ handle_table_remove(struct handle_table *ht, assert(ht); assert(handle); - if(!handle || handle > ht->size) + if(!handle || !ht || handle > ht->size) return; index = handle - 1; @@ -283,6 +285,9 @@ handle_table_destroy(struct handle_table *ht) unsigned index; assert(ht); + if (!ht) + return; + if(ht->destroy) for(index = 0; index < ht->size; ++index) handle_table_clear(ht, index); diff --git a/src/gallium/auxiliary/util/u_hash_table.c b/src/gallium/auxiliary/util/u_hash_table.c index 2f83e318e44..8c2a8f454cc 100644 --- a/src/gallium/auxiliary/util/u_hash_table.c +++ b/src/gallium/auxiliary/util/u_hash_table.c @@ -148,6 +148,8 @@ hash_table_set(struct hash_table *ht, struct cso_hash_iter iter; assert(ht); + if (!ht) + return PIPE_ERROR_BAD_INPUT; key_hash = ht->hash(key); @@ -183,6 +185,8 @@ hash_table_get(struct hash_table *ht, struct hash_table_item *item; assert(ht); + if (!ht) + return NULL; key_hash = ht->hash(key); @@ -203,6 +207,8 @@ hash_table_remove(struct hash_table *ht, struct hash_table_item *item; assert(ht); + if (!ht) + return; key_hash = ht->hash(key); @@ -225,7 +231,9 @@ hash_table_clear(struct hash_table *ht) struct hash_table_item *item; assert(ht); - + if (!ht) + return; + iter = cso_hash_first_node(ht->cso); while (!cso_hash_iter_is_null(iter)) { item = (struct hash_table_item *)cso_hash_take(ht->cso, cso_hash_iter_key(iter)); @@ -243,9 +251,11 @@ hash_table_foreach(struct hash_table *ht, struct cso_hash_iter iter; struct hash_table_item *item; enum pipe_error result; - + assert(ht); - + if (!ht) + return PIPE_ERROR_BAD_INPUT; + iter = cso_hash_first_node(ht->cso); while (!cso_hash_iter_is_null(iter)) { item = (struct hash_table_item *)cso_hash_iter_data(iter); @@ -264,9 +274,11 @@ hash_table_destroy(struct hash_table *ht) { struct cso_hash_iter iter; struct hash_table_item *item; - + assert(ht); - + if (!ht) + return; + iter = cso_hash_first_node(ht->cso); while (!cso_hash_iter_is_null(iter)) { item = (struct hash_table_item *)cso_hash_iter_data(iter); diff --git a/src/gallium/auxiliary/util/u_keymap.c b/src/gallium/auxiliary/util/u_keymap.c index 3f70809efdc..508a2ee0634 100644 --- a/src/gallium/auxiliary/util/u_keymap.c +++ b/src/gallium/auxiliary/util/u_keymap.c @@ -194,6 +194,8 @@ util_keymap_insert(struct keymap *map, const void *key, struct cso_hash_iter iter; assert(map); + if (!map) + return FALSE; key_hash = hash(key, map->key_size); @@ -234,6 +236,8 @@ util_keymap_lookup(const struct keymap *map, const void *key) struct keymap_item *item; assert(map); + if (!map) + return NULL; key_hash = hash(key, map->key_size); @@ -258,6 +262,8 @@ util_keymap_remove(struct keymap *map, const void *key, void *user) struct keymap_item *item; assert(map); + if (!map) + return; key_hash = hash(key, map->key_size); @@ -267,6 +273,8 @@ util_keymap_remove(struct keymap *map, const void *key, void *user) item = hash_table_item(iter); assert(item); + if (!item) + return; map->delete_func(map, item->key, item->value, user); FREE(item->key); FREE(item); @@ -288,7 +296,9 @@ util_keymap_remove_all(struct keymap *map, void *user) struct keymap_item *item; assert(map); - + if (!map) + return; + iter = cso_hash_first_node(map->cso); while (!cso_hash_iter_is_null(iter)) { item = (struct keymap_item *) diff --git a/src/gallium/auxiliary/util/u_prim.h b/src/gallium/auxiliary/util/u_prim.h index d7c3995dbf0..a9b533eea70 100644 --- a/src/gallium/auxiliary/util/u_prim.h +++ b/src/gallium/auxiliary/util/u_prim.h @@ -119,7 +119,7 @@ static INLINE boolean u_trim_pipe_prim( unsigned pipe_prim, unsigned *nr ) } -static INLINE boolean u_reduced_prim( unsigned pipe_prim ) +static INLINE unsigned u_reduced_prim( unsigned pipe_prim ) { switch (pipe_prim) { case PIPE_PRIM_POINTS: diff --git a/src/gallium/auxiliary/util/u_snprintf.c b/src/gallium/auxiliary/util/u_snprintf.c index 0d54299b28a..65bdd0df2b7 100644 --- a/src/gallium/auxiliary/util/u_snprintf.c +++ b/src/gallium/auxiliary/util/u_snprintf.c @@ -829,7 +829,7 @@ util_vsnprintf(char *str, size_t size, const char *format, va_list args) break; default: intptr = va_arg(args, int *); - *intptr = len; + *intptr = (int)len; break; } break; diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 9747a55cbfa..a0c8ed88f74 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -1202,6 +1202,19 @@ pipe_put_tile_z(struct pipe_transfer *pt, } break; case PIPE_FORMAT_S8Z24_UNORM: + { + uint *pDest = (uint *) (map + y * pt->stride + x*4); + assert(pt->usage == PIPE_TRANSFER_READ_WRITE); + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + /* convert 32-bit Z to 24-bit Z, preserve stencil */ + pDest[j] = (pDest[j] & 0xff000000) | ptrc[j] >> 8; + } + pDest += pt->stride/4; + ptrc += srcStride; + } + } + break; case PIPE_FORMAT_X8Z24_UNORM: { uint *pDest = (uint *) (map + y * pt->stride + x*4); @@ -1216,13 +1229,26 @@ pipe_put_tile_z(struct pipe_transfer *pt, } break; case PIPE_FORMAT_Z24S8_UNORM: + { + uint *pDest = (uint *) (map + y * pt->stride + x*4); + assert(pt->usage == PIPE_TRANSFER_READ_WRITE); + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + /* convert 32-bit Z to 24-bit Z, preserve stencil */ + pDest[j] = (pDest[j] & 0xff) | (ptrc[j] & 0xffffff00); + } + pDest += pt->stride/4; + ptrc += srcStride; + } + } + break; case PIPE_FORMAT_Z24X8_UNORM: { uint *pDest = (uint *) (map + y * pt->stride + x*4); for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { /* convert 32-bit Z to 24-bit Z (0 stencil) */ - pDest[j] = ptrc[j] << 8; + pDest[j] = ptrc[j] & 0xffffff00; } pDest += pt->stride/4; ptrc += srcStride; diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index 2eb98068c86..c90425f3e54 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -83,7 +83,9 @@ my_buffer_write(struct pipe_screen *screen, assert(dirty_size >= size); assert(size); - map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE); + map = pipe_buffer_map_range(screen, buf, offset, size, + PIPE_BUFFER_USAGE_CPU_WRITE | + PIPE_BUFFER_USAGE_FLUSH_EXPLICIT); if (map == NULL) return PIPE_ERROR_OUT_OF_MEMORY; diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c index 512d85d3525..bd48ce70050 100644 --- a/src/gallium/drivers/cell/ppu/cell_screen.c +++ b/src/gallium/drivers/cell/ppu/cell_screen.c @@ -86,6 +86,8 @@ cell_get_param(struct pipe_screen *screen, int param) return 1; /* XXX not really true */ case PIPE_CAP_TEXTURE_MIRROR_CLAMP: return 0; /* XXX to do */ + case PIPE_CAP_TGSI_CONT_SUPPORTED: + return 1; default: return 0; } diff --git a/src/gallium/drivers/i965simple/brw_draw.c b/src/gallium/drivers/i965simple/brw_draw.c index 648aaa0da52..49d80cb41c5 100644 --- a/src/gallium/drivers/i965simple/brw_draw.c +++ b/src/gallium/drivers/i965simple/brw_draw.c @@ -35,6 +35,7 @@ #include "pipe/p_context.h" #include "pipe/internal/p_winsys_screen.h" +#include "util/u_prim.h" static unsigned hw_prim[PIPE_PRIM_POLYGON+1] = { _3DPRIM_POINTLIST, @@ -50,20 +51,6 @@ static unsigned hw_prim[PIPE_PRIM_POLYGON+1] = { }; -static const int reduced_prim[PIPE_PRIM_POLYGON+1] = { - PIPE_PRIM_POINTS, - PIPE_PRIM_LINES, - PIPE_PRIM_LINES, - PIPE_PRIM_LINES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES -}; - - /* When the primitive changes, set a state bit and re-validate. Not * the nicest and would rather deal with this by having all the * programs be immune to the active primitive (ie. cope with all @@ -85,8 +72,8 @@ static void brw_set_prim(struct brw_context *brw, int prim) brw->primitive = prim; brw->state.dirty.brw |= BRW_NEW_PRIMITIVE; - if (reduced_prim[prim] != brw->reduced_primitive) { - brw->reduced_primitive = reduced_prim[prim]; + if (u_reduced_prim(prim) != brw->reduced_primitive) { + brw->reduced_primitive = u_reduced_prim(prim); brw->state.dirty.brw |= BRW_NEW_REDUCED_PRIMITIVE; } diff --git a/src/gallium/drivers/identity/Makefile b/src/gallium/drivers/identity/Makefile new file mode 100644 index 00000000000..e32b9102e59 --- /dev/null +++ b/src/gallium/drivers/identity/Makefile @@ -0,0 +1,12 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +LIBNAME = identity + +C_SOURCES = \ + id_objects.c \ + id_context.c \ + id_screen.c \ + id_drm.c + +include ../../Makefile.template diff --git a/src/gallium/drivers/identity/SConscript b/src/gallium/drivers/identity/SConscript new file mode 100644 index 00000000000..7f079dd0a8b --- /dev/null +++ b/src/gallium/drivers/identity/SConscript @@ -0,0 +1,13 @@ +Import('*') + +env = env.Clone() + +identity = env.ConvenienceLibrary( + target = 'identity', + source = [ + 'id_screen.c', + 'id_context.c', + 'id_objects.c', + ]) + +Export('identity') diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c new file mode 100644 index 00000000000..a500ec60454 --- /dev/null +++ b/src/gallium/drivers/identity/id_context.c @@ -0,0 +1,719 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 "pipe/p_context.h" +#include "util/u_memory.h" + +#include "id_public.h" +#include "id_context.h" +#include "id_objects.h" + + +static void +identity_destroy(struct pipe_context *_pipe) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->destroy(pipe); + + free(id_pipe); +} + +static void +identity_set_edgeflags(struct pipe_context *_pipe, + const unsigned *bitfield) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->set_edgeflags(pipe, + bitfield); +} + +static boolean +identity_draw_arrays(struct pipe_context *_pipe, + unsigned prim, + unsigned start, + unsigned count) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + return pipe->draw_arrays(pipe, + prim, + start, + count); +} + +static boolean +identity_draw_elements(struct pipe_context *_pipe, + struct pipe_buffer *_indexBuffer, + unsigned indexSize, + unsigned prim, + unsigned start, + unsigned count) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct identity_buffer *id_buffer = identity_buffer(_indexBuffer); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_buffer *indexBuffer = id_buffer->buffer; + + return pipe->draw_elements(pipe, + indexBuffer, + indexSize, + prim, + start, + count); +} + +static boolean +identity_draw_range_elements(struct pipe_context *_pipe, + struct pipe_buffer *_indexBuffer, + unsigned indexSize, + unsigned minIndex, + unsigned maxIndex, + unsigned mode, + unsigned start, + unsigned count) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct identity_buffer *id_buffer = identity_buffer(_indexBuffer); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_buffer *indexBuffer = id_buffer->buffer; + + return pipe->draw_range_elements(pipe, + indexBuffer, + indexSize, + minIndex, + maxIndex, + mode, + start, + count); +} + +static struct pipe_query * +identity_create_query(struct pipe_context *_pipe, + unsigned query_type) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + return pipe->create_query(pipe, + query_type); +} + +static void +identity_destroy_query(struct pipe_context *_pipe, + struct pipe_query *query) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->destroy_query(pipe, + query); +} + +static void +identity_begin_query(struct pipe_context *_pipe, + struct pipe_query *query) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->begin_query(pipe, + query); +} + +static void +identity_end_query(struct pipe_context *_pipe, + struct pipe_query *query) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->end_query(pipe, + query); +} + +static boolean +identity_get_query_result(struct pipe_context *_pipe, + struct pipe_query *query, + boolean wait, + uint64_t *result) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + return pipe->get_query_result(pipe, + query, + wait, + result); +} + +static void * +identity_create_blend_state(struct pipe_context *_pipe, + const struct pipe_blend_state *blend) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + return pipe->create_blend_state(pipe, + blend); +} + +static void +identity_bind_blend_state(struct pipe_context *_pipe, + void *blend) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->bind_blend_state(pipe, + blend); +} + +static void +identity_delete_blend_state(struct pipe_context *_pipe, + void *blend) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->delete_blend_state(pipe, + blend); +} + +static void * +identity_create_sampler_state(struct pipe_context *_pipe, + const struct pipe_sampler_state *sampler) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + return pipe->create_sampler_state(pipe, + sampler); +} + +static void +identity_bind_sampler_states(struct pipe_context *_pipe, + unsigned num, + void **samplers) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->bind_sampler_states(pipe, + num, + samplers); +} + +static void +identity_delete_sampler_state(struct pipe_context *_pipe, + void *sampler) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->delete_sampler_state(pipe, + sampler); +} + +static void * +identity_create_rasterizer_state(struct pipe_context *_pipe, + const struct pipe_rasterizer_state *rasterizer) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + return pipe->create_rasterizer_state(pipe, + rasterizer); +} + +static void +identity_bind_rasterizer_state(struct pipe_context *_pipe, + void *rasterizer) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->bind_rasterizer_state(pipe, + rasterizer); +} + +static void +identity_delete_rasterizer_state(struct pipe_context *_pipe, + void *rasterizer) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->delete_rasterizer_state(pipe, + rasterizer); +} + +static void * +identity_create_depth_stencil_alpha_state(struct pipe_context *_pipe, + const struct pipe_depth_stencil_alpha_state *depth_stencil_alpha) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + return pipe->create_depth_stencil_alpha_state(pipe, + depth_stencil_alpha); +} + +static void +identity_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, + void *depth_stencil_alpha) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->bind_depth_stencil_alpha_state(pipe, + depth_stencil_alpha); +} + +static void +identity_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, + void *depth_stencil_alpha) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->delete_depth_stencil_alpha_state(pipe, + depth_stencil_alpha); +} + +static void * +identity_create_fs_state(struct pipe_context *_pipe, + const struct pipe_shader_state *fs) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + return pipe->create_fs_state(pipe, + fs); +} + +static void +identity_bind_fs_state(struct pipe_context *_pipe, + void *fs) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->bind_fs_state(pipe, + fs); +} + +static void +identity_delete_fs_state(struct pipe_context *_pipe, + void *fs) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->delete_fs_state(pipe, + fs); +} + +static void * +identity_create_vs_state(struct pipe_context *_pipe, + const struct pipe_shader_state *vs) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + return pipe->create_vs_state(pipe, + vs); +} + +static void +identity_bind_vs_state(struct pipe_context *_pipe, + void *vs) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->bind_vs_state(pipe, + vs); +} + +static void +identity_delete_vs_state(struct pipe_context *_pipe, + void *vs) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->delete_vs_state(pipe, + vs); +} + +static void +identity_set_blend_color(struct pipe_context *_pipe, + const struct pipe_blend_color *blend_color) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->set_blend_color(pipe, + blend_color); +} + +static void +identity_set_clip_state(struct pipe_context *_pipe, + const struct pipe_clip_state *clip) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->set_clip_state(pipe, + clip); +} + +static void +identity_set_constant_buffer(struct pipe_context *_pipe, + uint shader, + uint index, + const struct pipe_constant_buffer *_buffer) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_constant_buffer unwrapped_buffer; + struct pipe_constant_buffer *buffer = NULL; + + /* unwrap the input state */ + if (_buffer) { + unwrapped_buffer.buffer = identity_buffer_unwrap(_buffer->buffer); + buffer = &unwrapped_buffer; + } + + pipe->set_constant_buffer(pipe, + shader, + index, + buffer); +} + +static void +identity_set_framebuffer_state(struct pipe_context *_pipe, + const struct pipe_framebuffer_state *_state) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_framebuffer_state unwrapped_state; + struct pipe_framebuffer_state *state = NULL; + unsigned i; + + /* unwrap the input state */ + if (_state) { + memcpy(&unwrapped_state, _state, sizeof(unwrapped_state)); + for(i = 0; i < _state->nr_cbufs; i++) + unwrapped_state.cbufs[i] = identity_surface_unwrap(_state->cbufs[i]); + for (; i < PIPE_MAX_COLOR_BUFS; i++) + unwrapped_state.cbufs[i] = NULL; + unwrapped_state.zsbuf = identity_surface_unwrap(_state->zsbuf); + state = &unwrapped_state; + } + + pipe->set_framebuffer_state(pipe, + state); +} + +static void +identity_set_polygon_stipple(struct pipe_context *_pipe, + const struct pipe_poly_stipple *poly_stipple) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->set_polygon_stipple(pipe, + poly_stipple); +} + +static void +identity_set_scissor_state(struct pipe_context *_pipe, + const struct pipe_scissor_state *scissor) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->set_scissor_state(pipe, + scissor); +} + +static void +identity_set_viewport_state(struct pipe_context *_pipe, + const struct pipe_viewport_state *viewport) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->set_viewport_state(pipe, + viewport); +} + +static void +identity_set_sampler_textures(struct pipe_context *_pipe, + unsigned num_textures, + struct pipe_texture **_textures) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_texture *unwrapped_textures[PIPE_MAX_SAMPLERS]; + struct pipe_texture **textures = NULL; + unsigned i; + + if (_textures) { + for (i = 0; i < num_textures; i++) + unwrapped_textures[i] = identity_texture_unwrap(_textures[i]); + for (; i < PIPE_MAX_SAMPLERS; i++) + unwrapped_textures[i] = NULL; + + textures = unwrapped_textures; + } + + pipe->set_sampler_textures(pipe, + num_textures, + _textures); +} + +static void +identity_set_vertex_buffers(struct pipe_context *_pipe, + unsigned num_buffers, + const struct pipe_vertex_buffer *_buffers) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_vertex_buffer unwrapped_buffers[PIPE_MAX_SHADER_INPUTS]; + struct pipe_vertex_buffer *buffers = NULL; + unsigned i; + + if (num_buffers) { + memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers)); + for (i = 0; i < num_buffers; i++) + unwrapped_buffers[i].buffer = identity_buffer_unwrap(_buffers[i].buffer); + buffers = unwrapped_buffers; + } + + pipe->set_vertex_buffers(pipe, + num_buffers, + buffers); +} + +static void +identity_set_vertex_elements(struct pipe_context *_pipe, + unsigned num_elements, + const struct pipe_vertex_element *vertex_elements) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->set_vertex_elements(pipe, + num_elements, + vertex_elements); +} + +static void +identity_surface_copy(struct pipe_context *_pipe, + struct pipe_surface *_dst, + unsigned dstx, + unsigned dsty, + struct pipe_surface *_src, + unsigned srcx, + unsigned srcy, + unsigned width, + unsigned height) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct identity_surface *id_surface_dst = identity_surface(_dst); + struct identity_surface *id_surface_src = identity_surface(_src); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_surface *dst = id_surface_dst->surface; + struct pipe_surface *src = id_surface_src->surface; + + pipe->surface_copy(pipe, + dst, + dstx, + dsty, + src, + srcx, + srcy, + width, + height); +} + +static void +identity_surface_fill(struct pipe_context *_pipe, + struct pipe_surface *_dst, + unsigned dstx, + unsigned dsty, + unsigned width, + unsigned height, + unsigned value) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct identity_surface *id_surface_dst = identity_surface(_dst); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_surface *dst = id_surface_dst->surface; + + pipe->surface_fill(pipe, + dst, + dstx, + dsty, + width, + height, + value); +} + +static void +identity_clear(struct pipe_context *_pipe, + unsigned buffers, + const float *rgba, + double depth, + unsigned stencil) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->clear(pipe, + buffers, + rgba, + depth, + stencil); +} + +static void +identity_flush(struct pipe_context *_pipe, + unsigned flags, + struct pipe_fence_handle **fence) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->flush(pipe, + flags, + fence); +} + +static unsigned int +identity_is_texture_referenced(struct pipe_context *_pipe, + struct pipe_texture *_texture, + unsigned face, + unsigned level) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct identity_texture *id_texture = identity_texture(_texture); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_texture *texture = id_texture->texture; + + return pipe->is_texture_referenced(pipe, + texture, + face, + level); +} + +static unsigned int +identity_is_buffer_referenced(struct pipe_context *_pipe, + struct pipe_buffer *_buffer) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct identity_buffer *id_buffer = identity_buffer(_buffer); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_buffer *buffer = id_buffer->buffer; + + return pipe->is_buffer_referenced(pipe, + buffer); +} + +struct pipe_context * +identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) +{ + struct identity_context *id_pipe; + (void)identity_screen(_screen); + + id_pipe = CALLOC_STRUCT(identity_context); + if (!id_pipe) { + return NULL; + } + + id_pipe->base.winsys = NULL; + id_pipe->base.screen = _screen; + id_pipe->base.priv = pipe->priv; + id_pipe->base.draw = NULL; + + id_pipe->base.destroy = identity_destroy; + id_pipe->base.set_edgeflags = identity_set_edgeflags; + id_pipe->base.draw_arrays = identity_draw_arrays; + id_pipe->base.draw_elements = identity_draw_elements; + id_pipe->base.draw_range_elements = identity_draw_range_elements; + id_pipe->base.create_query = identity_create_query; + id_pipe->base.destroy_query = identity_destroy_query; + id_pipe->base.begin_query = identity_begin_query; + id_pipe->base.end_query = identity_end_query; + id_pipe->base.get_query_result = identity_get_query_result; + id_pipe->base.create_blend_state = identity_create_blend_state; + id_pipe->base.bind_blend_state = identity_bind_blend_state; + id_pipe->base.delete_blend_state = identity_delete_blend_state; + id_pipe->base.create_sampler_state = identity_create_sampler_state; + id_pipe->base.bind_sampler_states = identity_bind_sampler_states; + id_pipe->base.delete_sampler_state = identity_delete_sampler_state; + id_pipe->base.create_rasterizer_state = identity_create_rasterizer_state; + id_pipe->base.bind_rasterizer_state = identity_bind_rasterizer_state; + id_pipe->base.delete_rasterizer_state = identity_delete_rasterizer_state; + id_pipe->base.create_depth_stencil_alpha_state = identity_create_depth_stencil_alpha_state; + id_pipe->base.bind_depth_stencil_alpha_state = identity_bind_depth_stencil_alpha_state; + id_pipe->base.delete_depth_stencil_alpha_state = identity_delete_depth_stencil_alpha_state; + id_pipe->base.create_fs_state = identity_create_fs_state; + id_pipe->base.bind_fs_state = identity_bind_fs_state; + id_pipe->base.delete_fs_state = identity_delete_fs_state; + id_pipe->base.create_vs_state = identity_create_vs_state; + id_pipe->base.bind_vs_state = identity_bind_vs_state; + id_pipe->base.delete_vs_state = identity_delete_vs_state; + id_pipe->base.set_blend_color = identity_set_blend_color; + id_pipe->base.set_clip_state = identity_set_clip_state; + id_pipe->base.set_constant_buffer = identity_set_constant_buffer; + id_pipe->base.set_framebuffer_state = identity_set_framebuffer_state; + id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple; + id_pipe->base.set_scissor_state = identity_set_scissor_state; + id_pipe->base.set_viewport_state = identity_set_viewport_state; + id_pipe->base.set_sampler_textures = identity_set_sampler_textures; + id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers; + id_pipe->base.set_vertex_elements = identity_set_vertex_elements; + id_pipe->base.surface_copy = identity_surface_copy; + id_pipe->base.surface_fill = identity_surface_fill; + id_pipe->base.clear = identity_clear; + id_pipe->base.flush = identity_flush; + id_pipe->base.is_texture_referenced = identity_is_texture_referenced; + id_pipe->base.is_buffer_referenced = identity_is_buffer_referenced; + + id_pipe->pipe = pipe; + + return &id_pipe->base; +} diff --git a/src/gallium/drivers/identity/id_context.h b/src/gallium/drivers/identity/id_context.h new file mode 100644 index 00000000000..75b73fc7df6 --- /dev/null +++ b/src/gallium/drivers/identity/id_context.h @@ -0,0 +1,48 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 ID_CONTEXT_H +#define ID_CONTEXT_H + +#include "pipe/p_state.h" +#include "pipe/p_context.h" + + +struct identity_context { + struct pipe_context base; /**< base class */ + + struct pipe_context *pipe; +}; + + +static INLINE struct identity_context * +identity_context(struct pipe_context *pipe) +{ + return (struct identity_context *)pipe; +} + +#endif /* ID_CONTEXT_H */ diff --git a/src/gallium/drivers/identity/id_drm.c b/src/gallium/drivers/identity/id_drm.c new file mode 100644 index 00000000000..555220f8531 --- /dev/null +++ b/src/gallium/drivers/identity/id_drm.c @@ -0,0 +1,187 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 "state_tracker/drm_api.h" + +#include "util/u_memory.h" +#include "identity/id_drm.h" +#include "identity/id_public.h" +#include "identity/id_screen.h" +#include "identity/id_objects.h" + +struct identity_drm_api +{ + struct drm_api base; + + struct drm_api *api; +}; + +static INLINE struct identity_drm_api * +identity_drm_api(struct drm_api *_api) +{ + return (struct identity_drm_api *)_api; +} + +static struct pipe_screen * +identity_drm_create_screen(struct drm_api *_api, int fd, + struct drm_create_screen_arg *arg) +{ + struct identity_drm_api *id_api = identity_drm_api(_api); + struct drm_api *api = id_api->api; + struct pipe_screen *screen; + + if (arg && arg->mode != DRM_CREATE_NORMAL) + return NULL; + + screen = api->create_screen(api, fd, arg); + + return identity_screen_create(screen); +}; + +static struct pipe_context * +identity_drm_create_context(struct drm_api *_api, + struct pipe_screen *_screen) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_drm_api *id_api = identity_drm_api(_api); + struct pipe_screen *screen = id_screen->screen; + struct drm_api *api = id_api->api; + struct pipe_context *pipe; + + pipe = api->create_context(api, screen); + + pipe = identity_context_create(_screen, pipe); + + return pipe; +}; + +static boolean +identity_drm_buffer_from_texture(struct drm_api *_api, + struct pipe_texture *_texture, + struct pipe_buffer **_buffer, + unsigned *stride) +{ + struct identity_texture *id_texture = identity_texture(_texture); + struct identity_drm_api *id_api = identity_drm_api(_api); + struct pipe_texture *texture = id_texture->texture; + struct drm_api *api = id_api->api; + struct pipe_buffer *buffer = NULL; + boolean result; + + result = api->buffer_from_texture(api, texture, &buffer, stride); + + if (result && _buffer) + buffer = identity_buffer_create(identity_screen(texture->screen), buffer); + + if (_buffer) + *_buffer = buffer; + else + pipe_buffer_reference(&buffer, NULL); + + return result; +} + +static struct pipe_buffer * +identity_drm_buffer_from_handle(struct drm_api *_api, + struct pipe_screen *_screen, + const char *name, + unsigned handle) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_drm_api *id_api = identity_drm_api(_api); + struct pipe_screen *screen = id_screen->screen; + struct drm_api *api = id_api->api; + struct pipe_buffer *result; + + result = api->buffer_from_handle(api, screen, name, handle); + + result = identity_buffer_create(identity_screen(_screen), result); + + return result; +} + +static boolean +identity_drm_handle_from_buffer(struct drm_api *_api, + struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned *handle) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_buffer *id_buffer = identity_buffer(_buffer); + struct identity_drm_api *id_api = identity_drm_api(_api); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *buffer = id_buffer->buffer; + struct drm_api *api = id_api->api; + + return api->handle_from_buffer(api, screen, buffer, handle); +} + +static boolean +identity_drm_global_handle_from_buffer(struct drm_api *_api, + struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned *handle) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_buffer *id_buffer = identity_buffer(_buffer); + struct identity_drm_api *id_api = identity_drm_api(_api); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *buffer = id_buffer->buffer; + struct drm_api *api = id_api->api; + + return api->global_handle_from_buffer(api, screen, buffer, handle); +} + +static void +identity_drm_destroy(struct drm_api *_api) +{ + struct identity_drm_api *id_api = identity_drm_api(_api); + struct drm_api *api = id_api->api; + api->destroy(api); + + free(id_api); +} + +struct drm_api * +identity_drm_create(struct drm_api *api) +{ + struct identity_drm_api *id_api = CALLOC_STRUCT(identity_drm_api); + + if (!id_api) + return NULL; + + id_api->base.create_screen = identity_drm_create_screen; + id_api->base.create_context = identity_drm_create_context; + id_api->base.buffer_from_texture = identity_drm_buffer_from_texture; + id_api->base.buffer_from_handle = identity_drm_buffer_from_handle; + id_api->base.handle_from_buffer = identity_drm_handle_from_buffer; + id_api->base.global_handle_from_buffer = identity_drm_global_handle_from_buffer; + id_api->base.destroy = identity_drm_destroy; + id_api->api = api; + + return &id_api->base; +} diff --git a/src/gallium/drivers/identity/id_drm.h b/src/gallium/drivers/identity/id_drm.h new file mode 100644 index 00000000000..cf2ad2ce07f --- /dev/null +++ b/src/gallium/drivers/identity/id_drm.h @@ -0,0 +1,35 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 ID_DRM_H +#define ID_DRM_H + +struct drm_api; + +struct drm_api* identity_drm_create(struct drm_api *api); + +#endif /* ID_DRM_H */ diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c new file mode 100644 index 00000000000..e893e599408 --- /dev/null +++ b/src/gallium/drivers/identity/id_objects.c @@ -0,0 +1,182 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 "util/u_memory.h" + +#include "id_public.h" +#include "id_screen.h" +#include "id_objects.h" + +struct pipe_buffer * +identity_buffer_create(struct identity_screen *id_screen, + struct pipe_buffer *buffer) +{ + struct identity_buffer *id_buffer; + + if(!buffer) + goto error; + + assert(buffer->screen == id_screen->screen); + + id_buffer = CALLOC_STRUCT(identity_buffer); + if(!id_buffer) + goto error; + + memcpy(&id_buffer->base, buffer, sizeof(struct pipe_buffer)); + + pipe_reference_init(&id_buffer->base.reference, 1); + id_buffer->base.screen = &id_screen->base; + id_buffer->buffer = buffer; + + return &id_buffer->base; + +error: + pipe_buffer_reference(&buffer, NULL); + return NULL; +} + +void +identity_buffer_destroy(struct identity_buffer *id_buffer) +{ + pipe_buffer_reference(&id_buffer->buffer, NULL); + FREE(id_buffer); +} + + +struct pipe_texture * +identity_texture_create(struct identity_screen *id_screen, + struct pipe_texture *texture) +{ + struct identity_texture *id_texture; + + if(!texture) + goto error; + + assert(texture->screen == id_screen->screen); + + id_texture = CALLOC_STRUCT(identity_texture); + if(!id_texture) + goto error; + + memcpy(&id_texture->base, texture, sizeof(struct pipe_texture)); + + pipe_reference_init(&id_texture->base.reference, 1); + id_texture->base.screen = &id_screen->base; + id_texture->texture = texture; + + return &id_texture->base; + +error: + pipe_texture_reference(&texture, NULL); + return NULL; +} + +void +identity_texture_destroy(struct identity_texture *id_texture) +{ + pipe_texture_reference(&id_texture->texture, NULL); + FREE(id_texture); +} + + +struct pipe_surface * +identity_surface_create(struct identity_texture *id_texture, + struct pipe_surface *surface) +{ + struct identity_surface *id_surface; + + if(!surface) + goto error; + + assert(surface->texture == id_texture->texture); + + id_surface = CALLOC_STRUCT(identity_surface); + if(!id_surface) + goto error; + + memcpy(&id_surface->base, surface, sizeof(struct pipe_surface)); + + pipe_reference_init(&id_surface->base.reference, 1); + id_surface->base.texture = NULL; + pipe_texture_reference(&id_surface->base.texture, &id_texture->base); + id_surface->surface = surface; + + return &id_surface->base; + +error: + pipe_surface_reference(&surface, NULL); + return NULL; +} + +void +identity_surface_destroy(struct identity_surface *id_surface) +{ + pipe_texture_reference(&id_surface->base.texture, NULL); + pipe_surface_reference(&id_surface->surface, NULL); + FREE(id_surface); +} + + +struct pipe_transfer * +identity_transfer_create(struct identity_texture *id_texture, + struct pipe_transfer *transfer) +{ + struct identity_transfer *id_transfer; + + if(!transfer) + goto error; + + assert(transfer->texture == id_texture->texture); + + id_transfer = CALLOC_STRUCT(identity_transfer); + if(!id_transfer) + goto error; + + memcpy(&id_transfer->base, transfer, sizeof(struct pipe_transfer)); + + id_transfer->base.texture = NULL; + pipe_texture_reference(&id_transfer->base.texture, &id_texture->base); + id_transfer->transfer = transfer; + assert(id_transfer->base.texture == &id_texture->base); + + return &id_transfer->base; + +error: + transfer->texture->screen->tex_transfer_destroy(transfer); + return NULL; +} + +void +identity_transfer_destroy(struct identity_transfer *id_transfer) +{ + struct identity_screen *id_screen = identity_screen(id_transfer->base.texture->screen); + struct pipe_screen *screen = id_screen->screen; + + pipe_texture_reference(&id_transfer->base.texture, NULL); + screen->tex_transfer_destroy(id_transfer->transfer); + FREE(id_transfer); +} diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h new file mode 100644 index 00000000000..ce58faa3c7c --- /dev/null +++ b/src/gallium/drivers/identity/id_objects.h @@ -0,0 +1,169 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 ID_OBJECTS_H +#define ID_OBJECTS_H + + +#include "pipe/p_compiler.h" +#include "pipe/p_state.h" + +#include "id_screen.h" + + +struct identity_buffer +{ + struct pipe_buffer base; + + struct pipe_buffer *buffer; +}; + + +struct identity_texture +{ + struct pipe_texture base; + + struct pipe_texture *texture; +}; + + +struct identity_surface +{ + struct pipe_surface base; + + struct pipe_surface *surface; +}; + + +struct identity_transfer +{ + struct pipe_transfer base; + + struct pipe_transfer *transfer; +}; + + +static INLINE struct identity_buffer * +identity_buffer(struct pipe_buffer *_buffer) +{ + if(!_buffer) + return NULL; + (void)identity_screen(_buffer->screen); + return (struct identity_buffer *)_buffer; +} + +static INLINE struct identity_texture * +identity_texture(struct pipe_texture *_texture) +{ + if(!_texture) + return NULL; + (void)identity_screen(_texture->screen); + return (struct identity_texture *)_texture; +} + +static INLINE struct identity_surface * +identity_surface(struct pipe_surface *_surface) +{ + if(!_surface) + return NULL; + (void)identity_texture(_surface->texture); + return (struct identity_surface *)_surface; +} + +static INLINE struct identity_transfer * +identity_transfer(struct pipe_transfer *_transfer) +{ + if(!_transfer) + return NULL; + (void)identity_texture(_transfer->texture); + return (struct identity_transfer *)_transfer; +} + + +static INLINE struct pipe_buffer * +identity_buffer_unwrap(struct pipe_buffer *_buffer) +{ + if(!_buffer) + return NULL; + return identity_buffer(_buffer)->buffer; +} + +static INLINE struct pipe_texture * +identity_texture_unwrap(struct pipe_texture *_texture) +{ + if(!_texture) + return NULL; + return identity_texture(_texture)->texture; +} + +static INLINE struct pipe_surface * +identity_surface_unwrap(struct pipe_surface *_surface) +{ + if(!_surface) + return NULL; + return identity_surface(_surface)->surface; +} + +static INLINE struct pipe_transfer * +identity_transfer_unwrap(struct pipe_transfer *_transfer) +{ + if(!_transfer) + return NULL; + return identity_transfer(_transfer)->transfer; +} + + +struct pipe_buffer * +identity_buffer_create(struct identity_screen *id_screen, + struct pipe_buffer *buffer); + +void +identity_buffer_destroy(struct identity_buffer *id_buffer); + +struct pipe_texture * +identity_texture_create(struct identity_screen *id_screen, + struct pipe_texture *texture); + +void +identity_texture_destroy(struct identity_texture *id_texture); + +struct pipe_surface * +identity_surface_create(struct identity_texture *id_texture, + struct pipe_surface *surface); + +void +identity_surface_destroy(struct identity_surface *id_surface); + +struct pipe_transfer * +identity_transfer_create(struct identity_texture *id_texture, + struct pipe_transfer *transfer); + +void +identity_transfer_destroy(struct identity_transfer *id_transfer); + + +#endif /* ID_OBJECTS_H */ diff --git a/src/gallium/drivers/identity/id_public.h b/src/gallium/drivers/identity/id_public.h new file mode 100644 index 00000000000..cac14cfd604 --- /dev/null +++ b/src/gallium/drivers/identity/id_public.h @@ -0,0 +1,40 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 ID_PUBLIC_H +#define ID_PUBLIC_H + +struct pipe_screen; +struct pipe_context; + +struct pipe_screen * +identity_screen_create(struct pipe_screen *screen); + +struct pipe_context * +identity_context_create(struct pipe_screen *screen, struct pipe_context *pipe); + +#endif /* PT_PUBLIC_H */ diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c new file mode 100644 index 00000000000..259f1be36e7 --- /dev/null +++ b/src/gallium/drivers/identity/id_screen.c @@ -0,0 +1,481 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 "pipe/p_screen.h" +#include "pipe/p_state.h" +#include "util/u_memory.h" + +#include "id_public.h" +#include "id_screen.h" +#include "id_objects.h" + + +static void +identity_screen_destroy(struct pipe_screen *_screen) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + + screen->destroy(screen); + + FREE(id_screen); +} + +static const char * +identity_screen_get_name(struct pipe_screen *_screen) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + + return screen->get_name(screen); +} + +static const char * +identity_screen_get_vendor(struct pipe_screen *_screen) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + + return screen->get_vendor(screen); +} + +static int +identity_screen_get_param(struct pipe_screen *_screen, + int param) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + + return screen->get_param(screen, + param); +} + +static float +identity_screen_get_paramf(struct pipe_screen *_screen, + int param) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + + return screen->get_paramf(screen, + param); +} + +static boolean +identity_screen_is_format_supported(struct pipe_screen *_screen, + enum pipe_format format, + enum pipe_texture_target target, + unsigned tex_usage, + unsigned geom_flags) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + + return screen->is_format_supported(screen, + format, + target, + tex_usage, + geom_flags); +} + +static struct pipe_texture * +identity_screen_texture_create(struct pipe_screen *_screen, + const struct pipe_texture *templat) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + struct pipe_texture *result; + + result = screen->texture_create(screen, + templat); + + if (result) + return identity_texture_create(id_screen, result); + return NULL; +} + +static struct pipe_texture * +identity_screen_texture_blanket(struct pipe_screen *_screen, + const struct pipe_texture *templat, + const unsigned *stride, + struct pipe_buffer *_buffer) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_buffer *id_buffer = identity_buffer(_buffer); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *buffer = id_buffer->buffer; + struct pipe_texture *result; + + result = screen->texture_blanket(screen, + templat, + stride, + buffer); + + if (result) + return identity_texture_create(id_screen, result); + return NULL; +} + +static void +identity_screen_texture_destroy(struct pipe_texture *_texture) +{ + identity_texture_destroy(identity_texture(_texture)); +} + +static struct pipe_surface * +identity_screen_get_tex_surface(struct pipe_screen *_screen, + struct pipe_texture *_texture, + unsigned face, + unsigned level, + unsigned zslice, + unsigned usage) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_texture *id_texture = identity_texture(_texture); + struct pipe_screen *screen = id_screen->screen; + struct pipe_texture *texture = id_texture->texture; + struct pipe_surface *result; + + result = screen->get_tex_surface(screen, + texture, + face, + level, + zslice, + usage); + + if (result) + return identity_surface_create(id_texture, result); + return NULL; +} + +static void +identity_screen_tex_surface_destroy(struct pipe_surface *_surface) +{ + identity_surface_destroy(identity_surface(_surface)); +} + +static struct pipe_transfer * +identity_screen_get_tex_transfer(struct pipe_screen *_screen, + struct pipe_texture *_texture, + unsigned face, + unsigned level, + unsigned zslice, + enum pipe_transfer_usage usage, + unsigned x, + unsigned y, + unsigned w, + unsigned h) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_texture *id_texture = identity_texture(_texture); + struct pipe_screen *screen = id_screen->screen; + struct pipe_texture *texture = id_texture->texture; + struct pipe_transfer *result; + + result = screen->get_tex_transfer(screen, + texture, + face, + level, + zslice, + usage, + x, + y, + w, + h); + + if (result) + return identity_transfer_create(id_texture, result); + return NULL; +} + +static void +identity_screen_tex_transfer_destroy(struct pipe_transfer *_transfer) +{ + identity_transfer_destroy(identity_transfer(_transfer)); +} + +static void * +identity_screen_transfer_map(struct pipe_screen *_screen, + struct pipe_transfer *_transfer) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_transfer *id_transfer = identity_transfer(_transfer); + struct pipe_screen *screen = id_screen->screen; + struct pipe_transfer *transfer = id_transfer->transfer; + + return screen->transfer_map(screen, + transfer); +} + +static void +identity_screen_transfer_unmap(struct pipe_screen *_screen, + struct pipe_transfer *_transfer) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_transfer *id_transfer = identity_transfer(_transfer); + struct pipe_screen *screen = id_screen->screen; + struct pipe_transfer *transfer = id_transfer->transfer; + + screen->transfer_unmap(screen, + transfer); +} + +static struct pipe_buffer * +identity_screen_buffer_create(struct pipe_screen *_screen, + unsigned alignment, + unsigned usage, + unsigned size) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *result; + + result = screen->buffer_create(screen, + alignment, + usage, + size); + + if (result) + return identity_buffer_create(id_screen, result); + return NULL; +} + +static struct pipe_buffer * +identity_screen_user_buffer_create(struct pipe_screen *_screen, + void *ptr, + unsigned bytes) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *result; + + result = screen->user_buffer_create(screen, + ptr, + bytes); + + if (result) + return identity_buffer_create(id_screen, result); + return NULL; +} + +static struct pipe_buffer * +identity_screen_surface_buffer_create(struct pipe_screen *_screen, + unsigned width, + unsigned height, + enum pipe_format format, + unsigned usage, + unsigned *stride) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *result; + + result = screen->surface_buffer_create(screen, + width, + height, + format, + usage, + stride); + + if (result) + return identity_buffer_create(id_screen, result); + return NULL; +} + +static void * +identity_screen_buffer_map(struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned usage) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_buffer *id_buffer = identity_buffer(_buffer); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *buffer = id_buffer->buffer; + + return screen->buffer_map(screen, + buffer, + usage); +} + +static void * +identity_screen_buffer_map_range(struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned offset, + unsigned length, + unsigned usage) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_buffer *id_buffer = identity_buffer(_buffer); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *buffer = id_buffer->buffer; + + return screen->buffer_map_range(screen, + buffer, + offset, + length, + usage); +} + +static void +identity_screen_buffer_flush_mapped_range(struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned offset, + unsigned length) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_buffer *id_buffer = identity_buffer(_buffer); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *buffer = id_buffer->buffer; + + screen->buffer_flush_mapped_range(screen, + buffer, + offset, + length); +} + +static void +identity_screen_buffer_unmap(struct pipe_screen *_screen, + struct pipe_buffer *_buffer) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_buffer *id_buffer = identity_buffer(_buffer); + struct pipe_screen *screen = id_screen->screen; + struct pipe_buffer *buffer = id_buffer->buffer; + + screen->buffer_unmap(screen, + buffer); +} + +static void +identity_screen_buffer_destroy(struct pipe_buffer *_buffer) +{ + identity_buffer_destroy(identity_buffer(_buffer)); +} + +static void +identity_screen_flush_frontbuffer(struct pipe_screen *_screen, + struct pipe_surface *_surface, + void *context_private) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct identity_surface *id_surface = identity_surface(_surface); + struct pipe_screen *screen = id_screen->screen; + struct pipe_surface *surface = id_surface->surface; + + screen->flush_frontbuffer(screen, + surface, + context_private); +} + +static void +identity_screen_fence_reference(struct pipe_screen *_screen, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *fence) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + + screen->fence_reference(screen, + ptr, + fence); +} + +static int +identity_screen_fence_signalled(struct pipe_screen *_screen, + struct pipe_fence_handle *fence, + unsigned flags) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + + return screen->fence_signalled(screen, + fence, + flags); +} + +static int +identity_screen_fence_finish(struct pipe_screen *_screen, + struct pipe_fence_handle *fence, + unsigned flags) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + + return screen->fence_finish(screen, + fence, + flags); +} + +struct pipe_screen * +identity_screen_create(struct pipe_screen *screen) +{ + struct identity_screen *id_screen; + + id_screen = CALLOC_STRUCT(identity_screen); + if (!id_screen) { + return NULL; + } + + id_screen->base.winsys = NULL; + + id_screen->base.destroy = identity_screen_destroy; + id_screen->base.get_name = identity_screen_get_name; + id_screen->base.get_vendor = identity_screen_get_vendor; + id_screen->base.get_param = identity_screen_get_param; + id_screen->base.get_paramf = identity_screen_get_paramf; + id_screen->base.is_format_supported = identity_screen_is_format_supported; + id_screen->base.texture_create = identity_screen_texture_create; + id_screen->base.texture_blanket = identity_screen_texture_blanket; + id_screen->base.texture_destroy = identity_screen_texture_destroy; + id_screen->base.get_tex_surface = identity_screen_get_tex_surface; + id_screen->base.tex_surface_destroy = identity_screen_tex_surface_destroy; + id_screen->base.get_tex_transfer = identity_screen_get_tex_transfer; + id_screen->base.tex_transfer_destroy = identity_screen_tex_transfer_destroy; + id_screen->base.transfer_map = identity_screen_transfer_map; + id_screen->base.transfer_unmap = identity_screen_transfer_unmap; + id_screen->base.buffer_create = identity_screen_buffer_create; + id_screen->base.user_buffer_create = identity_screen_user_buffer_create; + id_screen->base.surface_buffer_create = identity_screen_surface_buffer_create; + if (screen->buffer_map) + id_screen->base.buffer_map = identity_screen_buffer_map; + if (screen->buffer_map_range) + id_screen->base.buffer_map_range = identity_screen_buffer_map_range; + if (screen->buffer_flush_mapped_range) + id_screen->base.buffer_flush_mapped_range = identity_screen_buffer_flush_mapped_range; + if (screen->buffer_unmap) + id_screen->base.buffer_unmap = identity_screen_buffer_unmap; + id_screen->base.buffer_destroy = identity_screen_buffer_destroy; + id_screen->base.flush_frontbuffer = identity_screen_flush_frontbuffer; + id_screen->base.fence_reference = identity_screen_fence_reference; + id_screen->base.fence_signalled = identity_screen_fence_signalled; + id_screen->base.fence_finish = identity_screen_fence_finish; + + id_screen->screen = screen; + + return &id_screen->base; +} diff --git a/src/gallium/drivers/identity/id_screen.h b/src/gallium/drivers/identity/id_screen.h new file mode 100644 index 00000000000..2c4f1290894 --- /dev/null +++ b/src/gallium/drivers/identity/id_screen.h @@ -0,0 +1,48 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 ID_SCREEN_H +#define ID_SCREEN_H + +#include "pipe/p_screen.h" +#include "pipe/p_defines.h" + + +struct identity_screen { + struct pipe_screen base; + + struct pipe_screen *screen; +}; + + +static INLINE struct identity_screen * +identity_screen(struct pipe_screen *screen) +{ + return (struct identity_screen *)screen; +} + +#endif /* ID_SCREEN_H */ diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c index 4bbedfb4d69..ff2febb668e 100644 --- a/src/gallium/drivers/nv04/nv04_screen.c +++ b/src/gallium/drivers/nv04/nv04_screen.c @@ -40,6 +40,10 @@ nv04_screen_get_param(struct pipe_screen *screen, int param) return 0; case PIPE_CAP_TEXTURE_MIRROR_REPEAT: return 1; + case PIPE_CAP_TGSI_CONT_SUPPORTED: + return 0; + case PIPE_CAP_BLEND_EQUATION_SEPARATE: + return 0; case NOUVEAU_CAP_HW_VTXBUF: case NOUVEAU_CAP_HW_IDXBUF: return 0; @@ -79,6 +83,13 @@ nv04_screen_is_format_supported(struct pipe_screen *screen, switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: + return TRUE; + default: + break; + } + } else + if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) { + switch (format) { case PIPE_FORMAT_Z16_UNORM: return TRUE; default: diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index 5afd028ddd2..f315cf54f05 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -267,8 +267,7 @@ nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst, * to NV_MEMORY_TO_MEMORY_FORMAT in this case. */ if ((src->offset & 63) || (dst->offset & 63) || - (src_pitch & 63) || (dst_pitch & 63) || - debug_get_bool_option("NOUVEAU_NO_COPYBLIT", FALSE)) { + (src_pitch & 63) || (dst_pitch & 63)) { nv04_surface_copy_m2mf(ctx, dst, dx, dy, src, sx, sy, w, h); return; } diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c index b03c291f9d9..4469b22d91a 100644 --- a/src/gallium/drivers/nv10/nv10_screen.c +++ b/src/gallium/drivers/nv10/nv10_screen.c @@ -35,6 +35,10 @@ nv10_screen_get_param(struct pipe_screen *screen, int param) return 12; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: return 0; + case PIPE_CAP_TGSI_CONT_SUPPORTED: + return 0; + case PIPE_CAP_BLEND_EQUATION_SEPARATE: + return 0; case NOUVEAU_CAP_HW_VTXBUF: case NOUVEAU_CAP_HW_IDXBUF: return 0; @@ -74,7 +78,15 @@ nv10_screen_is_format_supported(struct pipe_screen *screen, switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: + return TRUE; + default: + break; + } + } else + if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) { + switch (format) { case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z16_UNORM: return TRUE; default: diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c index 024356ca74c..e6924ad71eb 100644 --- a/src/gallium/drivers/nv20/nv20_screen.c +++ b/src/gallium/drivers/nv20/nv20_screen.c @@ -35,6 +35,10 @@ nv20_screen_get_param(struct pipe_screen *screen, int param) return 12; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: return 0; + case PIPE_CAP_TGSI_CONT_SUPPORTED: + return 0; + case PIPE_CAP_BLEND_EQUATION_SEPARATE: + return 0; case NOUVEAU_CAP_HW_VTXBUF: case NOUVEAU_CAP_HW_IDXBUF: return 0; @@ -74,7 +78,15 @@ nv20_screen_is_format_supported(struct pipe_screen *screen, switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: + return TRUE; + default: + break; + } + } else + if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) { + switch (format) { case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z16_UNORM: return TRUE; default: diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 31bc1f31734..c8b40784b05 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -46,6 +46,10 @@ nv30_screen_get_param(struct pipe_screen *pscreen, int param) return 1; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: return 0; + case PIPE_CAP_TGSI_CONT_SUPPORTED: + return 0; + case PIPE_CAP_BLEND_EQUATION_SEPARATE: + return 0; case NOUVEAU_CAP_HW_VTXBUF: case NOUVEAU_CAP_HW_IDXBUF: return 1; @@ -85,7 +89,15 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen, switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: + return TRUE; + default: + break; + } + } else + if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) { + switch (tex_usage) { case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z16_UNORM: return TRUE; default: diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index cb1a260eaad..44b6a74715a 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -65,6 +65,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16; break; case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: case 0: rt_format |= NV34TCL_RT_FORMAT_ZETA_Z24S8; break; diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c index b8b2af482a9..5d2a4216c5a 100644 --- a/src/gallium/drivers/nv40/nv40_screen.c +++ b/src/gallium/drivers/nv40/nv40_screen.c @@ -44,6 +44,10 @@ nv40_screen_get_param(struct pipe_screen *pscreen, int param) return 1; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: return 0; /* We have 4 - but unsupported currently */ + case PIPE_CAP_TGSI_CONT_SUPPORTED: + return 0; + case PIPE_CAP_BLEND_EQUATION_SEPARATE: + return 1; case NOUVEAU_CAP_HW_VTXBUF: return 1; case NOUVEAU_CAP_HW_IDXBUF: @@ -86,7 +90,15 @@ nv40_screen_surface_format_supported(struct pipe_screen *pscreen, switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: + return TRUE; + default: + break; + } + } else + if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) { + switch (format) { case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z16_UNORM: return TRUE; default: diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c index 273142f9e0f..c2f739157ad 100644 --- a/src/gallium/drivers/nv40/nv40_state_fb.c +++ b/src/gallium/drivers/nv40/nv40_state_fb.c @@ -73,6 +73,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40) rt_format |= NV40TCL_RT_FORMAT_ZETA_Z16; break; case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: case 0: rt_format |= NV40TCL_RT_FORMAT_ZETA_Z24S8; break; diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index ce45055fe82..6d92ac3db9c 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -136,7 +136,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, } static void -nv40_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +nv40_transfer_del(struct pipe_transfer *ptx) { struct nv40_transfer *tx = (struct nv40_transfer *)ptx; diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index 6b605ba416c..22465e02274 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -42,6 +42,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) mt->base.screen = pscreen; switch (pt->format) { + case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z24S8_UNORM: case PIPE_FORMAT_Z16_UNORM: tile_flags = 0x2800; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index fd39fa738b7..ce8f906b15f 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -37,7 +37,15 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: + return TRUE; + default: + break; + } + } else + if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) { + switch (format) { case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z16_UNORM: return TRUE; default: @@ -101,6 +109,10 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param) return 1; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: return 0; + case PIPE_CAP_TGSI_CONT_SUPPORTED: + return 0; + case PIPE_CAP_BLEND_EQUATION_SEPARATE: + return 1; case NOUVEAU_CAP_HW_VTXBUF: return 1; case NOUVEAU_CAP_HW_IDXBUF: diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 0caf4b4e914..d313e9de4fe 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -93,6 +93,7 @@ nv50_state_validate_fb(struct nv50_context *nv50) NOUVEAU_BO_LOW | NOUVEAU_BO_RDWR, 0, 0); switch (fb->zsbuf->format) { case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: so_data(so, 0x16); break; case PIPE_FORMAT_Z16_UNORM: diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 8db3b6d344d..3da9d6e7285 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -35,7 +35,6 @@ nv50_format(enum pipe_format format) { switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_Z24S8_UNORM: return NV50_2D_DST_FORMAT_32BPP; case PIPE_FORMAT_X8R8G8B8_UNORM: return NV50_2D_DST_FORMAT_24BPP; diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index e44f9b9dfc5..faceec9842f 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -4,20 +4,22 @@ include $(TOP)/configs/current LIBNAME = r300 C_SOURCES = \ + r3xx_fs.c \ + r5xx_fs.c \ r300_chipset.c \ r300_clear.c \ r300_context.c \ r300_debug.c \ r300_emit.c \ r300_flush.c \ + r300_fs.c \ r300_query.c \ r300_render.c \ r300_screen.c \ r300_state.c \ r300_state_derived.c \ r300_state_invariant.c \ - r300_state_shader.c \ - r300_state_tcl.c \ + r300_vs.c \ r300_surface.c \ r300_texture.c diff --git a/src/gallium/drivers/r300/SConscript b/src/gallium/drivers/r300/SConscript index 182ed2d459a..493d7b28bc3 100644 --- a/src/gallium/drivers/r300/SConscript +++ b/src/gallium/drivers/r300/SConscript @@ -5,20 +5,22 @@ env = env.Clone() r300 = env.ConvenienceLibrary( target = 'r300', source = [ + 'r3xx_fs.c', + 'r5xx_fs.c', 'r300_chipset.c', 'r300_clear.c', 'r300_context.c', 'r300_debug.c', 'r300_emit.c', 'r300_flush.c', + 'r300_fs.c', 'r300_query.c', 'r300_render.c', 'r300_screen.c', 'r300_state.c', 'r300_state_derived.c', 'r300_state_invariant.c', - 'r300_state_shader.c', - 'r300_state_tcl.c', + 'r300_vs.c', 'r300_surface.c', 'r300_texture.c', ]) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 27bc7fd1a93..d891fd6265f 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -149,7 +149,7 @@ struct r300_constant_buffer { unsigned count; }; -struct r3xx_fragment_shader { +struct r300_fragment_shader { /* Parent class */ struct pipe_shader_state state; struct tgsi_shader_info info; @@ -165,9 +165,9 @@ struct r3xx_fragment_shader { boolean uses_imms; }; -struct r300_fragment_shader { +struct r3xx_fragment_shader { /* Parent class */ - struct r3xx_fragment_shader shader; + struct r300_fragment_shader shader; /* Number of ALU instructions */ int alu_instruction_count; @@ -190,9 +190,9 @@ struct r300_fragment_shader { } instructions[64]; /* XXX magic num */ }; -struct r500_fragment_shader { +struct r5xx_fragment_shader { /* Parent class */ - struct r3xx_fragment_shader shader; + struct r300_fragment_shader shader; /* Number of used instructions */ int instruction_count; @@ -217,7 +217,7 @@ struct r300_texture { /* Stride (pitch?) of this texture in bytes */ unsigned stride; - + /* Total size of this texture, in bytes. */ unsigned size; @@ -300,7 +300,7 @@ struct r300_context { /* Depth, stencil, and alpha state. */ struct r300_dsa_state* dsa_state; /* Fragment shader. */ - struct r3xx_fragment_shader* fs; + struct r300_fragment_shader* fs; /* Framebuffer state. We currently don't need our own version of this. */ struct pipe_framebuffer_state framebuffer_state; /* Rasterizer state. */ @@ -331,7 +331,8 @@ struct r300_context { }; /* Convenience cast wrapper. */ -static struct r300_context* r300_context(struct pipe_context* context) { +static INLINE struct r300_context* r300_context(struct pipe_context* context) +{ return (struct r300_context*)context; } diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 678cd2b8121..c83e8526cf7 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -22,7 +22,7 @@ #include "r300_debug.h" -static void r300_dump_fs(struct r300_fragment_shader* fs) +void r3xx_dump_fs(struct r3xx_fragment_shader* fs) { int i; @@ -30,7 +30,7 @@ static void r300_dump_fs(struct r300_fragment_shader* fs) } } -void r500_fs_dump(struct r500_fragment_shader* fs) +void r5xx_fs_dump(struct r5xx_fragment_shader* fs) { int i; uint32_t inst; @@ -58,8 +58,8 @@ void r500_fs_dump(struct r500_fragment_shader* fs) inst & R500_INST_NOP ? "NOP" : "", inst & R500_INST_ALU_WAIT ? "ALU_WAIT" : ""); debug_printf("wmask: %s omask: %s\n", - r500_fs_mask[(inst >> 11) & 0xf], - r500_fs_mask[(inst >> 15) & 0xf]); + r5xx_fs_mask[(inst >> 11) & 0xf], + r5xx_fs_mask[(inst >> 15) & 0xf]); switch (inst & 0x3) { case R500_INST_TYPE_ALU: case R500_INST_TYPE_OUT: @@ -85,36 +85,36 @@ void r500_fs_dump(struct r500_fragment_shader* fs) debug_printf(" 3: RGB_INST 0x%08x:", inst); debug_printf("rgb_A_src:%d %s/%s/%s %d " "rgb_B_src:%d %s/%s/%s %d\n", - inst & 0x3, r500_fs_swiz[(inst >> 2) & 0x7], - r500_fs_swiz[(inst >> 5) & 0x7], - r500_fs_swiz[(inst >> 8) & 0x7], + inst & 0x3, r5xx_fs_swiz[(inst >> 2) & 0x7], + r5xx_fs_swiz[(inst >> 5) & 0x7], + r5xx_fs_swiz[(inst >> 8) & 0x7], (inst >> 11) & 0x3, (inst >> 13) & 0x3, - r500_fs_swiz[(inst >> 15) & 0x7], - r500_fs_swiz[(inst >> 18) & 0x7], - r500_fs_swiz[(inst >> 21) & 0x7], + r5xx_fs_swiz[(inst >> 15) & 0x7], + r5xx_fs_swiz[(inst >> 18) & 0x7], + r5xx_fs_swiz[(inst >> 21) & 0x7], (inst >> 24) & 0x3); inst = fs->instructions[i].inst4; debug_printf(" 4: ALPHA_INST 0x%08x:", inst); debug_printf("%s dest:%d%s alp_A_src:%d %s %d " "alp_B_src:%d %s %d w:%d\n", - r500_fs_op_alpha[inst & 0xf], (inst >> 4) & 0x7f, + r5xx_fs_op_alpha[inst & 0xf], (inst >> 4) & 0x7f, inst & (1<<11) ? "(rel)":"", (inst >> 12) & 0x3, - r500_fs_swiz[(inst >> 14) & 0x7], (inst >> 17) & 0x3, - (inst >> 19) & 0x3, r500_fs_swiz[(inst >> 21) & 0x7], + r5xx_fs_swiz[(inst >> 14) & 0x7], (inst >> 17) & 0x3, + (inst >> 19) & 0x3, r5xx_fs_swiz[(inst >> 21) & 0x7], (inst >> 24) & 0x3, (inst >> 31) & 0x1); inst = fs->instructions[i].inst5; debug_printf(" 5: RGBA_INST 0x%08x:", inst); debug_printf("%s dest:%d%s rgb_C_src:%d %s/%s/%s %d " "alp_C_src:%d %s %d\n", - r500_fs_op_rgb[inst & 0xf], (inst >> 4) & 0x7f, + r5xx_fs_op_rgb[inst & 0xf], (inst >> 4) & 0x7f, inst & (1 << 11) ? "(rel)":"", (inst >> 12) & 0x3, - r500_fs_swiz[(inst >> 14) & 0x7], - r500_fs_swiz[(inst >> 17) & 0x7], - r500_fs_swiz[(inst >> 20) & 0x7], + r5xx_fs_swiz[(inst >> 14) & 0x7], + r5xx_fs_swiz[(inst >> 17) & 0x7], + r5xx_fs_swiz[(inst >> 20) & 0x7], (inst >> 23) & 0x3, (inst >> 25) & 0x3, - r500_fs_swiz[(inst >> 27) & 0x7], (inst >> 30) & 0x3); + r5xx_fs_swiz[(inst >> 27) & 0x7], (inst >> 30) & 0x3); break; case R500_INST_TYPE_FC: /* XXX don't even bother yet */ @@ -124,7 +124,7 @@ void r500_fs_dump(struct r500_fragment_shader* fs) debug_printf(" 1: TEX_INST 0x%08x: id: %d " "op:%s, %s, %s %s\n", inst, (inst >> 16) & 0xf, - r500_fs_tex[(inst >> 22) & 0x7], + r5xx_fs_tex[(inst >> 22) & 0x7], (inst & (1 << 25)) ? "ACQ" : "", (inst & (1 << 26)) ? "IGNUNC" : "", (inst & (1 << 27)) ? "UNSCALED" : "SCALED"); @@ -133,15 +133,15 @@ void r500_fs_dump(struct r500_fragment_shader* fs) debug_printf(" 2: TEX_ADDR 0x%08x: " "src: %d%s %s/%s/%s/%s dst: %d%s %s/%s/%s/%s\n", inst, inst & 0x7f, inst & (1 << 7) ? "(rel)" : "", - r500_fs_swiz[(inst >> 8) & 0x3], - r500_fs_swiz[(inst >> 10) & 0x3], - r500_fs_swiz[(inst >> 12) & 0x3], - r500_fs_swiz[(inst >> 14) & 0x3], + r5xx_fs_swiz[(inst >> 8) & 0x3], + r5xx_fs_swiz[(inst >> 10) & 0x3], + r5xx_fs_swiz[(inst >> 12) & 0x3], + r5xx_fs_swiz[(inst >> 14) & 0x3], (inst >> 16) & 0x7f, inst & (1 << 23) ? "(rel)" : "", - r500_fs_swiz[(inst >> 24) & 0x3], - r500_fs_swiz[(inst >> 26) & 0x3], - r500_fs_swiz[(inst >> 28) & 0x3], - r500_fs_swiz[(inst >> 30) & 0x3]); + r5xx_fs_swiz[(inst >> 24) & 0x3], + r5xx_fs_swiz[(inst >> 26) & 0x3], + r5xx_fs_swiz[(inst >> 28) & 0x3], + r5xx_fs_swiz[(inst >> 30) & 0x3]); inst = fs->instructions[i].inst3; debug_printf(" 3: TEX_DXDY 0x%08x\n", inst); diff --git a/src/gallium/drivers/r300/r300_debug.h b/src/gallium/drivers/r300/r300_debug.h index c86410ec0a9..6b58c1e2501 100644 --- a/src/gallium/drivers/r300/r300_debug.h +++ b/src/gallium/drivers/r300/r300_debug.h @@ -24,10 +24,10 @@ #define R300_DEBUG_H #include "r300_reg.h" -#include "r300_state_shader.h" -#include "r300_state_tcl.h" +#include "r300_fs.h" +#include "r300_vs.h" -static char* r500_fs_swiz[] = { +static char* r5xx_fs_swiz[] = { " R", " G", " B", @@ -38,7 +38,7 @@ static char* r500_fs_swiz[] = { " U", }; -static char* r500_fs_op_rgb[] = { +static char* r5xx_fs_op_rgb[] = { "MAD", "DP3", "DP4", @@ -54,7 +54,7 @@ static char* r500_fs_op_rgb[] = { "MDV", }; -static char* r500_fs_op_alpha[] = { +static char* r5xx_fs_op_alpha[] = { "MAD", " DP", "MIN", @@ -73,7 +73,7 @@ static char* r500_fs_op_alpha[] = { "MDV", }; -static char* r500_fs_mask[] = { +static char* r5xx_fs_mask[] = { "NONE", "R ", " G ", @@ -92,7 +92,7 @@ static char* r500_fs_mask[] = { "RGBA", }; -static char* r500_fs_tex[] = { +static char* r5xx_fs_tex[] = { " NOP", " LD", "TEXKILL", @@ -203,7 +203,8 @@ static char* r300_vs_swiz_debug[] = { "U", }; -void r500_fs_dump(struct r500_fragment_shader* fs); +void r5xx_fs_dump(struct r5xx_fragment_shader* fs); +void r3xx_dump_fs(struct r3xx_fragment_shader* fs); void r300_vs_dump(struct r300_vertex_shader* vs); diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 93cf6909a33..7ba56cdc1d2 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -110,7 +110,7 @@ void r300_emit_dsa_state(struct r300_context* r300, } void r300_emit_fragment_shader(struct r300_context* r300, - struct r300_fragment_shader* fs) + struct r3xx_fragment_shader* fs) { int i; CS_LOCALS(r300); @@ -142,7 +142,7 @@ void r300_emit_fragment_shader(struct r300_context* r300, } void r500_emit_fragment_shader(struct r300_context* r300, - struct r500_fragment_shader* fs) + struct r5xx_fragment_shader* fs) { int i; struct r300_constant_buffer* constants = @@ -289,18 +289,6 @@ void r300_emit_rs_block_state(struct r300_context* r300, END_CS; } -void r300_emit_sampler(struct r300_context* r300, - struct r300_sampler_state* sampler, unsigned offset) -{ - CS_LOCALS(r300); - - BEGIN_CS(6); - OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), sampler->filter0); - OUT_CS_REG(R300_TX_FILTER1_0 + (offset * 4), sampler->filter1); - OUT_CS_REG(R300_TX_BORDER_COLOR_0 + (offset * 4), sampler->border_color); - END_CS; -} - void r300_emit_scissor_state(struct r300_context* r300, struct r300_scissor_state* scissor) { @@ -314,11 +302,17 @@ void r300_emit_scissor_state(struct r300_context* r300, } void r300_emit_texture(struct r300_context* r300, - struct r300_texture* tex, unsigned offset) + struct r300_sampler_state* sampler, + struct r300_texture* tex, + unsigned offset) { CS_LOCALS(r300); - BEGIN_CS(10); + BEGIN_CS(16); + OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), sampler->filter0); + OUT_CS_REG(R300_TX_FILTER1_0 + (offset * 4), sampler->filter1); + OUT_CS_REG(R300_TX_BORDER_COLOR_0 + (offset * 4), sampler->border_color); + OUT_CS_REG(R300_TX_FORMAT0_0 + (offset * 4), tex->state.format0); OUT_CS_REG(R300_TX_FORMAT1_0 + (offset * 4), tex->state.format1); OUT_CS_REG(R300_TX_FORMAT2_0 + (offset * 4), tex->state.format2); @@ -570,10 +564,10 @@ validate: if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER) { if (r300screen->caps->is_r500) { r500_emit_fragment_shader(r300, - (struct r500_fragment_shader*)r300->fs); + (struct r5xx_fragment_shader*)r300->fs); } else { r300_emit_fragment_shader(r300, - (struct r300_fragment_shader*)r300->fs); + (struct r3xx_fragment_shader*)r300->fs); } r300->dirty_state &= ~R300_NEW_FRAGMENT_SHADER; } @@ -593,29 +587,27 @@ validate: r300->dirty_state &= ~R300_NEW_RS_BLOCK; } - if (r300->dirty_state & R300_ANY_NEW_SAMPLERS) { - for (i = 0; i < r300->sampler_count; i++) { - if (r300->dirty_state & (R300_NEW_SAMPLER << i)) { - r300_emit_sampler(r300, r300->sampler_states[i], i); - r300->dirty_state &= ~(R300_NEW_SAMPLER << i); - dirty_tex++; - } - } - } - if (r300->dirty_state & R300_NEW_SCISSOR) { r300_emit_scissor_state(r300, r300->scissor_state); r300->dirty_state &= ~R300_NEW_SCISSOR; } - if (r300->dirty_state & R300_ANY_NEW_TEXTURES) { - for (i = 0; i < r300->texture_count; i++) { - if (r300->dirty_state & (R300_NEW_TEXTURE << i)) { - r300_emit_texture(r300, r300->textures[i], i); - r300->dirty_state &= ~(R300_NEW_TEXTURE << i); + /* Samplers and textures are tracked separately but emitted together. */ + if (r300->dirty_state & + (R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) { + for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) { + if (r300->dirty_state & + ((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) { + r300_emit_texture(r300, + r300->sampler_states[i], + r300->textures[i], + i); + r300->dirty_state &= + ~((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i)); dirty_tex++; } } + r300->dirty_state &= ~(R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES); } if (r300->dirty_state & R300_NEW_VIEWPORT) { @@ -637,6 +629,10 @@ validate: r300->dirty_state &= ~R300_NEW_VERTEX_SHADER; } + /* XXX + assert(r300->dirty_state == 0); + */ + /* Finally, emit the VBO. */ r300_emit_vertex_buffer(r300); diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 946f625bd89..fda26f39481 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -43,10 +43,10 @@ void r300_emit_dsa_state(struct r300_context* r300, struct r300_dsa_state* dsa); void r300_emit_fragment_shader(struct r300_context* r300, - struct r300_fragment_shader* fs); + struct r3xx_fragment_shader* fs); void r500_emit_fragment_shader(struct r300_context* r300, - struct r500_fragment_shader* fs); + struct r5xx_fragment_shader* fs); void r300_emit_fb_state(struct r300_context* r300, struct pipe_framebuffer_state* fb); @@ -56,14 +56,13 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs); void r300_emit_rs_block_state(struct r300_context* r300, struct r300_rs_block* rs); -void r300_emit_sampler(struct r300_context* r300, - struct r300_sampler_state* sampler, unsigned offset); - void r300_emit_scissor_state(struct r300_context* r300, struct r300_scissor_state* scissor); void r300_emit_texture(struct r300_context* r300, - struct r300_texture* tex, unsigned offset); + struct r300_sampler_state* sampler, + struct r300_texture* tex, + unsigned offset); void r300_emit_vertex_buffer(struct r300_context* r300); diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index 89a5f2b20cf..0dff1c6f4fb 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -29,7 +29,11 @@ static void r300_flush(struct pipe_context* pipe, struct r300_context* r300 = r300_context(pipe); CS_LOCALS(r300); - draw_flush(r300->draw); + /* We probably need to flush Draw, but we may have been called from + * within Draw. This feels kludgy, but it might be the best thing. */ + if (!r300->draw->flushing) { + draw_flush(r300->draw); + } if (r300->dirty_hw) { FLUSH_CS; diff --git a/src/gallium/drivers/r300/r300_flush.h b/src/gallium/drivers/r300/r300_flush.h index a1b224b39ce..9a83d89daab 100644 --- a/src/gallium/drivers/r300/r300_flush.h +++ b/src/gallium/drivers/r300/r300_flush.h @@ -23,6 +23,8 @@ #ifndef R300_FLUSH_H #define R300_FLUSH_H +#include "draw/draw_private.h" + #include "pipe/p_context.h" #include "r300_context.h" diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c new file mode 100644 index 00000000000..4b304306d0f --- /dev/null +++ b/src/gallium/drivers/r300/r300_fs.c @@ -0,0 +1,109 @@ +/* + * Copyright 2008 Corbin Simpson <[email protected]> + * Joakim Sindholt <[email protected]> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) 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 "r300_fs.h" + +void r300_translate_fragment_shader(struct r300_context* r300, + struct r300_fragment_shader* fs) +{ + struct tgsi_parse_context parser; + int i; + boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500; + struct r300_constant_buffer* consts = + &r300->shader_constants[PIPE_SHADER_FRAGMENT]; + + struct r300_fs_asm* assembler = CALLOC_STRUCT(r300_fs_asm); + if (assembler == NULL) { + return; + } + /* Setup starting offset for immediates. */ + assembler->imm_offset = consts->user_count; + /* Enable depth writes, if needed. */ + assembler->writes_depth = fs->info.writes_z; + + /* Make sure we start at the beginning of the shader. */ + if (is_r500) { + ((struct r5xx_fragment_shader*)fs)->instruction_count = 0; + } + + tgsi_parse_init(&parser, fs->state.tokens); + + while (!tgsi_parse_end_of_tokens(&parser)) { + tgsi_parse_token(&parser); + + /* This is seriously the lamest way to create fragment programs ever. + * I blame TGSI. */ + switch (parser.FullToken.Token.Type) { + case TGSI_TOKEN_TYPE_DECLARATION: + /* Allocated registers sitting at the beginning + * of the program. */ + r300_fs_declare(assembler, &parser.FullToken.FullDeclaration); + break; + case TGSI_TOKEN_TYPE_IMMEDIATE: + debug_printf("r300: Emitting immediate to constant buffer, " + "position %d\n", + assembler->imm_offset + assembler->imm_count); + /* I am not amused by the length of these. */ + for (i = 0; i < 4; i++) { + consts->constants[assembler->imm_offset + + assembler->imm_count][i] = + parser.FullToken.FullImmediate.u.ImmediateFloat32[i] + .Float; + } + assembler->imm_count++; + break; + case TGSI_TOKEN_TYPE_INSTRUCTION: + if (is_r500) { + r5xx_fs_instruction((struct r5xx_fragment_shader*)fs, + assembler, &parser.FullToken.FullInstruction); + } else { + r3xx_fs_instruction((struct r3xx_fragment_shader*)fs, + assembler, &parser.FullToken.FullInstruction); + } + break; + } + } + + debug_printf("r300: fs: %d texs and %d colors, first free reg is %d\n", + assembler->tex_count, assembler->color_count, + assembler->tex_count + assembler->color_count); + + consts->count = consts->user_count + assembler->imm_count; + fs->uses_imms = assembler->imm_count; + debug_printf("r300: fs: %d total constants, " + "%d from user and %d from immediates\n", consts->count, + consts->user_count, assembler->imm_count); + r3xx_fs_finalize(fs, assembler); + if (is_r500) { + r5xx_fs_finalize((struct r5xx_fragment_shader*)fs, assembler); + } + + tgsi_dump(fs->state.tokens, 0); + /* XXX finish r300 dumper too */ + if (is_r500) { + r5xx_fs_dump((struct r5xx_fragment_shader*)fs); + } + + tgsi_parse_free(&parser); + FREE(assembler); +} diff --git a/src/gallium/drivers/r300/r300_fs.h b/src/gallium/drivers/r300/r300_fs.h new file mode 100644 index 00000000000..18deb7a05e4 --- /dev/null +++ b/src/gallium/drivers/r300/r300_fs.h @@ -0,0 +1,36 @@ +/* + * Copyright 2008 Corbin Simpson <[email protected]> + * Joakim Sindholt <[email protected]> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) 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 R300_FS_H +#define R300_FS_H + +#include "tgsi/tgsi_dump.h" + +#include "r300_context.h" +#include "r3xx_fs.h" +#include "r5xx_fs.h" + +void r300_translate_fragment_shader(struct r300_context* r300, + struct r300_fragment_shader* fs); + + #endif /* R300_FS_H */ diff --git a/src/gallium/drivers/r300/r300_fs_inlines.h b/src/gallium/drivers/r300/r300_fs_inlines.h new file mode 100644 index 00000000000..be4be9465e6 --- /dev/null +++ b/src/gallium/drivers/r300/r300_fs_inlines.h @@ -0,0 +1,158 @@ +/* + * Copyright 2008 Corbin Simpson <[email protected]> + * Joakim Sindholt <[email protected]> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) 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 R300_FS_INLINES_H +#define R300_FS_INLINES_H + +#include "tgsi/tgsi_parse.h" + +#include "r300_context.h" +#include "r300_debug.h" +#include "r300_reg.h" +#include "r300_screen.h" +#include "r300_shader_inlines.h" + +/* Temporary struct used to hold assembly state while putting together + * fragment programs. */ +struct r300_fs_asm { + /* Pipe context. */ + struct r300_context* r300; + /* Number of colors. */ + unsigned color_count; + /* Number of texcoords. */ + unsigned tex_count; + /* Offset for temporary registers. Inputs and temporaries have no + * distinguishing markings, so inputs start at 0 and the first usable + * temporary register is after all inputs. */ + unsigned temp_offset; + /* Number of requested temporary registers. */ + unsigned temp_count; + /* Offset for immediate constants. Neither R300 nor R500 can do four + * inline constants per source, so instead we copy immediates into the + * constant buffer. */ + unsigned imm_offset; + /* Number of immediate constants. */ + unsigned imm_count; + /* Are depth writes enabled? */ + boolean writes_depth; + /* Depth write offset. This is the TGSI output that corresponds to + * depth writes. */ + unsigned depth_output; +}; + +static INLINE void r300_fs_declare(struct r300_fs_asm* assembler, + struct tgsi_full_declaration* decl) +{ + switch (decl->Declaration.File) { + case TGSI_FILE_INPUT: + switch (decl->Semantic.SemanticName) { + case TGSI_SEMANTIC_COLOR: + assembler->color_count++; + break; + case TGSI_SEMANTIC_FOG: + case TGSI_SEMANTIC_GENERIC: + assembler->tex_count++; + break; + default: + debug_printf("r300: fs: Bad semantic declaration %d\n", + decl->Semantic.SemanticName); + break; + } + break; + case TGSI_FILE_OUTPUT: + /* Depth write. Mark the position of the output so we can + * identify it later. */ + if (decl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION) { + assembler->depth_output = decl->DeclarationRange.First; + } + break; + case TGSI_FILE_CONSTANT: + break; + case TGSI_FILE_TEMPORARY: + assembler->temp_count++; + break; + default: + debug_printf("r300: fs: Bad file %d\n", decl->Declaration.File); + break; + } + + assembler->temp_offset = assembler->color_count + assembler->tex_count; +} + +static INLINE unsigned r300_fs_src(struct r300_fs_asm* assembler, + struct tgsi_src_register* src) +{ + switch (src->File) { + case TGSI_FILE_NULL: + return 0; + case TGSI_FILE_INPUT: + /* XXX may be wrong */ + return src->Index; + break; + case TGSI_FILE_TEMPORARY: + return src->Index + assembler->temp_offset; + break; + case TGSI_FILE_IMMEDIATE: + return (src->Index + assembler->imm_offset) | (1 << 8); + break; + case TGSI_FILE_CONSTANT: + /* XXX magic */ + return src->Index | (1 << 8); + break; + default: + debug_printf("r300: fs: Unimplemented src %d\n", src->File); + break; + } + return 0; +} + +static INLINE unsigned r300_fs_dst(struct r300_fs_asm* assembler, + struct tgsi_dst_register* dst) +{ + switch (dst->File) { + case TGSI_FILE_NULL: + /* This happens during KIL instructions. */ + return 0; + break; + case TGSI_FILE_OUTPUT: + return 0; + break; + case TGSI_FILE_TEMPORARY: + return dst->Index + assembler->temp_offset; + break; + default: + debug_printf("r300: fs: Unimplemented dst %d\n", dst->File); + break; + } + return 0; +} + +static INLINE boolean r300_fs_is_depr(struct r300_fs_asm* assembler, + struct tgsi_dst_register* dst) +{ + return (assembler->writes_depth && + (dst->File == TGSI_FILE_OUTPUT) && + (dst->Index == assembler->depth_output)); +} + +#endif /* R300_FS_INLINES_H */ diff --git a/src/gallium/drivers/r300/r300_query.h b/src/gallium/drivers/r300/r300_query.h index 4f447ea45b8..6a7646087a7 100644 --- a/src/gallium/drivers/r300/r300_query.h +++ b/src/gallium/drivers/r300/r300_query.h @@ -27,6 +27,8 @@ #include "r300_cs.h" #include "r300_reg.h" +struct r300_context; + struct r300_query { /* The kind of query. Currently only OQ is supported. */ unsigned type; diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 3bb9bc47b50..6825d998700 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1064,8 +1064,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. R300_GA_COLOR_CONTROL_RGB2_SHADING_FLAT | \ R300_GA_COLOR_CONTROL_ALPHA2_SHADING_FLAT | \ R300_GA_COLOR_CONTROL_RGB3_SHADING_FLAT | \ - R300_GA_COLOR_CONTROL_ALPHA3_SHADING_FLAT | \ - R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST ) + R300_GA_COLOR_CONTROL_ALPHA3_SHADING_FLAT ) # define R300_SHADE_MODEL_SMOOTH ( \ R300_GA_COLOR_CONTROL_RGB0_SHADING_GOURAUD | \ @@ -1075,8 +1074,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. R300_GA_COLOR_CONTROL_RGB2_SHADING_GOURAUD | \ R300_GA_COLOR_CONTROL_ALPHA2_SHADING_GOURAUD | \ R300_GA_COLOR_CONTROL_RGB3_SHADING_GOURAUD | \ - R300_GA_COLOR_CONTROL_ALPHA3_SHADING_GOURAUD | \ - R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST ) + R300_GA_COLOR_CONTROL_ALPHA3_SHADING_GOURAUD ) /* Specifies red & green components of fill color -- S312 format -- Backwards comp. */ #define R300_GA_SOLID_RG 0x427c @@ -1480,6 +1478,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_PITCH_EN (1 << 31) # define R300_TX_WIDTH(x) ((x) << 0) # define R300_TX_HEIGHT(x) ((x) << 11) +# define R300_TX_NUM_LEVELS(x) ((x) << 26) #define R300_TX_FORMAT1_0 0x44C0 /* The interpretation of the format word by Wladimir van der Laan */ @@ -1487,9 +1486,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. They are given meanings as R, G, B and Alpha by the swizzle specification */ # define R300_TX_FORMAT_X8 0x0 -# define R500_TX_FORMAT_X1 0x0 // bit set in format 2 # define R300_TX_FORMAT_X16 0x1 -# define R500_TX_FORMAT_X1_REV 0x0 // bit set in format 2 # define R300_TX_FORMAT_Y4X4 0x2 # define R300_TX_FORMAT_Y8X8 0x3 # define R300_TX_FORMAT_Y16X16 0x4 @@ -1506,31 +1503,29 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_FORMAT_DXT1 0xF # define R300_TX_FORMAT_DXT3 0x10 # define R300_TX_FORMAT_DXT5 0x11 -# define R300_TX_FORMAT_D3DMFT_CxV8U8 0x12 /* no swizzle */ -# define R300_TX_FORMAT_A8R8G8B8 0x13 /* no swizzle */ -# define R300_TX_FORMAT_B8G8_B8G8 0x14 /* no swizzle */ -# define R300_TX_FORMAT_G8R8_G8B8 0x15 /* no swizzle */ - - /* These two values are wrong, but they're the only values that - * produce any even vaguely correct results. Can r300 only do 16-bit - * depth textures? - */ -# define R300_TX_FORMAT_X24_Y8 0x1e -# define R300_TX_FORMAT_X32 0x1e - - /* 0x16 - some 16 bit green format.. ?? */ +# define R300_TX_FORMAT_Y8 0x12 +# define R300_TX_FORMAT_AVYU444 0x13 +# define R300_TX_FORMAT_VYUY422 0x14 +# define R300_TX_FORMAT_YVYU422 0x15 +# define R300_TX_FORMAT_16_MPEG 0x16 +# define R300_TX_FORMAT_16_16_MPEG 0x17 +# define R300_TX_FORMAT_16F 0x18 +# define R300_TX_FORMAT_16F_16F 0x19 +# define R300_TX_FORMAT_16F_16F_16F_16F 0x1A +# define R300_TX_FORMAT_32F 0x1B +# define R300_TX_FORMAT_32F_32F 0x1C +# define R300_TX_FORMAT_32F_32F_32F_32F 0x1D +# define R300_TX_FORMAT_W24_FP 0x1E + +# define R300_TX_FORMAT_SIGNED_W (1 << 5) +# define R300_TX_FORMAT_SIGNED_Z (1 << 6) +# define R300_TX_FORMAT_SIGNED_Y (1 << 7) +# define R300_TX_FORMAT_SIGNED_X (1 << 8) +# define R300_TX_FORMAT_SIGNED (0xf << 5) + # define R300_TX_FORMAT_3D (1 << 25) # define R300_TX_FORMAT_CUBIC_MAP (2 << 25) - /* gap */ - /* Floating point formats */ - /* Note - hardware supports both 16 and 32 bit floating point */ -# define R300_TX_FORMAT_FL_I16 0x18 -# define R300_TX_FORMAT_FL_I16A16 0x19 -# define R300_TX_FORMAT_FL_R16G16B16A16 0x1A -# define R300_TX_FORMAT_FL_I32 0x1B -# define R300_TX_FORMAT_FL_I32A32 0x1C -# define R300_TX_FORMAT_FL_R32G32B32A32 0x1D /* alpha modes, convenience mostly */ /* if you have alpha, pick constant appropriate to the number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */ @@ -1571,7 +1566,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_FORMAT_CONST_Z (4<<5) # define R300_TX_FORMAT_CONST_W (8<<5) -# define R300_TX_FORMAT_YUV_MODE 0x00800000 +# define R300_TX_FORMAT_GAMMA (1 << 21) +# define R300_TX_FORMAT_YUV_TO_RGB (1 << 22) #define R300_TX_FORMAT2_0 0x4500 /* obvious missing in gap */ # define R300_TX_PITCHMASK_SHIFT 0 diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index a6f1efe3563..da1d5ffe2fd 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -94,8 +94,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) return 0; } case PIPE_CAP_S3TC: - /* IN THEORY */ - return 0; + return 1; case PIPE_CAP_ANISOTROPIC_FILTER: return 1; case PIPE_CAP_POINT_SPRITE: @@ -145,6 +144,9 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: /* XXX guessing (what a terrible guess) */ return 2; + case PIPE_CAP_TGSI_CONT_SUPPORTED: + /* XXX */ + return 0; default: debug_printf("r300: Implementation error: Bad param %d\n", param); @@ -179,21 +181,58 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param) } } -static boolean check_tex_2d_format(enum pipe_format format, boolean is_r500) +static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, + boolean is_r500) { switch (format) { + /* Supported formats. */ /* Colorbuffer */ case PIPE_FORMAT_A4R4G4B4_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: case PIPE_FORMAT_A1R5G5B5_UNORM: - case PIPE_FORMAT_A8R8G8B8_UNORM: + return usage & + (PIPE_TEXTURE_USAGE_RENDER_TARGET | + PIPE_TEXTURE_USAGE_DISPLAY_TARGET | + PIPE_TEXTURE_USAGE_PRIMARY); + + /* Texture */ + case PIPE_FORMAT_A8R8G8B8_SRGB: + case PIPE_FORMAT_R8G8B8A8_SRGB: + case PIPE_FORMAT_DXT1_RGB: + case PIPE_FORMAT_DXT1_RGBA: + case PIPE_FORMAT_DXT3_RGBA: + case PIPE_FORMAT_DXT5_RGBA: + case PIPE_FORMAT_YCBCR: + return usage & PIPE_TEXTURE_USAGE_SAMPLER; + /* Colorbuffer or texture */ + case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_R8G8B8A8_UNORM: case PIPE_FORMAT_I8_UNORM: + return usage & + (PIPE_TEXTURE_USAGE_RENDER_TARGET | + PIPE_TEXTURE_USAGE_DISPLAY_TARGET | + PIPE_TEXTURE_USAGE_PRIMARY | + PIPE_TEXTURE_USAGE_SAMPLER); + /* Z buffer */ case PIPE_FORMAT_Z16_UNORM: - /* Z buffer with stencil */ + return usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL; + + /* Z buffer with stencil or texture */ case PIPE_FORMAT_Z24S8_UNORM: - return TRUE; + return usage & + (PIPE_TEXTURE_USAGE_DEPTH_STENCIL | + PIPE_TEXTURE_USAGE_SAMPLER); + + /* Definitely unsupported formats. */ + /* Non-usable Z buffer/stencil formats. */ + case PIPE_FORMAT_Z24X8_UNORM: + case PIPE_FORMAT_S8Z24_UNORM: + case PIPE_FORMAT_X8Z24_UNORM: + debug_printf("r300: Note: Got unsupported format: %s in %s\n", + pf_name(format), __FUNCTION__); + return FALSE; /* XXX These don't even exist case PIPE_FORMAT_A32R32G32B32: @@ -216,7 +255,8 @@ static boolean check_tex_2d_format(enum pipe_format format, boolean is_r500) return FALSE; */ default: - debug_printf("r300: Warning: Got unsupported format: %s in %s\n", + /* Unknown format... */ + debug_printf("r300: Warning: Got unknown format: %s in %s\n", pf_name(format), __FUNCTION__); break; } @@ -233,7 +273,7 @@ static boolean r300_is_format_supported(struct pipe_screen* pscreen, { switch (target) { case PIPE_TEXTURE_2D: - return check_tex_2d_format(format, + return check_tex_2d_format(format, tex_usage, r300_screen(pscreen)->caps->is_r500); case PIPE_TEXTURE_1D: case PIPE_TEXTURE_3D: diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h index 3f52dbc3bea..2a0e41fbc3b 100644 --- a/src/gallium/drivers/r300/r300_screen.h +++ b/src/gallium/drivers/r300/r300_screen.h @@ -49,7 +49,7 @@ struct r300_transfer { }; /* Convenience cast wrapper. */ -static struct r300_screen* r300_screen(struct pipe_screen* screen) { +static INLINE struct r300_screen* r300_screen(struct pipe_screen* screen) { return (struct r300_screen*)screen; } diff --git a/src/gallium/drivers/r300/r300_shader_inlines.h b/src/gallium/drivers/r300/r300_shader_inlines.h new file mode 100644 index 00000000000..a04f45b03e2 --- /dev/null +++ b/src/gallium/drivers/r300/r300_shader_inlines.h @@ -0,0 +1,47 @@ +/* + * Copyright 2009 Corbin Simpson <[email protected]> + * Joakim Sindholt <[email protected]> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) 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 R300_SHADER_INLINES_H +#define R300_SHADER_INLINES_H + +/* TGSI constants. TGSI is like XML: If it can't solve your problems, you're + * not using enough of it. */ +static const struct tgsi_full_src_register r300_constant_zero = { + .SrcRegister.Extended = TRUE, + .SrcRegister.File = TGSI_FILE_NULL, + .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ZERO, + .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ZERO, + .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ZERO, + .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ZERO, +}; + +static const struct tgsi_full_src_register r300_constant_one = { + .SrcRegister.Extended = TRUE, + .SrcRegister.File = TGSI_FILE_NULL, + .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ONE, + .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ONE, + .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ONE, + .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ONE, +}; + +#endif /* R300_SHADER_INLINES_H */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 01e2b511534..68da0aa4cbb 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -24,12 +24,14 @@ #include "util/u_pack_color.h" #include "util/u_debug.h" + +#include "pipe/p_config.h" #include "pipe/internal/p_winsys_screen.h" #include "r300_context.h" #include "r300_reg.h" #include "r300_state_inlines.h" -#include "r300_state_shader.h" +#include "r300_fs.h" /* r300_state: Functions used to intialize state context by translating * Gallium state objects into semi-native r300 state objects. */ @@ -283,14 +285,12 @@ static void* r300_create_fs_state(struct pipe_context* pipe, const struct pipe_shader_state* shader) { struct r300_context* r300 = r300_context(pipe); - struct r3xx_fragment_shader* fs = NULL; + struct r300_fragment_shader* fs = NULL; if (r300_screen(r300->context.screen)->caps->is_r500) { - fs = - (struct r3xx_fragment_shader*)CALLOC_STRUCT(r500_fragment_shader); + fs = (struct r300_fragment_shader*)CALLOC_STRUCT(r5xx_fragment_shader); } else { - fs = - (struct r3xx_fragment_shader*)CALLOC_STRUCT(r300_fragment_shader); + fs = (struct r300_fragment_shader*)CALLOC_STRUCT(r3xx_fragment_shader); } /* Copy state directly into shader. */ @@ -306,7 +306,7 @@ static void* r300_create_fs_state(struct pipe_context* pipe, static void r300_bind_fs_state(struct pipe_context* pipe, void* shader) { struct r300_context* r300 = r300_context(pipe); - struct r3xx_fragment_shader* fs = (struct r3xx_fragment_shader*)shader; + struct r300_fragment_shader* fs = (struct r300_fragment_shader*)shader; if (fs == NULL) { r300->fs = NULL; @@ -324,7 +324,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader) /* Delete fragment shader state. */ static void r300_delete_fs_state(struct pipe_context* pipe, void* shader) { - struct r3xx_fragment_shader* fs = (struct r3xx_fragment_shader*)shader; + struct r300_fragment_shader* fs = (struct r300_fragment_shader*)shader; FREE(fs->state.tokens); FREE(shader); } @@ -352,14 +352,19 @@ static void* r300_create_rs_state(struct pipe_context* pipe, rs->enable_vte = !state->bypass_vs_clip_and_viewport; +#ifdef PIPE_ARCH_LITTLE_ENDIAN + rs->vap_control_status = R300_VC_NO_SWAP; +#else + rs->vap_control_status = R300_VC_32BIT_SWAP; +#endif + /* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL. * Else, enable HW TCL and force Draw's TCL off. */ if (state->bypass_vs_clip_and_viewport || !r300_screen(pipe->screen)->caps->has_tcl) { - rs->vap_control_status = R300_VAP_TCL_BYPASS; + rs->vap_control_status |= R300_VAP_TCL_BYPASS; } else { rs->rs.bypass_vs_clip_and_viewport = TRUE; - rs->vap_control_status = 0; } rs->point_size = pack_float_16_6x(state->point_size) | @@ -423,6 +428,10 @@ static void* r300_create_rs_state(struct pipe_context* pipe, rs->color_control = R300_SHADE_MODEL_SMOOTH; } + if (!state->flatshade_first) { + rs->color_control |= R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST; + } + return (void*)rs; } diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index e438114010c..9f534b8ce3c 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -34,14 +34,17 @@ void r300_emit_invariant_state(struct r300_context* r300) struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; CS_LOCALS(r300); - BEGIN_CS(26 + (caps->has_tcl ? 2: 0)); + BEGIN_CS(22 + (caps->has_tcl ? 2: 0)); /*** Graphics Backend (GB) ***/ /* Various GB enables */ OUT_CS_REG(R300_GB_ENABLE, 0x0); - /* Subpixel multisampling for AA */ - OUT_CS_REG(R300_GB_MSPOS0, 0x66666666); - OUT_CS_REG(R300_GB_MSPOS1, 0x6666666); + /* Subpixel multisampling for AA + * These are commented out because glisse's CS checker doesn't like them. + * I presume these will be re-enabled later. + * OUT_CS_REG(R300_GB_MSPOS0, 0x66666666); + * OUT_CS_REG(R300_GB_MSPOS1, 0x6666666); + */ /* Source of fog depth */ OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W); /* AA enable */ @@ -69,7 +72,7 @@ void r300_emit_invariant_state(struct r300_context* r300) END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(77 + (caps->has_tcl ? 5 : 0)); + BEGIN_CS(75 + (caps->has_tcl ? 5 : 0)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); @@ -77,17 +80,12 @@ void r300_emit_invariant_state(struct r300_context* r300) R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA | R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA | R300_VPORT_Z_OFFSET_ENA | R300_VTX_W0_FMT); - /* XXX endian */ if (caps->has_tcl) { - OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP); OUT_CS_REG_SEQ(R300_VAP_GB_VERT_CLIP_ADJ, 4); OUT_CS_32F(1.0); OUT_CS_32F(1.0); OUT_CS_32F(1.0); OUT_CS_32F(1.0); - } else { - OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP | - R300_VAP_TCL_BYPASS); } /* XXX point tex stuffing */ OUT_CS_REG_SEQ(R300_GA_POINT_S0, 1); diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index c9e2dff14ed..fdabe4d9cfe 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -151,11 +151,11 @@ validate: /* Fragment shader setup */ if (caps->is_r500) { - r500_emit_fragment_shader(r300, &r500_passthrough_fragment_shader); - r300_emit_rs_block_state(r300, &r500_rs_block_clear_state); + r500_emit_fragment_shader(r300, &r5xx_passthrough_fragment_shader); + r300_emit_rs_block_state(r300, &r5xx_rs_block_clear_state); } else { - r300_emit_fragment_shader(r300, &r300_passthrough_fragment_shader); - r300_emit_rs_block_state(r300, &r300_rs_block_clear_state); + r300_emit_fragment_shader(r300, &r3xx_passthrough_fragment_shader); + r300_emit_rs_block_state(r300, &r3xx_rs_block_clear_state); } BEGIN_CS(26); @@ -228,13 +228,14 @@ static void r300_surface_copy(struct pipe_context* pipe, struct r300_texture* desttex = (struct r300_texture*)dest->texture; unsigned pixpitch = srctex->stride / srctex->tex.block.size; boolean invalid = FALSE; + float fsrcx = srcx, fsrcy = srcy, fdestx = destx, fdesty = desty; CS_LOCALS(r300); debug_printf("r300: Copying surface %p at (%d,%d) to %p at (%d, %d)," " dimensions %dx%d (pixel pitch %d)\n", src, srcx, srcy, dest, destx, desty, w, h, pixpitch); - if ((srctex == desttex) && + if ((srctex->buffer == desttex->buffer) && ((destx < srcx + w) || (srcx < destx + w)) && ((desty < srcy + h) || (srcy < desty + h))) { fallback: @@ -267,14 +268,10 @@ validate: r300_surface_setup(r300, desttex, destx, desty, w, h); /* Setup the texture. */ - r300_emit_sampler(r300, &r300_sampler_copy_state, 0); - r300_emit_texture(r300, srctex, 0); + r300_emit_texture(r300, &r300_sampler_copy_state, srctex, 0); /* Flush and enable. */ - BEGIN_CS(4); - OUT_CS_REG(R300_TX_INVALTAGS, 0); - OUT_CS_REG(R300_TX_ENABLE, 0x1); - END_CS; + r300_flush_textures(r300); /* Vertex shader setup */ if (caps->has_tcl) { @@ -291,11 +288,11 @@ validate: /* Fragment shader setup */ if (caps->is_r500) { - r500_emit_fragment_shader(r300, &r500_texture_fragment_shader); - r300_emit_rs_block_state(r300, &r500_rs_block_copy_state); + r500_emit_fragment_shader(r300, &r5xx_texture_fragment_shader); + r300_emit_rs_block_state(r300, &r5xx_rs_block_copy_state); } else { - r300_emit_fragment_shader(r300, &r300_texture_fragment_shader); - r300_emit_rs_block_state(r300, &r300_rs_block_copy_state); + r300_emit_fragment_shader(r300, &r3xx_texture_fragment_shader); + r300_emit_rs_block_state(r300, &r3xx_rs_block_copy_state); } BEGIN_CS(30); @@ -329,25 +326,25 @@ validate: OUT_CS(R300_PRIM_TYPE_QUADS | R300_PRIM_WALK_RING | (4 << R300_PRIM_NUM_VERTICES_SHIFT)); /* (x , y ) */ - OUT_CS_32F((float)(destx / dest->width)); - OUT_CS_32F((float)(desty / dest->height)); - OUT_CS_32F((float)(srcx / dest->width)); - OUT_CS_32F((float)(srcy / dest->height)); + OUT_CS_32F(fdestx / dest->width); + OUT_CS_32F(fdesty / dest->height); + OUT_CS_32F(fsrcx / src->width); + OUT_CS_32F(fsrcy / src->height); /* (x , y + h) */ - OUT_CS_32F((float)(destx / dest->width)); - OUT_CS_32F((float)((desty + h) / dest->height)); - OUT_CS_32F((float)(srcx / dest->width)); - OUT_CS_32F((float)((srcy + h) / dest->height)); + OUT_CS_32F(fdestx / dest->width); + OUT_CS_32F((fdesty + h) / dest->height); + OUT_CS_32F(fsrcx / src->width); + OUT_CS_32F((fsrcy + h) / src->height); /* (x + w, y + h) */ - OUT_CS_32F((float)((destx + w) / dest->width)); - OUT_CS_32F((float)((desty + h) / dest->height)); - OUT_CS_32F((float)((srcx + w) / dest->width)); - OUT_CS_32F((float)((srcy + h) / dest->height)); + OUT_CS_32F((fdestx + w) / dest->width); + OUT_CS_32F((fdesty + h) / dest->height); + OUT_CS_32F((fsrcx + w) / src->width); + OUT_CS_32F((fsrcy + h) / src->height); /* (x + w, y ) */ - OUT_CS_32F((float)((destx + w) / dest->width)); - OUT_CS_32F((float)(desty / dest->height)); - OUT_CS_32F((float)((srcx + w) / dest->width)); - OUT_CS_32F((float)(srcy / dest->height)); + OUT_CS_32F((fdestx + w) / dest->width); + OUT_CS_32F(fdesty / dest->height); + OUT_CS_32F((fsrcx + w) / src->width); + OUT_CS_32F(fsrcy / src->height); OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA); diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h index 9a4c39f58bd..d01f0b143f5 100644 --- a/src/gallium/drivers/r300/r300_surface.h +++ b/src/gallium/drivers/r300/r300_surface.h @@ -31,8 +31,8 @@ #include "r300_context.h" #include "r300_cs.h" #include "r300_emit.h" -#include "r300_state_shader.h" -#include "r300_state_tcl.h" +#include "r300_fs.h" +#include "r300_vs.h" #include "r300_state_inlines.h" static struct r300_blend_state blend_clear_state = { @@ -72,7 +72,7 @@ static struct r300_rs_state rs_clear_state = { .color_control = R300_SHADE_MODEL_FLAT, }; -static struct r300_rs_block r300_rs_block_clear_state = { +static struct r300_rs_block r3xx_rs_block_clear_state = { .ip[0] = R500_RS_SEL_S(R300_RS_SEL_K0) | R500_RS_SEL_T(R300_RS_SEL_K0) | R500_RS_SEL_R(R300_RS_SEL_K0) | @@ -82,7 +82,7 @@ static struct r300_rs_block r300_rs_block_clear_state = { .inst_count = 0, }; -static struct r300_rs_block r500_rs_block_clear_state = { +static struct r300_rs_block r5xx_rs_block_clear_state = { .ip[0] = R500_RS_SEL_S(R500_RS_IP_PTR_K0) | R500_RS_SEL_T(R500_RS_IP_PTR_K0) | R500_RS_SEL_R(R500_RS_IP_PTR_K0) | @@ -94,7 +94,7 @@ static struct r300_rs_block r500_rs_block_clear_state = { /* The following state is used for surface_copy only. */ -static struct r300_rs_block r300_rs_block_copy_state = { +static struct r300_rs_block r3xx_rs_block_copy_state = { .ip[0] = R500_RS_SEL_S(R300_RS_SEL_K0) | R500_RS_SEL_T(R300_RS_SEL_K0) | R500_RS_SEL_R(R300_RS_SEL_K0) | @@ -104,7 +104,7 @@ static struct r300_rs_block r300_rs_block_copy_state = { .inst_count = R300_RS_TX_OFFSET(0), }; -static struct r300_rs_block r500_rs_block_copy_state = { +static struct r300_rs_block r5xx_rs_block_copy_state = { .ip[0] = R500_RS_SEL_S(0) | R500_RS_SEL_T(1) | R500_RS_SEL_R(R500_RS_IP_PTR_K0) | diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 5ea9f56247b..11c7858d422 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -22,6 +22,8 @@ #include "r300_texture.h" +/* XXX maths need to go to util */ + static int minify(int i) { return MAX2(1, i >> 1); @@ -30,25 +32,29 @@ static int minify(int i) static void r300_setup_texture_state(struct r300_texture* tex, unsigned width, unsigned height, - unsigned pitch) + unsigned pitch, + unsigned levels) { struct r300_texture_state* state = &tex->state; state->format0 = R300_TX_WIDTH((width - 1) & 0x7ff) | - R300_TX_HEIGHT((height - 1) & 0x7ff) | R300_TX_PITCH_EN; + R300_TX_HEIGHT((height - 1) & 0x7ff) | + R300_TX_NUM_LEVELS(levels) | + R300_TX_PITCH_EN; /* XXX */ - state->format1 = R300_TX_FORMAT_A8R8G8B8; + state->format1 = r300_translate_texformat(tex->tex.format); state->format2 = pitch - 1; - /* XXX + /* Assume (somewhat foolishly) that oversized textures will + * not be permitted by the state tracker. */ if (width > 2048) { - state->pitch |= R300_TXWIDTH_11; + state->format2 |= R500_TXWIDTH_BIT11; } if (height > 2048) { - state->pitch |= R300_TXHEIGHT_11; - } */ + state->format2 |= R500_TXHEIGHT_BIT11; + } } static void r300_setup_miptree(struct r300_texture* tex) @@ -67,14 +73,18 @@ static void r300_setup_miptree(struct r300_texture* tex) base->nblocksx[i] = pf_get_nblocksx(&base->block, base->width[i]); base->nblocksy[i] = pf_get_nblocksy(&base->block, base->width[i]); - /* Radeons enjoy things in multiples of 32. */ - /* XXX this can be 32 when POT */ - stride = (base->nblocksx[i] * base->block.size + 63) & ~63; + /* Radeons enjoy things in multiples of 64. + * + * XXX + * POT, uncompressed, unmippmapped textures can be aligned to 32, + * instead of 64. */ + stride = align(base->nblocksx[i] * base->block.size, 64); size = stride * base->nblocksy[i] * base->depth[i]; - tex->offset[i] = (tex->size + 63) & ~63; + tex->offset[i] = align(tex->size, 64); tex->size = tex->offset[i] + size; + /* Save stride of first level to the texture. */ if (i == 0) { tex->stride = stride; } @@ -98,9 +108,8 @@ static struct pipe_texture* r300_setup_miptree(tex); - /* XXX */ - r300_setup_texture_state(tex, tex->tex.width[0], tex->tex.height[0], - tex->tex.width[0]); + r300_setup_texture_state(tex, template->width[0], template->height[0], + template->width[0], template->last_level); tex->buffer = screen->buffer_create(screen, 64, PIPE_BUFFER_USAGE_PIXEL, @@ -164,6 +173,7 @@ static struct pipe_texture* { struct r300_texture* tex; + /* XXX we should start doing mips now... */ if (base->target != PIPE_TEXTURE_2D || base->last_level != 0 || base->depth[0] != 1) { @@ -181,8 +191,9 @@ static struct pipe_texture* tex->stride = *stride; + /* XXX */ r300_setup_texture_state(tex, tex->tex.width[0], tex->tex.height[0], - tex->stride); + tex->stride, 0); pipe_buffer_reference(&tex->buffer, buffer); diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 98fb5c9a08f..3b56f0307c0 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -32,6 +32,52 @@ void r300_init_screen_texture_functions(struct pipe_screen* screen); +/* Note the signature of R300_EASY_TX_FORMAT(A, R, G, B, FORMAT)... */ +static INLINE uint32_t r300_translate_texformat(enum pipe_format format) +{ + switch (format) { + /* X8 */ + case PIPE_FORMAT_I8_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, X, X8); + /* W8Z8Y8X8 */ + case PIPE_FORMAT_A8R8G8B8_UNORM: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); + case PIPE_FORMAT_R8G8B8A8_UNORM: + return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8); + case PIPE_FORMAT_A8R8G8B8_SRGB: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8) | + R300_TX_FORMAT_GAMMA; + case PIPE_FORMAT_R8G8B8A8_SRGB: + return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8) | + R300_TX_FORMAT_GAMMA; + /* DXT1 */ + case PIPE_FORMAT_DXT1_RGB: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, DXT1); + case PIPE_FORMAT_DXT1_RGBA: + return R300_EASY_TX_FORMAT(X, Y, Z, W, DXT1); + /* DXT3 */ + case PIPE_FORMAT_DXT3_RGBA: + return R300_EASY_TX_FORMAT(X, Y, Z, W, DXT3); + /* DXT5 */ + case PIPE_FORMAT_DXT5_RGBA: + return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5); + /* YVYU422 */ + case PIPE_FORMAT_YCBCR: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, YVYU422) | + R300_TX_FORMAT_YUV_TO_RGB; + /* W24_FP */ + case PIPE_FORMAT_Z24S8_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP); + default: + debug_printf("r300: Implementation error: " + "Got unsupported texture format %s in %s\n", + pf_name(format), __FUNCTION__); + assert(0); + break; + } + return 0; +} + #ifndef R300_WINSYS_H boolean r300_get_texture_buffer(struct pipe_texture* texture, diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_vs.c index 8cf8250425e..f87435f9f07 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -20,7 +20,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "r300_state_tcl.h" +#include "r300_vs.h" static void r300_vs_declare(struct r300_vs_asm* assembler, struct tgsi_full_declaration* decl) @@ -403,7 +403,7 @@ void r300_translate_vertex_shader(struct r300_context* r300, debug_printf("r300: vs: tab: %d %d %d %d\n", assembler->tab[0], assembler->tab[1], assembler->tab[2], assembler->tab[3]); - tgsi_dump(vs->state.tokens); + tgsi_dump(vs->state.tokens, 0); /* XXX finish r300 vertex shader dumper */ r300_vs_dump(vs); diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_vs.h index 2c8b586c2f5..165d7178122 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_vs.h @@ -20,15 +20,17 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef R300_STATE_TCL_H -#define R300_STATE_TCL_H +#ifndef R300_VS_H +#define R300_VS_H #include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_dump.h" #include "r300_context.h" #include "r300_debug.h" #include "r300_reg.h" #include "r300_screen.h" +#include "r300_shader_inlines.h" /* XXX get these to r300_reg */ #define R300_PVS_DST_OPCODE(x) ((x) << 0) @@ -84,15 +86,6 @@ (R300_PVS_MODIFIER_X | R300_PVS_MODIFIER_Y | \ R300_PVS_MODIFIER_Z | R300_PVS_MODIFIER_W) -static const struct tgsi_full_src_register r300_constant_zero = { - .SrcRegister.Extended = TRUE, - .SrcRegister.File = TGSI_FILE_NULL, - .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ZERO, - .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ZERO, - .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ZERO, - .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ZERO, -}; - /* Temporary struct used to hold assembly state while putting together * fragment programs. */ struct r300_vs_asm { @@ -161,4 +154,4 @@ static struct r300_vertex_shader r300_texture_vertex_shader = { void r300_translate_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs); -#endif /* R300_STATE_TCL_H */ +#endif /* R300_VS_H */ diff --git a/src/gallium/drivers/r300/r3xx_fs.c b/src/gallium/drivers/r300/r3xx_fs.c new file mode 100644 index 00000000000..6e05d769773 --- /dev/null +++ b/src/gallium/drivers/r300/r3xx_fs.c @@ -0,0 +1,96 @@ +/* + * Copyright 2008 Corbin Simpson <[email protected]> + * Joakim Sindholt <[email protected]> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) 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 "r3xx_fs.h" + +static INLINE uint32_t r3xx_rgb_op(unsigned op) +{ + switch (op) { + case TGSI_OPCODE_MOV: + return R300_ALU_OUTC_CMP; + default: + return 0; + } +} + +static INLINE uint32_t r3xx_alpha_op(unsigned op) +{ + switch (op) { + case TGSI_OPCODE_MOV: + return R300_ALU_OUTA_CMP; + default: + return 0; + } +} + +static INLINE void r3xx_emit_maths(struct r3xx_fragment_shader* fs, + struct r300_fs_asm* assembler, + struct tgsi_full_src_register* src, + struct tgsi_full_dst_register* dst, + unsigned op, + unsigned count) +{ + int i = fs->alu_instruction_count; + + fs->instructions[i].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) | + R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) | + R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) | + r3xx_rgb_op(op); + fs->instructions[i].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | + R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ; + fs->instructions[i].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) | + R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) | + R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) | + r3xx_alpha_op(op); + fs->instructions[i].alu_alpha_addr = R300_ALPHA_ADDR0(0) | + R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT; + + fs->alu_instruction_count++; +} + +void r3xx_fs_finalize(struct r300_fragment_shader* fs, + struct r300_fs_asm* assembler) +{ + fs->stack_size = assembler->temp_count + assembler->temp_offset + 1; +} + +void r3xx_fs_instruction(struct r3xx_fragment_shader* fs, + struct r300_fs_asm* assembler, + struct tgsi_full_instruction* inst) +{ + switch (inst->Instruction.Opcode) { + case TGSI_OPCODE_MOV: + /* src0 -> src1 and src2 forced to zero */ + inst->FullSrcRegisters[1] = inst->FullSrcRegisters[0]; + inst->FullSrcRegisters[2] = r300_constant_zero; + r3xx_emit_maths(fs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3); + break; + case TGSI_OPCODE_END: + break; + default: + debug_printf("r300: fs: Bad opcode %d\n", + inst->Instruction.Opcode); + break; + } +} diff --git a/src/gallium/drivers/r300/r3xx_fs.h b/src/gallium/drivers/r300/r3xx_fs.h new file mode 100644 index 00000000000..3da39ec2526 --- /dev/null +++ b/src/gallium/drivers/r300/r3xx_fs.h @@ -0,0 +1,76 @@ +/* + * Copyright 2008 Corbin Simpson <[email protected]> + * Joakim Sindholt <[email protected]> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) 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 R3XX_FS_H +#define R3XX_FS_H + +#include "r300_fs_inlines.h" + +static struct r3xx_fragment_shader r3xx_passthrough_fragment_shader = { + .alu_instruction_count = 1, + .tex_instruction_count = 0, + .indirections = 0, + .shader.stack_size = 1, + + .instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) | + R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) | + R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) | + R300_ALU_OUTC_CMP, + .instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | + R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ, + .instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) | + R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) | + R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) | + R300_ALU_OUTA_CMP, + .instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) | + R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT, +}; + +static struct r3xx_fragment_shader r3xx_texture_fragment_shader = { + .alu_instruction_count = 1, + .tex_instruction_count = 0, + .indirections = 0, + .shader.stack_size = 1, + + .instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) | + R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) | + R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) | + R300_ALU_OUTC_CMP, + .instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | + R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ, + .instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) | + R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) | + R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) | + R300_ALU_OUTA_CMP, + .instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) | + R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT, +}; + +void r3xx_fs_finalize(struct r300_fragment_shader* fs, + struct r300_fs_asm* assembler); + +void r3xx_fs_instruction(struct r3xx_fragment_shader* fs, + struct r300_fs_asm* assembler, + struct tgsi_full_instruction* inst); + +#endif /* R3XX_FS_H */ diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r5xx_fs.c index cc7f6a7c4b0..99d826278ce 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r5xx_fs.c @@ -1,5 +1,6 @@ /* * Copyright 2008 Corbin Simpson <[email protected]> + * Joakim Sindholt <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -20,104 +21,9 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "r300_state_shader.h" +#include "r5xx_fs.h" -static void r300_fs_declare(struct r300_fs_asm* assembler, - struct tgsi_full_declaration* decl) -{ - switch (decl->Declaration.File) { - case TGSI_FILE_INPUT: - switch (decl->Semantic.SemanticName) { - case TGSI_SEMANTIC_COLOR: - assembler->color_count++; - break; - case TGSI_SEMANTIC_FOG: - case TGSI_SEMANTIC_GENERIC: - assembler->tex_count++; - break; - default: - debug_printf("r300: fs: Bad semantic declaration %d\n", - decl->Semantic.SemanticName); - break; - } - break; - case TGSI_FILE_OUTPUT: - /* Depth write. Mark the position of the output so we can - * identify it later. */ - if (decl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION) { - assembler->depth_output = decl->DeclarationRange.First; - } - break; - case TGSI_FILE_CONSTANT: - break; - case TGSI_FILE_TEMPORARY: - assembler->temp_count++; - break; - default: - debug_printf("r300: fs: Bad file %d\n", decl->Declaration.File); - break; - } - - assembler->temp_offset = assembler->color_count + assembler->tex_count; -} - -static INLINE unsigned r300_fs_src(struct r300_fs_asm* assembler, - struct tgsi_src_register* src) -{ - switch (src->File) { - case TGSI_FILE_NULL: - return 0; - case TGSI_FILE_INPUT: - /* XXX may be wrong */ - return src->Index; - break; - case TGSI_FILE_TEMPORARY: - return src->Index + assembler->temp_offset; - break; - case TGSI_FILE_IMMEDIATE: - return (src->Index + assembler->imm_offset) | (1 << 8); - break; - case TGSI_FILE_CONSTANT: - /* XXX magic */ - return src->Index | (1 << 8); - break; - default: - debug_printf("r300: fs: Unimplemented src %d\n", src->File); - break; - } - return 0; -} - -static INLINE unsigned r300_fs_dst(struct r300_fs_asm* assembler, - struct tgsi_dst_register* dst) -{ - switch (dst->File) { - case TGSI_FILE_NULL: - /* This happens during KIL instructions. */ - return 0; - break; - case TGSI_FILE_OUTPUT: - return 0; - break; - case TGSI_FILE_TEMPORARY: - return dst->Index + assembler->temp_offset; - break; - default: - debug_printf("r300: fs: Unimplemented dst %d\n", dst->File); - break; - } - return 0; -} - -static INLINE boolean r300_fs_is_depr(struct r300_fs_asm* assembler, - struct tgsi_dst_register* dst) -{ - return (assembler->writes_depth && - (dst->File == TGSI_FILE_OUTPUT) && - (dst->Index == assembler->depth_output)); -} - -static INLINE unsigned r500_fix_swiz(unsigned s) +static INLINE unsigned r5xx_fix_swiz(unsigned s) { /* For historical reasons, the swizzle values x, y, z, w, and 0 are * equivalent to the actual machine code, but 1 is not. Thus, we just @@ -129,13 +35,13 @@ static INLINE unsigned r500_fix_swiz(unsigned s) } } -static uint32_t r500_rgba_swiz(struct tgsi_full_src_register* reg) +static uint32_t r5xx_rgba_swiz(struct tgsi_full_src_register* reg) { if (reg->SrcRegister.Extended) { - return r500_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleX) | - (r500_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleY) << 3) | - (r500_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleZ) << 6) | - (r500_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleW) << 9); + return r5xx_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleX) | + (r5xx_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleY) << 3) | + (r5xx_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleZ) << 6) | + (r5xx_fix_swiz(reg->SrcRegisterExtSwz.ExtSwizzleW) << 9); } else { return reg->SrcRegister.SwizzleX | (reg->SrcRegister.SwizzleY << 3) | @@ -144,7 +50,7 @@ static uint32_t r500_rgba_swiz(struct tgsi_full_src_register* reg) } } -static uint32_t r500_strq_swiz(struct tgsi_full_src_register* reg) +static uint32_t r5xx_strq_swiz(struct tgsi_full_src_register* reg) { return reg->SrcRegister.SwizzleX | (reg->SrcRegister.SwizzleY << 2) | @@ -152,43 +58,23 @@ static uint32_t r500_strq_swiz(struct tgsi_full_src_register* reg) (reg->SrcRegister.SwizzleW << 6); } -static INLINE uint32_t r500_rgb_swiz(struct tgsi_full_src_register* reg) +static INLINE uint32_t r5xx_rgb_swiz(struct tgsi_full_src_register* reg) { /* Only the first 9 bits... */ - return (r500_rgba_swiz(reg) & 0x1ff) | + return (r5xx_rgba_swiz(reg) & 0x1ff) | (reg->SrcRegister.Negate ? (1 << 9) : 0) | (reg->SrcRegisterExtMod.Absolute ? (1 << 10) : 0); } -static INLINE uint32_t r500_alpha_swiz(struct tgsi_full_src_register* reg) +static INLINE uint32_t r5xx_alpha_swiz(struct tgsi_full_src_register* reg) { /* Only the last 3 bits... */ - return (r500_rgba_swiz(reg) >> 9) | + return (r5xx_rgba_swiz(reg) >> 9) | (reg->SrcRegister.Negate ? (1 << 9) : 0) | (reg->SrcRegisterExtMod.Absolute ? (1 << 10) : 0); } -static INLINE uint32_t r300_rgb_op(unsigned op) -{ - switch (op) { - case TGSI_OPCODE_MOV: - return R300_ALU_OUTC_CMP; - default: - return 0; - } -} - -static INLINE uint32_t r300_alpha_op(unsigned op) -{ - switch (op) { - case TGSI_OPCODE_MOV: - return R300_ALU_OUTA_CMP; - default: - return 0; - } -} - -static INLINE uint32_t r500_rgba_op(unsigned op) +static INLINE uint32_t r5xx_rgba_op(unsigned op) { switch (op) { case TGSI_OPCODE_COS: @@ -224,7 +110,7 @@ static INLINE uint32_t r500_rgba_op(unsigned op) } } -static INLINE uint32_t r500_alpha_op(unsigned op) +static INLINE uint32_t r5xx_alpha_op(unsigned op) { switch (op) { case TGSI_OPCODE_COS: @@ -264,7 +150,7 @@ static INLINE uint32_t r500_alpha_op(unsigned op) } } -static INLINE uint32_t r500_tex_op(unsigned op) +static INLINE uint32_t r5xx_tex_op(unsigned op) { switch (op) { case TGSI_OPCODE_KIL: @@ -280,33 +166,8 @@ static INLINE uint32_t r500_tex_op(unsigned op) } } -static INLINE void r300_emit_maths(struct r300_fragment_shader* fs, - struct r300_fs_asm* assembler, - struct tgsi_full_src_register* src, - struct tgsi_full_dst_register* dst, - unsigned op, - unsigned count) -{ - int i = fs->alu_instruction_count; - - fs->instructions[i].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) | - R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) | - R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) | - r300_rgb_op(op); - fs->instructions[i].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | - R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ; - fs->instructions[i].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) | - R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) | - R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) | - r300_alpha_op(op); - fs->instructions[i].alu_alpha_addr = R300_ALPHA_ADDR0(0) | - R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT; - - fs->alu_instruction_count++; -} - /* Setup an ALU operation. */ -static INLINE void r500_emit_maths(struct r500_fragment_shader* fs, +static INLINE void r5xx_emit_maths(struct r5xx_fragment_shader* fs, struct r300_fs_asm* assembler, struct tgsi_full_src_register* src, struct tgsi_full_dst_register* dst, @@ -343,9 +204,9 @@ static INLINE void r500_emit_maths(struct r500_fragment_shader* fs, R500_ALPHA_ADDR2(r300_fs_src(assembler, &src[2].SrcRegister)); fs->instructions[i].inst5 |= R500_ALU_RGBA_SEL_C_SRC2 | - R500_SWIZ_RGBA_C(r500_rgb_swiz(&src[2])) | + R500_SWIZ_RGBA_C(r5xx_rgb_swiz(&src[2])) | R500_ALU_RGBA_ALPHA_SEL_C_SRC2 | - R500_SWIZ_ALPHA_C(r500_alpha_swiz(&src[2])); + R500_SWIZ_ALPHA_C(r5xx_alpha_swiz(&src[2])); case 2: fs->instructions[i].inst1 |= R500_RGB_ADDR1(r300_fs_src(assembler, &src[1].SrcRegister)); @@ -353,10 +214,10 @@ static INLINE void r500_emit_maths(struct r500_fragment_shader* fs, R500_ALPHA_ADDR1(r300_fs_src(assembler, &src[1].SrcRegister)); fs->instructions[i].inst3 = R500_ALU_RGB_SEL_B_SRC1 | - R500_SWIZ_RGB_B(r500_rgb_swiz(&src[1])); + R500_SWIZ_RGB_B(r5xx_rgb_swiz(&src[1])); fs->instructions[i].inst4 |= R500_ALPHA_SEL_B_SRC1 | - R500_SWIZ_ALPHA_B(r500_alpha_swiz(&src[1])); + R500_SWIZ_ALPHA_B(r5xx_alpha_swiz(&src[1])); case 1: case 0: default: @@ -366,20 +227,20 @@ static INLINE void r500_emit_maths(struct r500_fragment_shader* fs, R500_ALPHA_ADDR0(r300_fs_src(assembler, &src[0].SrcRegister)); fs->instructions[i].inst3 |= R500_ALU_RGB_SEL_A_SRC0 | - R500_SWIZ_RGB_A(r500_rgb_swiz(&src[0])); + R500_SWIZ_RGB_A(r5xx_rgb_swiz(&src[0])); fs->instructions[i].inst4 |= R500_ALPHA_SEL_A_SRC0 | - R500_SWIZ_ALPHA_A(r500_alpha_swiz(&src[0])); + R500_SWIZ_ALPHA_A(r5xx_alpha_swiz(&src[0])); break; } - fs->instructions[i].inst4 |= r500_alpha_op(op); - fs->instructions[i].inst5 |= r500_rgba_op(op); + fs->instructions[i].inst4 |= r5xx_alpha_op(op); + fs->instructions[i].inst5 |= r5xx_rgba_op(op); fs->instruction_count++; } -static INLINE void r500_emit_tex(struct r500_fragment_shader* fs, +static INLINE void r5xx_emit_tex(struct r5xx_fragment_shader* fs, struct r300_fs_asm* assembler, struct tgsi_full_src_register* src, struct tgsi_full_dst_register* dst, @@ -392,10 +253,10 @@ static INLINE void r500_emit_tex(struct r500_fragment_shader* fs, R500_INST_TEX_SEM_WAIT; fs->instructions[i].inst1 = R500_TEX_ID(0) | R500_TEX_SEM_ACQUIRE | //R500_TEX_IGNORE_UNCOVERED | - r500_tex_op(op); + r5xx_tex_op(op); fs->instructions[i].inst2 = R500_TEX_SRC_ADDR(r300_fs_src(assembler, &src->SrcRegister)) | - R500_SWIZ_TEX_STRQ(r500_strq_swiz(src)) | + R500_SWIZ_TEX_STRQ(r5xx_strq_swiz(src)) | R500_TEX_DST_ADDR(r300_fs_dst(assembler, &dst->DstRegister)) | R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G | R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A; @@ -412,37 +273,24 @@ static INLINE void r500_emit_tex(struct r500_fragment_shader* fs, src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; src[1] = src[0]; - src[2] = r500_constant_zero; - r500_emit_maths(fs, assembler, src, dst, TGSI_OPCODE_MOV, 3); + src[2] = r300_constant_zero; + r5xx_emit_maths(fs, assembler, src, dst, TGSI_OPCODE_MOV, 3); } else { fs->instruction_count++; } } -static void r300_fs_instruction(struct r300_fragment_shader* fs, - struct r300_fs_asm* assembler, - struct tgsi_full_instruction* inst) +void r5xx_fs_finalize(struct r5xx_fragment_shader* fs, + struct r300_fs_asm* assembler) { - switch (inst->Instruction.Opcode) { - case TGSI_OPCODE_MOV: - /* src0 -> src1 and src2 forced to zero */ - inst->FullSrcRegisters[1] = inst->FullSrcRegisters[0]; - inst->FullSrcRegisters[2] = r500_constant_zero; - r300_emit_maths(fs, assembler, inst->FullSrcRegisters, - &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3); - break; - case TGSI_OPCODE_END: - break; - default: - debug_printf("r300: fs: Bad opcode %d\n", - inst->Instruction.Opcode); - break; - } + /* XXX should this just go with OPCODE_END? */ + fs->instructions[fs->instruction_count - 1].inst0 |= + R500_INST_LAST; } -static void r500_fs_instruction(struct r500_fragment_shader* fs, - struct r300_fs_asm* assembler, - struct tgsi_full_instruction* inst) +void r5xx_fs_instruction(struct r5xx_fragment_shader* fs, + struct r300_fs_asm* assembler, + struct tgsi_full_instruction* inst) { /* Switch between opcodes. When possible, prefer using the official * AMD/ATI names for opcodes, please, as it facilitates using the @@ -465,7 +313,7 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, case TGSI_OPCODE_DDX: case TGSI_OPCODE_DDY: case TGSI_OPCODE_FRC: - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 1); break; @@ -486,7 +334,7 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, /* Fall through */ case TGSI_OPCODE_DP3: case TGSI_OPCODE_DP4: - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 2); break; @@ -496,7 +344,7 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, inst->FullSrcRegisters[3] = inst->FullSrcRegisters[2]; inst->FullSrcRegisters[2] = inst->FullSrcRegisters[0]; inst->FullSrcRegisters[0] = inst->FullSrcRegisters[3]; - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3); break; @@ -510,18 +358,18 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, /* Force src0 to one, move all registers over */ inst->FullSrcRegisters[2] = inst->FullSrcRegisters[1]; inst->FullSrcRegisters[1] = inst->FullSrcRegisters[0]; - inst->FullSrcRegisters[0] = r500_constant_one; - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + inst->FullSrcRegisters[0] = r300_constant_one; + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3); break; case TGSI_OPCODE_MUL: /* Force our src2 to zero */ - inst->FullSrcRegisters[2] = r500_constant_zero; - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + inst->FullSrcRegisters[2] = r300_constant_zero; + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3); break; case TGSI_OPCODE_MAD: - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3); break; @@ -534,8 +382,8 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, case TGSI_OPCODE_SWZ: /* src0 -> src1 and src2 forced to zero */ inst->FullSrcRegisters[1] = inst->FullSrcRegisters[0]; - inst->FullSrcRegisters[2] = r500_constant_zero; - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + inst->FullSrcRegisters[2] = r300_constant_zero; + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3); break; @@ -550,7 +398,7 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, inst->FullDstRegisters[0].DstRegister.Index = assembler->temp_count; inst->FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], TGSI_OPCODE_MAD, 3); inst->FullSrcRegisters[2].SrcRegister.Index = assembler->temp_count; @@ -563,7 +411,7 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, inst->FullSrcRegisters[0].SrcRegister.Negate = !(inst->FullSrcRegisters[0].SrcRegister.Negate); inst->FullDstRegisters[0] = inst->FullDstRegisters[1]; - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], TGSI_OPCODE_MAD, 3); break; case TGSI_OPCODE_POW: @@ -576,7 +424,7 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, inst->FullDstRegisters[0].DstRegister.Index = assembler->temp_count; inst->FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], TGSI_OPCODE_LG2, 1); inst->FullSrcRegisters[0].SrcRegister.Index = assembler->temp_count; @@ -585,11 +433,11 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, inst->FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; inst->FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Z; inst->FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_W; - inst->FullSrcRegisters[2] = r500_constant_zero; - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + inst->FullSrcRegisters[2] = r300_constant_zero; + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], TGSI_OPCODE_MUL, 3); inst->FullDstRegisters[0] = inst->FullDstRegisters[1]; - r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + r5xx_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], TGSI_OPCODE_EX2, 1); break; @@ -598,7 +446,7 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, case TGSI_OPCODE_TEX: case TGSI_OPCODE_TXB: case TGSI_OPCODE_TXP: - r500_emit_tex(fs, assembler, &inst->FullSrcRegisters[0], + r5xx_emit_tex(fs, assembler, &inst->FullSrcRegisters[0], &inst->FullDstRegisters[0], inst->Instruction.Opcode); break; @@ -617,102 +465,3 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP; } } - -static void r300_fs_finalize(struct r3xx_fragment_shader* fs, - struct r300_fs_asm* assembler) -{ - fs->stack_size = assembler->temp_count + assembler->temp_offset + 1; -} - -static void r500_fs_finalize(struct r500_fragment_shader* fs, - struct r300_fs_asm* assembler) -{ - /* XXX should this just go with OPCODE_END? */ - fs->instructions[fs->instruction_count - 1].inst0 |= - R500_INST_LAST; -} - -void r300_translate_fragment_shader(struct r300_context* r300, - struct r3xx_fragment_shader* fs) -{ - struct tgsi_parse_context parser; - int i; - boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500; - struct r300_constant_buffer* consts = - &r300->shader_constants[PIPE_SHADER_FRAGMENT]; - - struct r300_fs_asm* assembler = CALLOC_STRUCT(r300_fs_asm); - if (assembler == NULL) { - return; - } - /* Setup starting offset for immediates. */ - assembler->imm_offset = consts->user_count; - /* Enable depth writes, if needed. */ - assembler->writes_depth = fs->info.writes_z; - - /* Make sure we start at the beginning of the shader. */ - if (is_r500) { - ((struct r500_fragment_shader*)fs)->instruction_count = 0; - } - - tgsi_parse_init(&parser, fs->state.tokens); - - while (!tgsi_parse_end_of_tokens(&parser)) { - tgsi_parse_token(&parser); - - /* This is seriously the lamest way to create fragment programs ever. - * I blame TGSI. */ - switch (parser.FullToken.Token.Type) { - case TGSI_TOKEN_TYPE_DECLARATION: - /* Allocated registers sitting at the beginning - * of the program. */ - r300_fs_declare(assembler, &parser.FullToken.FullDeclaration); - break; - case TGSI_TOKEN_TYPE_IMMEDIATE: - debug_printf("r300: Emitting immediate to constant buffer, " - "position %d\n", - assembler->imm_offset + assembler->imm_count); - /* I am not amused by the length of these. */ - for (i = 0; i < 4; i++) { - consts->constants[assembler->imm_offset + - assembler->imm_count][i] = - parser.FullToken.FullImmediate.u.ImmediateFloat32[i] - .Float; - } - assembler->imm_count++; - break; - case TGSI_TOKEN_TYPE_INSTRUCTION: - if (is_r500) { - r500_fs_instruction((struct r500_fragment_shader*)fs, - assembler, &parser.FullToken.FullInstruction); - } else { - r300_fs_instruction((struct r300_fragment_shader*)fs, - assembler, &parser.FullToken.FullInstruction); - } - break; - } - } - - debug_printf("r300: fs: %d texs and %d colors, first free reg is %d\n", - assembler->tex_count, assembler->color_count, - assembler->tex_count + assembler->color_count); - - consts->count = consts->user_count + assembler->imm_count; - fs->uses_imms = assembler->imm_count; - debug_printf("r300: fs: %d total constants, " - "%d from user and %d from immediates\n", consts->count, - consts->user_count, assembler->imm_count); - r300_fs_finalize(fs, assembler); - if (is_r500) { - r500_fs_finalize((struct r500_fragment_shader*)fs, assembler); - } - - tgsi_dump(fs->state.tokens); - /* XXX finish r300 dumper too */ - if (is_r500) { - r500_fs_dump((struct r500_fragment_shader*)fs); - } - - tgsi_parse_free(&parser); - FREE(assembler); -} diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r5xx_fs.h index b6087404cef..629e587be4d 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r5xx_fs.h @@ -1,5 +1,6 @@ /* * Copyright 2008 Corbin Simpson <[email protected]> + * Joakim Sindholt <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -20,15 +21,10 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef R300_STATE_SHADER_H -#define R300_STATE_SHADER_H +#ifndef R5XX_FS_H +#define R5XX_FS_H -#include "tgsi/tgsi_parse.h" - -#include "r300_context.h" -#include "r300_debug.h" -#include "r300_reg.h" -#include "r300_screen.h" +#include "r300_fs_inlines.h" /* XXX this all should find its way back to r300_reg */ /* Swizzle tools */ @@ -59,78 +55,7 @@ #define R500_ALU_OMASK(x) ((x) << 15) #define R500_W_OMASK (1 << 31) -/* TGSI constants. TGSI is like XML: If it can't solve your problems, you're - * not using enough of it. */ -static const struct tgsi_full_src_register r500_constant_zero = { - .SrcRegister.Extended = TRUE, - .SrcRegister.File = TGSI_FILE_NULL, - .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ZERO, - .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ZERO, - .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ZERO, - .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ZERO, -}; - -static const struct tgsi_full_src_register r500_constant_one = { - .SrcRegister.Extended = TRUE, - .SrcRegister.File = TGSI_FILE_NULL, - .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ONE, - .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ONE, - .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ONE, - .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ONE, -}; - -/* Temporary struct used to hold assembly state while putting together - * fragment programs. */ -struct r300_fs_asm { - /* Pipe context. */ - struct r300_context* r300; - /* Number of colors. */ - unsigned color_count; - /* Number of texcoords. */ - unsigned tex_count; - /* Offset for temporary registers. Inputs and temporaries have no - * distinguishing markings, so inputs start at 0 and the first usable - * temporary register is after all inputs. */ - unsigned temp_offset; - /* Number of requested temporary registers. */ - unsigned temp_count; - /* Offset for immediate constants. Neither R300 nor R500 can do four - * inline constants per source, so instead we copy immediates into the - * constant buffer. */ - unsigned imm_offset; - /* Number of immediate constants. */ - unsigned imm_count; - /* Are depth writes enabled? */ - boolean writes_depth; - /* Depth write offset. This is the TGSI output that corresponds to - * depth writes. */ - unsigned depth_output; -}; - -void r300_translate_fragment_shader(struct r300_context* r300, - struct r3xx_fragment_shader* fs); - -static struct r300_fragment_shader r300_passthrough_fragment_shader = { - .alu_instruction_count = 1, - .tex_instruction_count = 0, - .indirections = 0, - .shader.stack_size = 1, - - .instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) | - R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) | - R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) | - R300_ALU_OUTC_CMP, - .instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | - R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ, - .instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) | - R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) | - R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) | - R300_ALU_OUTA_CMP, - .instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) | - R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT, -}; - -static struct r500_fragment_shader r500_passthrough_fragment_shader = { +static struct r5xx_fragment_shader r5xx_passthrough_fragment_shader = { .shader.stack_size = 0, .instruction_count = 1, .instructions[0].inst0 = R500_INST_TYPE_OUT | @@ -156,27 +81,7 @@ static struct r500_fragment_shader r500_passthrough_fragment_shader = { R500_ALU_RGBA_A_SWIZ_0, }; -static struct r300_fragment_shader r300_texture_fragment_shader = { - .alu_instruction_count = 1, - .tex_instruction_count = 0, - .indirections = 0, - .shader.stack_size = 1, - - .instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) | - R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) | - R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) | - R300_ALU_OUTC_CMP, - .instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | - R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ, - .instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) | - R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) | - R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) | - R300_ALU_OUTA_CMP, - .instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) | - R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT, -}; - -static struct r500_fragment_shader r500_texture_fragment_shader = { +static struct r5xx_fragment_shader r5xx_texture_fragment_shader = { .shader.stack_size = 1, .instruction_count = 2, .instructions[0].inst0 = R500_INST_TYPE_TEX | @@ -217,4 +122,11 @@ static struct r500_fragment_shader r500_texture_fragment_shader = { R500_ALU_RGBA_A_SWIZ_0, }; -#endif /* R300_STATE_SHADER_H */ +void r5xx_fs_finalize(struct r5xx_fragment_shader* fs, + struct r300_fs_asm* assembler); + +void r5xx_fs_instruction(struct r5xx_fragment_shader* fs, + struct r300_fs_asm* assembler, + struct tgsi_full_instruction* inst); + +#endif /* R5XX_FS_H */ diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 62e8d99cfd0..86df320ea8a 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -126,6 +126,22 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, struct pipe_texture *texture, unsigned face, unsigned level) { + struct softpipe_context *softpipe = softpipe_context( pipe ); + unsigned i; + + if(softpipe->dirty_render_cache) { + for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { + if(softpipe->framebuffer.cbufs[i] && + softpipe->framebuffer.cbufs[i]->texture == texture) + return PIPE_REFERENCED_FOR_WRITE; + } + if(softpipe->framebuffer.zsbuf && + softpipe->framebuffer.zsbuf->texture == texture) + return PIPE_REFERENCED_FOR_WRITE; + } + + /* FIXME: we also need to do the same for the texture cache */ + return PIPE_UNREFERENCED; } diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index b89a7292e5b..7888c2f644b 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -145,6 +145,8 @@ struct softpipe_context { struct draw_stage *vbuf; struct softpipe_vbuf_render *vbuf_render; + boolean dirty_render_cache; + struct softpipe_tile_cache *cbuf_cache[PIPE_MAX_COLOR_BUFS]; struct softpipe_tile_cache *zsbuf_cache; diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c index f117096bf73..d4045816d03 100644 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@ -35,6 +35,7 @@ #include "pipe/p_context.h" #include "pipe/internal/p_winsys_screen.h" #include "pipe/p_inlines.h" +#include "util/u_prim.h" #include "sp_context.h" #include "sp_state.h" @@ -65,6 +66,7 @@ softpipe_map_constant_buffers(struct softpipe_context *sp) size); } + static void softpipe_unmap_constant_buffers(struct softpipe_context *sp) { @@ -86,20 +88,6 @@ softpipe_unmap_constant_buffers(struct softpipe_context *sp) } -static unsigned reduced_prim[PIPE_PRIM_POLYGON + 1] = { - PIPE_PRIM_POINTS, - PIPE_PRIM_LINES, - PIPE_PRIM_LINES, - PIPE_PRIM_LINES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES -}; - - boolean softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) @@ -108,15 +96,11 @@ softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode, } - /** * Draw vertex arrays, with optional indexing. * Basically, map the vertex buffers (and drawing surfaces), then hand off * the drawing to the 'draw' module. - * - * XXX should the element buffer be specified/bound with a separate function? */ - boolean softpipe_draw_range_elements(struct pipe_context *pipe, struct pipe_buffer *indexBuffer, @@ -129,7 +113,7 @@ softpipe_draw_range_elements(struct pipe_context *pipe, struct draw_context *draw = sp->draw; unsigned i; - sp->reduced_api_prim = reduced_prim[mode]; + sp->reduced_api_prim = u_reduced_prim(mode); if (sp->dirty) softpipe_update_derived( sp ); @@ -147,6 +131,7 @@ softpipe_draw_range_elements(struct pipe_context *pipe, PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_vertex_buffer(draw, i, buf); } + /* Map index buffer, if present */ if (indexBuffer) { void *mapped_indexes @@ -159,10 +144,10 @@ softpipe_draw_range_elements(struct pipe_context *pipe, } else { /* no index/element buffer */ - draw_set_mapped_element_buffer_range(draw, 0, start, start + count - 1, NULL); + draw_set_mapped_element_buffer_range(draw, 0, start, + start + count - 1, NULL); } - /* draw! */ draw_arrays(draw, mode, start, count); @@ -182,9 +167,12 @@ softpipe_draw_range_elements(struct pipe_context *pipe, /* Note: leave drawing surfaces mapped */ softpipe_unmap_constant_buffers(sp); + sp->dirty_render_cache = TRUE; + return TRUE; } + boolean softpipe_draw_elements(struct pipe_context *pipe, struct pipe_buffer *indexBuffer, @@ -198,11 +186,9 @@ softpipe_draw_elements(struct pipe_context *pipe, } - void softpipe_set_edgeflags(struct pipe_context *pipe, const unsigned *edgeflags) { struct softpipe_context *sp = softpipe_context(pipe); draw_set_edgeflags(sp->draw, edgeflags); } - diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index 035f4b963eb..4a14d49686e 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -71,6 +71,8 @@ softpipe_flush( struct pipe_context *pipe, * to unmap surfaces when flushing. */ softpipe_unmap_transfers(softpipe); + + softpipe->dirty_render_cache = FALSE; } /* Enable to dump BMPs of the color/depth buffers each frame */ diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 06725fd09b4..42021789ea8 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -238,65 +238,117 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) case PIPE_PRIM_TRIANGLES: for (i = 2; i < nr; i += 3) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, indices[i-2], stride), - get_vert(vertex_buffer, indices[i-1], stride), - get_vert(vertex_buffer, indices[i-0], stride)); + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-1], stride), + get_vert(vertex_buffer, indices[i-0], stride), + get_vert(vertex_buffer, indices[i-2], stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-2], stride), + get_vert(vertex_buffer, indices[i-1], stride), + get_vert(vertex_buffer, indices[i-0], stride) ); + } } break; case PIPE_PRIM_TRIANGLE_STRIP: for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, indices[i+(i&1)-2], stride), - get_vert(vertex_buffer, indices[i-(i&1)-1], stride), - get_vert(vertex_buffer, indices[i-0], stride)); + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i+(i&1)-1], stride), + get_vert(vertex_buffer, indices[i-(i&1)], stride), + get_vert(vertex_buffer, indices[i-2], stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i+(i&1)-2], stride), + get_vert(vertex_buffer, indices[i-(i&1)-1], stride), + get_vert(vertex_buffer, indices[i-0], stride) ); + } } break; case PIPE_PRIM_TRIANGLE_FAN: for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, indices[0], stride), - get_vert(vertex_buffer, indices[i-1], stride), - get_vert(vertex_buffer, indices[i-0], stride)); + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-0], stride), + get_vert(vertex_buffer, indices[0], stride), + get_vert(vertex_buffer, indices[i-1], stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[0], stride), + get_vert(vertex_buffer, indices[i-1], stride), + get_vert(vertex_buffer, indices[i-0], stride) ); + } } break; case PIPE_PRIM_QUADS: for (i = 3; i < nr; i += 4) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, indices[i-3], stride), - get_vert(vertex_buffer, indices[i-2], stride), - get_vert(vertex_buffer, indices[i-0], stride)); - - setup_tri( setup_ctx, - get_vert(vertex_buffer, indices[i-2], stride), - get_vert(vertex_buffer, indices[i-1], stride), - get_vert(vertex_buffer, indices[i-0], stride)); + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-2], stride), + get_vert(vertex_buffer, indices[i-1], stride), + get_vert(vertex_buffer, indices[i-3], stride) ); + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-1], stride), + get_vert(vertex_buffer, indices[i-0], stride), + get_vert(vertex_buffer, indices[i-3], stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-3], stride), + get_vert(vertex_buffer, indices[i-2], stride), + get_vert(vertex_buffer, indices[i-0], stride) ); + + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-2], stride), + get_vert(vertex_buffer, indices[i-1], stride), + get_vert(vertex_buffer, indices[i-0], stride) ); + } } break; case PIPE_PRIM_QUAD_STRIP: for (i = 3; i < nr; i += 2) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, indices[i-3], stride), - get_vert(vertex_buffer, indices[i-2], stride), - get_vert(vertex_buffer, indices[i-0], stride)); - - setup_tri( setup_ctx, - get_vert(vertex_buffer, indices[i-1], stride), - get_vert(vertex_buffer, indices[i-3], stride), - get_vert(vertex_buffer, indices[i-0], stride)); + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-0], stride), + get_vert(vertex_buffer, indices[i-1], stride), + get_vert(vertex_buffer, indices[i-3], stride)); + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-2], stride), + get_vert(vertex_buffer, indices[i-0], stride), + get_vert(vertex_buffer, indices[i-3], stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-3], stride), + get_vert(vertex_buffer, indices[i-2], stride), + get_vert(vertex_buffer, indices[i-0], stride) ); + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[i-1], stride), + get_vert(vertex_buffer, indices[i-3], stride), + get_vert(vertex_buffer, indices[i-0], stride) ); + } } break; case PIPE_PRIM_POLYGON: + /* Almost same as tri fan but the _first_ vertex specifies the flat + * shading color. Note that the first polygon vertex is passed as + * the last triangle vertex here. + * flatshade_first state makes no difference. + */ for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, - get_vert(vertex_buffer, indices[0-1], stride), get_vert(vertex_buffer, indices[i-0], stride), - get_vert(vertex_buffer, indices[0], stride)); + get_vert(vertex_buffer, indices[i-1], stride), + get_vert(vertex_buffer, indices[0], stride) ); } break; @@ -368,58 +420,104 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; - case PIPE_PRIM_TRIANGLES: for (i = 2; i < nr; i += 3) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, i-2, stride), - get_vert(vertex_buffer, i-1, stride), - get_vert(vertex_buffer, i-0, stride)); + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-0, stride), + get_vert(vertex_buffer, i-2, stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-2, stride), + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-0, stride) ); + } } break; case PIPE_PRIM_TRIANGLE_STRIP: - for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, i+(i&1)-2, stride), - get_vert(vertex_buffer, i-(i&1)-1, stride), - get_vert(vertex_buffer, i-0, stride)); + for (i = 2; i < nr; i++) { + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i+(i&1)-1, stride), + get_vert(vertex_buffer, i-(i&1), stride), + get_vert(vertex_buffer, i-2, stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i+(i&1)-2, stride), + get_vert(vertex_buffer, i-(i&1)-1, stride), + get_vert(vertex_buffer, i-0, stride) ); + } } break; case PIPE_PRIM_TRIANGLE_FAN: for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, 0, stride), - get_vert(vertex_buffer, i-1, stride), - get_vert(vertex_buffer, i-0, stride)); + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-0, stride), + get_vert(vertex_buffer, 0, stride), + get_vert(vertex_buffer, i-1, stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, 0, stride), + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-0, stride) ); + } } break; case PIPE_PRIM_QUADS: for (i = 3; i < nr; i += 4) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, i-3, stride), - get_vert(vertex_buffer, i-2, stride), - get_vert(vertex_buffer, i-0, stride)); - - setup_tri( setup_ctx, - get_vert(vertex_buffer, i-2, stride), - get_vert(vertex_buffer, i-1, stride), - get_vert(vertex_buffer, i-0, stride)); + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-2, stride), + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-3, stride) ); + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-0, stride), + get_vert(vertex_buffer, i-3, stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-3, stride), + get_vert(vertex_buffer, i-2, stride), + get_vert(vertex_buffer, i-0, stride) ); + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-2, stride), + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-0, stride) ); + } } break; + case PIPE_PRIM_QUAD_STRIP: for (i = 3; i < nr; i += 2) { - setup_tri( setup_ctx, - get_vert(vertex_buffer, i-3, stride), - get_vert(vertex_buffer, i-2, stride), - get_vert(vertex_buffer, i-0, stride)); - - setup_tri( setup_ctx, - get_vert(vertex_buffer, i-1, stride), - get_vert(vertex_buffer, i-3, stride), - get_vert(vertex_buffer, i-0, stride)); + if (softpipe->rasterizer->flatshade_first) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-0, stride), + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-3, stride) ); + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-2, stride), + get_vert(vertex_buffer, i-0, stride), + get_vert(vertex_buffer, i-3, stride) ); + } + else { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-3, stride), + get_vert(vertex_buffer, i-2, stride), + get_vert(vertex_buffer, i-0, stride) ); + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-3, stride), + get_vert(vertex_buffer, i-0, stride) ); + } } break; @@ -427,12 +525,13 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) /* Almost same as tri fan but the _first_ vertex specifies the flat * shading color. Note that the first polygon vertex is passed as * the last triangle vertex here. + * flatshade_first state makes no difference. */ for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride), - get_vert(vertex_buffer, 0, stride)); + get_vert(vertex_buffer, 0, stride) ); } break; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 692deeb8fd3..6178c4ac7e3 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -87,6 +87,10 @@ softpipe_get_param(struct pipe_screen *screen, int param) return 8; /* max 128x128x128 */ case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return 13; /* max 4Kx4K */ + case PIPE_CAP_TGSI_CONT_SUPPORTED: + return 1; + case PIPE_CAP_BLEND_EQUATION_SEPARATE: + return 1; default: return 0; } diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index c6844a26498..de3ae3c3696 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -444,7 +444,8 @@ static void flush_spans( struct setup_context *setup ) mask |= MASK_TOP_RIGHT; if (x+1 >= xleft1 && x+1 < xright1) mask |= MASK_BOTTOM_RIGHT; - EMIT_QUAD( setup, x, setup->span.y, mask ); + if (mask) + EMIT_QUAD( setup, x, setup->span.y, mask ); } break; @@ -458,7 +459,8 @@ static void flush_spans( struct setup_context *setup ) mask |= MASK_TOP_LEFT; if (x+1 >= xleft0 && x+1 < xright0) mask |= MASK_TOP_RIGHT; - EMIT_QUAD( setup, x, setup->span.y, mask ); + if (mask) + EMIT_QUAD( setup, x, setup->span.y, mask ); } break; @@ -472,7 +474,8 @@ static void flush_spans( struct setup_context *setup ) mask |= MASK_BOTTOM_LEFT; if (x+1 >= xleft1 && x+1 < xright1) mask |= MASK_BOTTOM_RIGHT; - EMIT_QUAD( setup, x, setup->span.y, mask ); + if (mask) + EMIT_QUAD( setup, x, setup->span.y, mask ); } break; @@ -784,11 +787,10 @@ static void setup_tri_coefficients( struct setup_context *setup ) assert(0); } - if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) { - /* FOG.y = front/back facing XXX fix this */ - setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing; - setup->coef[fragSlot].dadx[1] = 0.0; - setup->coef[fragSlot].dady[1] = 0.0; + if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { + setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing; + setup->coef[fragSlot].dadx[0] = 0.0; + setup->coef[fragSlot].dady[0] = 0.0; } } } @@ -1051,7 +1053,10 @@ setup_line_coefficients(struct setup_context *setup, float area; /* use setup->vmin, vmax to point to vertices */ - setup->vprovoke = v1; + if (softpipe->rasterizer->flatshade_first) + setup->vprovoke = v0; + else + setup->vprovoke = v1; setup->vmin = v0; setup->vmax = v1; @@ -1095,11 +1100,10 @@ setup_line_coefficients(struct setup_context *setup, assert(0); } - if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) { - /* FOG.y = front/back facing XXX fix this */ - setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing; - setup->coef[fragSlot].dadx[1] = 0.0; - setup->coef[fragSlot].dady[1] = 0.0; + if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { + setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing; + setup->coef[fragSlot].dadx[0] = 0.0; + setup->coef[fragSlot].dady[0] = 0.0; } } return TRUE; @@ -1341,11 +1345,10 @@ setup_point( struct setup_context *setup, assert(0); } - if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) { - /* FOG.y = front/back facing XXX fix this */ - setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing; - setup->coef[fragSlot].dadx[1] = 0.0; - setup->coef[fragSlot].dady[1] = 0.0; + if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { + setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing; + setup->coef[fragSlot].dadx[0] = 0.0; + setup->coef[fragSlot].dady[0] = 0.0; } } diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 6b6a4c3ff34..75551000c9b 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -110,6 +110,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) break; case TGSI_SEMANTIC_GENERIC: + case TGSI_SEMANTIC_FACE: /* this includes texcoords and varying vars */ src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC, spfs->info.input_semantic_index[i]); diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index adbd0cb7f0c..a1d3bade27a 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -705,15 +705,18 @@ get_texel(const struct tgsi_sampler *tgsi_sampler, * Compare texcoord 'p' (aka R) against texture value 'rgba[0]' * When we sampled the depth texture, the depth value was put into all * RGBA channels. We look at the red channel here. + * \param rgba quad of (depth) texel values + * \param p texture 'P' components for four pixels in quad + * \param j which pixel in the quad to test [0..3] */ static INLINE void -shadow_compare(uint compare_func, +shadow_compare(const struct pipe_sampler_state *sampler, float rgba[NUM_CHANNELS][QUAD_SIZE], const float p[QUAD_SIZE], uint j) { int k; - switch (compare_func) { + switch (sampler->compare_func) { case PIPE_FUNC_LESS: k = p[j] < rgba[0][j]; break; @@ -744,7 +747,81 @@ shadow_compare(uint compare_func, break; } + /* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */ rgba[0][j] = rgba[1][j] = rgba[2][j] = (float) k; + rgba[3][j] = 1.0F; +} + + +/** + * As above, but do four z/texture comparisons. + */ +static INLINE void +shadow_compare4(const struct pipe_sampler_state *sampler, + float rgba[NUM_CHANNELS][QUAD_SIZE], + const float p[QUAD_SIZE]) +{ + int j, k0, k1, k2, k3; + float val; + + /* compare four texcoords vs. four texture samples */ + switch (sampler->compare_func) { + case PIPE_FUNC_LESS: + k0 = p[0] < rgba[0][0]; + k1 = p[1] < rgba[0][1]; + k2 = p[2] < rgba[0][2]; + k3 = p[3] < rgba[0][3]; + break; + case PIPE_FUNC_LEQUAL: + k0 = p[0] <= rgba[0][0]; + k1 = p[1] <= rgba[0][1]; + k2 = p[2] <= rgba[0][2]; + k3 = p[3] <= rgba[0][3]; + break; + case PIPE_FUNC_GREATER: + k0 = p[0] > rgba[0][0]; + k1 = p[1] > rgba[0][1]; + k2 = p[2] > rgba[0][2]; + k3 = p[3] > rgba[0][3]; + break; + case PIPE_FUNC_GEQUAL: + k0 = p[0] >= rgba[0][0]; + k1 = p[1] >= rgba[0][1]; + k2 = p[2] >= rgba[0][2]; + k3 = p[3] >= rgba[0][3]; + break; + case PIPE_FUNC_EQUAL: + k0 = p[0] == rgba[0][0]; + k1 = p[1] == rgba[0][1]; + k2 = p[2] == rgba[0][2]; + k3 = p[3] == rgba[0][3]; + break; + case PIPE_FUNC_NOTEQUAL: + k0 = p[0] != rgba[0][0]; + k1 = p[1] != rgba[0][1]; + k2 = p[2] != rgba[0][2]; + k3 = p[3] != rgba[0][3]; + break; + case PIPE_FUNC_ALWAYS: + k0 = k1 = k2 = k3 = 1; + break; + case PIPE_FUNC_NEVER: + k0 = k1 = k2 = k3 = 0; + break; + default: + k0 = k1 = k2 = k3 = 0; + assert(0); + break; + } + + /* convert four pass/fail values to an intensity in [0,1] */ + val = 0.25F * (k0 + k1 + k2 + k3); + + /* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */ + for (j = 0; j < 4; j++) { + rgba[0][j] = rgba[1][j] = rgba[2][j] = val; + rgba[3][j] = 1.0F; + } } @@ -767,7 +844,6 @@ sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, const uint unit = samp->unit; const struct pipe_texture *texture = sp->texture[unit]; const struct pipe_sampler_state *sampler = sp->sampler[unit]; - const uint compare_func = sampler->compare_func; unsigned level0, level1, j, imgFilter; int width, height; float levelBlend; @@ -792,7 +868,7 @@ sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, for (j = 0; j < QUAD_SIZE; j++) { get_texel(tgsi_sampler, faces[j], level0, x[j], y[j], 0, rgba, j); if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - shadow_compare(compare_func, rgba, p, j); + shadow_compare(sampler, rgba, p, j); } if (level0 != level1) { @@ -804,7 +880,7 @@ sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, get_texel(tgsi_sampler, faces[j], level1, x[j], y[j], 0, rgba2, j); if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE){ - shadow_compare(compare_func, rgba2, p, j); + shadow_compare(sampler, rgba2, p, j); } for (c = 0; c < NUM_CHANNELS; c++) { @@ -831,10 +907,7 @@ sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, get_texel(tgsi_sampler, faces[j], level0, x0[j], y1[j], 0, tx, 2); get_texel(tgsi_sampler, faces[j], level0, x1[j], y1[j], 0, tx, 3); if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - shadow_compare(compare_func, tx, p, 0); - shadow_compare(compare_func, tx, p, 1); - shadow_compare(compare_func, tx, p, 2); - shadow_compare(compare_func, tx, p, 3); + shadow_compare4(sampler, tx, p); } /* interpolate R, G, B, A */ @@ -856,10 +929,7 @@ sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, get_texel(tgsi_sampler, faces[j], level1, x0[j], y1[j], 0, tx, 2); get_texel(tgsi_sampler, faces[j], level1, x1[j], y1[j], 0, tx, 3); if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE){ - shadow_compare(compare_func, tx, p, 0); - shadow_compare(compare_func, tx, p, 1); - shadow_compare(compare_func, tx, p, 2); - shadow_compare(compare_func, tx, p, 3); + shadow_compare4(sampler, tx, p); } /* interpolate R, G, B, A */ @@ -1074,7 +1144,6 @@ sp_get_samples_rect(const struct tgsi_sampler *tgsi_sampler, const struct pipe_texture *texture = sp->texture[unit]; const struct pipe_sampler_state *sampler = sp->sampler[unit]; const uint face = 0; - const uint compare_func = sampler->compare_func; unsigned level0, level1, j, imgFilter; int width, height; float levelBlend; @@ -1099,7 +1168,7 @@ sp_get_samples_rect(const struct tgsi_sampler *tgsi_sampler, for (j = 0; j < QUAD_SIZE; j++) { get_texel(tgsi_sampler, face, level0, x[j], y[j], 0, rgba, j); if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - shadow_compare(compare_func, rgba, p, j); + shadow_compare(sampler, rgba, p, j); } } } @@ -1119,10 +1188,7 @@ sp_get_samples_rect(const struct tgsi_sampler *tgsi_sampler, get_texel(tgsi_sampler, face, level0, x0[j], y1[j], 0, tx, 2); get_texel(tgsi_sampler, face, level0, x1[j], y1[j], 0, tx, 3); if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - shadow_compare(compare_func, tx, p, 0); - shadow_compare(compare_func, tx, p, 1); - shadow_compare(compare_func, tx, p, 2); - shadow_compare(compare_func, tx, p, 3); + shadow_compare4(sampler, tx, p); } for (c = 0; c < 4; c++) { rgba[c][j] = lerp_2d(xw[j], yw[j], diff --git a/src/gallium/drivers/trace/Makefile b/src/gallium/drivers/trace/Makefile index 4aeb8e3d7ed..dd6831c70ab 100644 --- a/src/gallium/drivers/trace/Makefile +++ b/src/gallium/drivers/trace/Makefile @@ -11,6 +11,7 @@ C_SOURCES = \ tr_screen.c \ tr_state.c \ tr_rbug.c \ + tr_drm.c \ tr_texture.c include ../../Makefile.template diff --git a/src/gallium/drivers/trace/tr_drm.c b/src/gallium/drivers/trace/tr_drm.c new file mode 100644 index 00000000000..98ac75e3fa3 --- /dev/null +++ b/src/gallium/drivers/trace/tr_drm.c @@ -0,0 +1,211 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 "state_tracker/drm_api.h" + +#include "util/u_memory.h" +#include "trace/tr_drm.h" +#include "trace/tr_screen.h" +#include "trace/tr_context.h" +#include "trace/tr_buffer.h" +#include "trace/tr_texture.h" + +struct trace_drm_api +{ + struct drm_api base; + + struct drm_api *api; +}; + +static INLINE struct trace_drm_api * +trace_drm_api(struct drm_api *_api) +{ + return (struct trace_drm_api *)_api; +} + +static struct pipe_screen * +trace_drm_create_screen(struct drm_api *_api, int fd, + struct drm_create_screen_arg *arg) +{ + struct trace_drm_api *tr_api = trace_drm_api(_api); + struct drm_api *api = tr_api->api; + struct pipe_screen *screen; + + /* TODO trace call */ + + if (arg && arg->mode != DRM_CREATE_NORMAL) + return NULL; + + screen = api->create_screen(api, fd, arg); + + return trace_screen_create(screen); +}; + +static struct pipe_context * +trace_drm_create_context(struct drm_api *_api, + struct pipe_screen *_screen) +{ + struct trace_screen *tr_screen = trace_screen(_screen); + struct trace_drm_api *tr_api = trace_drm_api(_api); + struct pipe_screen *screen = tr_screen->screen; + struct drm_api *api = tr_api->api; + struct pipe_context *pipe; + + /* TODO trace call */ + + pipe = api->create_context(api, screen); + + pipe = trace_context_create(_screen, pipe); + + return pipe; +}; + +static boolean +trace_drm_buffer_from_texture(struct drm_api *_api, + struct pipe_texture *_texture, + struct pipe_buffer **_buffer, + unsigned *stride) +{ + struct trace_texture *tr_texture = trace_texture(_texture); + struct trace_drm_api *tr_api = trace_drm_api(_api); + struct pipe_texture *texture = tr_texture->texture; + struct drm_api *api = tr_api->api; + struct pipe_buffer *buffer = NULL; + boolean result; + + /* TODO trace call */ + + result = api->buffer_from_texture(api, texture, &buffer, stride); + + if (result && _buffer) + buffer = trace_buffer_create(trace_screen(texture->screen), buffer); + + if (_buffer) + *_buffer = buffer; + else + pipe_buffer_reference(&buffer, NULL); + + return result; +} + +static struct pipe_buffer * +trace_drm_buffer_from_handle(struct drm_api *_api, + struct pipe_screen *_screen, + const char *name, + unsigned handle) +{ + struct trace_screen *tr_screen = trace_screen(_screen); + struct trace_drm_api *tr_api = trace_drm_api(_api); + struct pipe_screen *screen = tr_screen->screen; + struct drm_api *api = tr_api->api; + struct pipe_buffer *result; + + /* TODO trace call */ + + result = api->buffer_from_handle(api, screen, name, handle); + + result = trace_buffer_create(trace_screen(_screen), result); + + return result; +} + +static boolean +trace_drm_handle_from_buffer(struct drm_api *_api, + struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned *handle) +{ + struct trace_screen *tr_screen = trace_screen(_screen); + struct trace_buffer *tr_buffer = trace_buffer(_buffer); + struct trace_drm_api *tr_api = trace_drm_api(_api); + struct pipe_screen *screen = tr_screen->screen; + struct pipe_buffer *buffer = tr_buffer->buffer; + struct drm_api *api = tr_api->api; + + /* TODO trace call */ + + return api->handle_from_buffer(api, screen, buffer, handle); +} + +static boolean +trace_drm_global_handle_from_buffer(struct drm_api *_api, + struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned *handle) +{ + struct trace_screen *tr_screen = trace_screen(_screen); + struct trace_buffer *tr_buffer = trace_buffer(_buffer); + struct trace_drm_api *tr_api = trace_drm_api(_api); + struct pipe_screen *screen = tr_screen->screen; + struct pipe_buffer *buffer = tr_buffer->buffer; + struct drm_api *api = tr_api->api; + + /* TODO trace call */ + + return api->global_handle_from_buffer(api, screen, buffer, handle); +} + +static void +trace_drm_destroy(struct drm_api *_api) +{ + struct trace_drm_api *tr_api = trace_drm_api(_api); + struct drm_api *api = tr_api->api; + api->destroy(api); + + free(tr_api); +} + +struct drm_api * +trace_drm_create(struct drm_api *api) +{ + struct trace_drm_api *tr_api; + + if (!api) + goto error; + + if (!trace_enabled()) + goto error; + + tr_api = CALLOC_STRUCT(trace_drm_api); + + if (!tr_api) + goto error; + + tr_api->base.create_screen = trace_drm_create_screen; + tr_api->base.create_context = trace_drm_create_context; + tr_api->base.buffer_from_texture = trace_drm_buffer_from_texture; + tr_api->base.buffer_from_handle = trace_drm_buffer_from_handle; + tr_api->base.handle_from_buffer = trace_drm_handle_from_buffer; + tr_api->base.global_handle_from_buffer = trace_drm_global_handle_from_buffer; + tr_api->base.destroy = trace_drm_destroy; + tr_api->api = api; + + return &tr_api->base; + +error: + return api; +} diff --git a/src/gallium/drivers/trace/tr_drm.h b/src/gallium/drivers/trace/tr_drm.h new file mode 100644 index 00000000000..845c66a32aa --- /dev/null +++ b/src/gallium/drivers/trace/tr_drm.h @@ -0,0 +1,35 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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 TR_DRM_H +#define TR_DRM_H + +struct drm_api; + +struct drm_api* trace_drm_create(struct drm_api *api); + +#endif /* ID_DRM_H */ diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index 3a1409e95a7..643587ab427 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -451,11 +451,11 @@ void trace_dump_float(double value) } void trace_dump_bytes(const void *data, - long unsigned size) + size_t size) { static const char hex_table[16] = "0123456789ABCDEF"; const uint8_t *p = data; - long unsigned i; + size_t i; if (!dumping) return; diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h index 31ac70802f0..32592bab12f 100644 --- a/src/gallium/drivers/trace/tr_dump.h +++ b/src/gallium/drivers/trace/tr_dump.h @@ -91,7 +91,7 @@ void trace_dump_bool(int value); void trace_dump_int(long long int value); void trace_dump_uint(long long unsigned value); void trace_dump_float(double value); -void trace_dump_bytes(const void *data, long unsigned size); +void trace_dump_bytes(const void *data, size_t size); void trace_dump_string(const char *str); void trace_dump_enum(const char *value); void trace_dump_array_begin(void); @@ -130,7 +130,7 @@ void trace_dump_transfer_ptr(struct pipe_transfer *_transfer); #define trace_dump_array(_type, _obj, _size) \ do { \ - unsigned long idx; \ + size_t idx; \ trace_dump_array_begin(); \ for(idx = 0; idx < (_size); ++idx) { \ trace_dump_elem_begin(); \ @@ -142,7 +142,7 @@ void trace_dump_transfer_ptr(struct pipe_transfer *_transfer); #define trace_dump_struct_array(_type, _obj, _size) \ do { \ - unsigned long idx; \ + size_t idx; \ trace_dump_array_begin(); \ for(idx = 0; idx < (_size); ++idx) { \ trace_dump_elem_begin(); \ diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index 23a2473b574..bcf6751af4f 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -36,12 +36,18 @@ void trace_dump_format(enum pipe_format format) { + if (!trace_dumping_enabled_locked()) + return; + trace_dump_enum(pf_name(format) ); } void trace_dump_block(const struct pipe_format_block *block) { + if (!trace_dumping_enabled_locked()) + return; + trace_dump_struct_begin("pipe_format_block"); trace_dump_member(uint, block, size); trace_dump_member(uint, block, width); @@ -52,6 +58,9 @@ void trace_dump_block(const struct pipe_format_block *block) static void trace_dump_reference(const struct pipe_reference *reference) { + if (!trace_dumping_enabled_locked()) + return; + trace_dump_struct_begin("pipe_reference"); trace_dump_member(int, &reference->count, count); trace_dump_struct_end(); @@ -60,6 +69,9 @@ static void trace_dump_reference(const struct pipe_reference *reference) void trace_dump_template(const struct pipe_texture *templat) { + if (!trace_dumping_enabled_locked()) + return; + if(!templat) { trace_dump_null(); return; @@ -95,6 +107,9 @@ void trace_dump_template(const struct pipe_texture *templat) void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -141,6 +156,9 @@ void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state) void trace_dump_poly_stipple(const struct pipe_poly_stipple *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -160,6 +178,9 @@ void trace_dump_poly_stipple(const struct pipe_poly_stipple *state) void trace_dump_viewport_state(const struct pipe_viewport_state *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -176,6 +197,9 @@ void trace_dump_viewport_state(const struct pipe_viewport_state *state) void trace_dump_scissor_state(const struct pipe_scissor_state *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -196,6 +220,9 @@ void trace_dump_clip_state(const struct pipe_clip_state *state) { unsigned i; + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -221,6 +248,9 @@ void trace_dump_clip_state(const struct pipe_clip_state *state) void trace_dump_constant_buffer(const struct pipe_constant_buffer *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -238,6 +268,9 @@ void trace_dump_shader_state(const struct pipe_shader_state *state) { static char str[8192]; + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -259,6 +292,9 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_ { unsigned i; + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -307,6 +343,9 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_ void trace_dump_blend_state(const struct pipe_blend_state *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -336,6 +375,9 @@ void trace_dump_blend_state(const struct pipe_blend_state *state) void trace_dump_blend_color(const struct pipe_blend_color *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -351,6 +393,9 @@ void trace_dump_blend_color(const struct pipe_blend_color *state) void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state) { + if (!trace_dumping_enabled_locked()) + return; + trace_dump_struct_begin("pipe_framebuffer_state"); trace_dump_member(uint, state, width); @@ -365,6 +410,9 @@ void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state) void trace_dump_sampler_state(const struct pipe_sampler_state *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -382,7 +430,6 @@ void trace_dump_sampler_state(const struct pipe_sampler_state *state) trace_dump_member(uint, state, compare_func); trace_dump_member(bool, state, normalized_coords); trace_dump_member(uint, state, prefilter); - trace_dump_member(float, state, shadow_ambient); trace_dump_member(float, state, lod_bias); trace_dump_member(float, state, min_lod); trace_dump_member(float, state, max_lod); @@ -395,6 +442,9 @@ void trace_dump_sampler_state(const struct pipe_sampler_state *state) void trace_dump_surface(const struct pipe_surface *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -423,6 +473,9 @@ void trace_dump_surface(const struct pipe_surface *state) void trace_dump_transfer(const struct pipe_transfer *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -454,6 +507,9 @@ void trace_dump_transfer(const struct pipe_transfer *state) void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; @@ -472,6 +528,9 @@ void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state) void trace_dump_vertex_element(const struct pipe_vertex_element *state) { + if (!trace_dumping_enabled_locked()) + return; + if(!state) { trace_dump_null(); return; diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 920f418ebf0..5b1e26a52d7 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -38,6 +38,7 @@ static boolean trace = FALSE; +static boolean rbug = FALSE; static const char * trace_screen_get_name(struct pipe_screen *_screen) @@ -837,18 +838,11 @@ trace_screen_destroy(struct pipe_screen *_screen) boolean trace_enabled(void) { - return trace; -} + static boolean firstrun = TRUE; -struct pipe_screen * -trace_screen_create(struct pipe_screen *screen) -{ - struct trace_screen *tr_scr; - struct pipe_winsys *winsys; - boolean rbug = FALSE; - - if(!screen) - goto error1; + if (!firstrun) + return trace; + firstrun = FALSE; trace_dump_init(); @@ -862,7 +856,19 @@ trace_screen_create(struct pipe_screen *screen) rbug = TRUE; } - if (!trace) + return trace; +} + +struct pipe_screen * +trace_screen_create(struct pipe_screen *screen) +{ + struct trace_screen *tr_scr; + struct pipe_winsys *winsys; + + if(!screen) + goto error1; + + if (!trace_enabled()) goto error1; trace_dump_call_begin("", "pipe_screen_create"); diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h index 63238ea46e9..4152d6ac36a 100644 --- a/src/gallium/include/pipe/p_config.h +++ b/src/gallium/include/pipe/p_config.h @@ -102,6 +102,19 @@ /* + * Endian detection. + */ + +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) +#define PIPE_ARCH_LITTLE_ENDIAN +#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) +#define PIPE_ARCH_BIG_ENDIAN +#else +#define PIPE_ARCH_UNKNOWN_ENDIAN +#endif + + +/* * Operating system family. * * See subsystem below for a more fine-grained distinction. @@ -119,6 +132,10 @@ #define PIPE_OS_SOLARIS #endif +#if defined(__APPLE__) +#define PIPE_OS_APPLE +#endif + #if defined(_WIN32) || defined(WIN32) #define PIPE_OS_WINDOWS #endif diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 9924046cb2f..bc4bc707591 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -210,6 +210,7 @@ enum pipe_transfer_usage { #define PIPE_BUFFER_USAGE_CONSTANT (1 << 7) #define PIPE_BUFFER_USAGE_DISCARD (1 << 8) #define PIPE_BUFFER_USAGE_DONTBLOCK (1 << 9) +#define PIPE_BUFFER_USAGE_FLUSH_EXPLICIT (1 << 10) /**< See pipe_screen::buffer_flush_mapped_range */ /** Pipe driver custom usage flags should be greater or equal to this value */ #define PIPE_BUFFER_USAGE_CUSTOM (1 << 16) @@ -302,6 +303,8 @@ enum pipe_transfer_usage { #define PIPE_CAP_TEXTURE_MIRROR_CLAMP 24 #define PIPE_CAP_TEXTURE_MIRROR_REPEAT 25 #define PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS 26 +#define PIPE_CAP_TGSI_CONT_SUPPORTED 27 +#define PIPE_CAP_BLEND_EQUATION_SEPARATE 28 /** diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index e31538c95fc..c4469d4a9e9 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -563,7 +563,11 @@ pf_is_depth_and_stencil( enum pipe_format format ) } /** DEPRECATED: For backwards compatibility */ -#define pf_is_depth_stencil pf_is_depth_or_stencil +static INLINE boolean +pf_is_depth_stencil( enum pipe_format format ) +{ + return pf_is_depth_or_stencil( format ); +} static INLINE boolean pf_is_compressed( enum pipe_format format ) diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h index 1232c879682..cf176c92099 100644 --- a/src/gallium/include/pipe/p_inlines.h +++ b/src/gallium/include/pipe/p_inlines.h @@ -117,7 +117,9 @@ pipe_buffer_write(struct pipe_screen *screen, assert(offset + size <= buf->size); assert(size); - map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE); + map = pipe_buffer_map_range(screen, buf, offset, size, + PIPE_BUFFER_USAGE_CPU_WRITE | + PIPE_BUFFER_USAGE_FLUSH_EXPLICIT); assert(map); if(map) { memcpy(map + offset, data, size); diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h index 1f89453e09a..1f9088b3e9c 100644 --- a/src/gallium/include/pipe/p_refcnt.h +++ b/src/gallium/include/pipe/p_refcnt.h @@ -62,29 +62,29 @@ pipe_is_referenced(struct pipe_reference *reference) * Set 'ptr' to point to 'reference' and update reference counting. * The old thing pointed to, if any, will be unreferenced first. * 'reference' may be NULL. - * - * XXX: thread safety issues! */ static INLINE bool pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference) { bool destroy = FALSE; - /* bump the reference.count first */ - if (reference) { - assert(pipe_is_referenced(reference)); - p_atomic_inc(&reference->count); - } - - if (*ptr) { - assert(pipe_is_referenced(*ptr)); - if (p_atomic_dec_zero(&(*ptr)->count)) { - destroy = TRUE; + if(*ptr != reference) { + /* bump the reference.count first */ + if (reference) { + assert(pipe_is_referenced(reference)); + p_atomic_inc(&reference->count); } + + if (*ptr) { + assert(pipe_is_referenced(*ptr)); + if (p_atomic_dec_zero(&(*ptr)->count)) { + destroy = TRUE; + } + } + + *ptr = reference; } - *ptr = reference; - return destroy; } diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index b449522fac3..6cbdd759434 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -221,23 +221,31 @@ struct pipe_screen { /** * Notify a range that was actually written into. * + * Can only be used if the buffer was mapped with the + * PIPE_BUFFER_USAGE_CPU_WRITE and PIPE_BUFFER_USAGE_FLUSH_EXPLICIT flags + * set. + * * The range is relative to the buffer start, regardless of the range * specified to buffer_map_range. This is different from the * ARB_map_buffer_range semantics because we don't forbid multiple mappings * of the same buffer (yet). * - * If the buffer was mapped for writing and no buffer_flush_mapped_range - * call was done until the buffer_unmap is called then the pipe driver will - * assumed that the whole buffer was written. This is for backward - * compatibility purposes and may affect performance -- the state tracker - * should always specify exactly what got written while the buffer was - * mapped. */ void (*buffer_flush_mapped_range)( struct pipe_screen *screen, struct pipe_buffer *buf, unsigned offset, unsigned length); + /** + * Unmap buffer. + * + * If the buffer was mapped with PIPE_BUFFER_USAGE_CPU_WRITE flag but not + * PIPE_BUFFER_USAGE_FLUSH_EXPLICIT then the pipe driver will + * assume that the whole buffer was written. This is mostly for backward + * compatibility purposes and may affect performance -- the state tracker + * should always specify exactly what got written while the buffer was + * mapped. + */ void (*buffer_unmap)( struct pipe_screen *screen, struct pipe_buffer *buf ); diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 4dafdd6f0a9..b00cfe3423c 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -131,7 +131,8 @@ struct tgsi_declaration_range #define TGSI_SEMANTIC_PSIZE 4 #define TGSI_SEMANTIC_GENERIC 5 #define TGSI_SEMANTIC_NORMAL 6 -#define TGSI_SEMANTIC_COUNT 7 /**< number of semantic values */ +#define TGSI_SEMANTIC_FACE 7 +#define TGSI_SEMANTIC_COUNT 8 /**< number of semantic values */ struct tgsi_declaration_semantic { diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 4b590bdc906..626bedb35a8 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -75,11 +75,11 @@ struct pipe_surface; */ struct pipe_buffer { - struct pipe_reference reference; - struct pipe_screen *screen; - unsigned alignment; - unsigned usage; - unsigned size; + struct pipe_reference reference; + unsigned size; + struct pipe_screen *screen; + unsigned alignment; + unsigned usage; }; @@ -265,7 +265,6 @@ struct pipe_sampler_state unsigned compare_func:3; /**< PIPE_FUNC_x */ unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */ unsigned prefilter:4; /**< Wierd sampling state exposed by some api's */ - float shadow_ambient; /**< shadow test fail color/intensity */ float lod_bias; /**< LOD/lambda bias */ float min_lod, max_lod; /**< LOD clamp range, after bias */ float border_color[4]; @@ -287,10 +286,10 @@ struct pipe_surface unsigned offset; /**< offset from start of buffer, in bytes */ unsigned usage; /**< PIPE_BUFFER_USAGE_* */ + unsigned zslice; struct pipe_texture *texture; /**< texture into which this is a view */ unsigned face; unsigned level; - unsigned zslice; }; diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h index df6d38904a6..96e8e087447 100644 --- a/src/gallium/include/pipe/p_thread.h +++ b/src/gallium/include/pipe/p_thread.h @@ -36,6 +36,7 @@ #include "pipe/p_compiler.h" +#include "util/u_debug.h" /* for assert */ #if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index 5790b2f6c7e..7a38b508fbe 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -32,33 +32,37 @@ struct drm_api * Special buffer functions */ /*@{*/ - struct pipe_screen* (*create_screen)(int drm_fd, - struct drm_create_screen_arg *arg); - struct pipe_context* (*create_context)(struct pipe_screen *screen); + struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd, + struct drm_create_screen_arg *arg); + struct pipe_context* (*create_context)(struct drm_api *api, + struct pipe_screen *screen); /*@}*/ /** * Special buffer functions */ /*@{*/ - boolean (*buffer_from_texture)(struct pipe_texture *texture, - struct pipe_buffer **buffer, - unsigned *stride); - struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen, + boolean (*buffer_from_texture)(struct drm_api *api, + struct pipe_texture *texture, + struct pipe_buffer **buffer, + unsigned *stride); + struct pipe_buffer* (*buffer_from_handle)(struct drm_api *api, + struct pipe_screen *screen, const char *name, unsigned handle); - boolean (*handle_from_buffer)(struct pipe_screen *screen, - struct pipe_buffer *buffer, - unsigned *handle); - boolean (*global_handle_from_buffer)(struct pipe_screen *screen, - struct pipe_buffer *buffer, - unsigned *handle); + boolean (*handle_from_buffer)(struct drm_api *api, + struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle); + boolean (*global_handle_from_buffer)(struct drm_api *api, + struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle); /*@}*/ + + void (*destroy)(struct drm_api *api); }; -/** - * A driver needs to export this symbol - */ -extern struct drm_api drm_api_hooks; +extern struct drm_api * drm_api_create(void); #endif diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 45eaec4ed39..6c617197eca 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -69,7 +69,7 @@ dri_create_context(const __GLcontextModes * visual, driParseConfigFiles(&ctx->optionCache, &screen->optionCache, sPriv->myNum, "dri"); - ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen); + ctx->pipe = screen->api->create_context(screen->api, screen->pipe_screen); if (ctx->pipe == NULL) goto fail; diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 09cd3091d22..1d91fbb89fb 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -53,7 +53,8 @@ dri_copy_to_front(__DRIdrawablePrivate * dPriv, } static struct pipe_surface * -dri_surface_from_handle(struct pipe_screen *screen, +dri_surface_from_handle(struct drm_api *api, + struct pipe_screen *screen, unsigned handle, enum pipe_format format, unsigned width, unsigned height, unsigned pitch) @@ -63,7 +64,7 @@ dri_surface_from_handle(struct pipe_screen *screen, struct pipe_texture templat; struct pipe_buffer *buf = NULL; - buf = drm_api_hooks.buffer_from_handle(screen, "dri2 buffer", handle); + buf = api->buffer_from_handle(api, screen, "dri2 buffer", handle); if (!buf) return NULL; @@ -100,12 +101,14 @@ dri_surface_from_handle(struct pipe_screen *screen, void dri_get_buffers(__DRIdrawablePrivate * dPriv) { + struct dri_drawable *drawable = dri_drawable(dPriv); struct pipe_surface *surface = NULL; struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen; __DRIbuffer *buffers = NULL; __DRIscreen *dri_screen = drawable->sPriv; __DRIdrawable *dri_drawable = drawable->dPriv; + struct drm_api *api = ((struct dri_screen*)(dri_screen->private))->api; boolean have_depth = FALSE; int i, count; @@ -157,29 +160,28 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv) switch (buffers[i].attachment) { case __DRI_BUFFER_FRONT_LEFT: index = ST_SURFACE_FRONT_LEFT; - format = PIPE_FORMAT_A8R8G8B8_UNORM; + format = drawable->color_format; break; case __DRI_BUFFER_FAKE_FRONT_LEFT: index = ST_SURFACE_FRONT_LEFT; - format = PIPE_FORMAT_A8R8G8B8_UNORM; + format = drawable->color_format; break; case __DRI_BUFFER_BACK_LEFT: index = ST_SURFACE_BACK_LEFT; - format = PIPE_FORMAT_A8R8G8B8_UNORM; + format = drawable->color_format; break; case __DRI_BUFFER_DEPTH: index = ST_SURFACE_DEPTH; - format = PIPE_FORMAT_Z24S8_UNORM; + format = drawable->depth_format; break; case __DRI_BUFFER_STENCIL: index = ST_SURFACE_DEPTH; - format = PIPE_FORMAT_Z24S8_UNORM; + format = drawable->stencil_format; break; case __DRI_BUFFER_ACCUM: default: assert(0); } - assert(buffers[i].cpp == 4); if (index == ST_SURFACE_DEPTH) { if (have_depth) @@ -188,7 +190,8 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv) have_depth = TRUE; } - surface = dri_surface_from_handle(screen, + surface = dri_surface_from_handle(api, + screen, buffers[i].name, format, dri_drawable->w, @@ -218,10 +221,8 @@ dri_create_buffer(__DRIscreenPrivate * sPriv, __DRIdrawablePrivate * dPriv, const __GLcontextModes * visual, boolean isPixmap) { - enum pipe_format colorFormat, depthFormat, stencilFormat; struct dri_screen *screen = sPriv->private; struct dri_drawable *drawable = NULL; - struct pipe_screen *pscreen = screen->pipe_screen; int i; if (isPixmap) @@ -231,39 +232,52 @@ dri_create_buffer(__DRIscreenPrivate * sPriv, if (drawable == NULL) goto fail; - /* XXX: todo: use the pipe_screen queries to figure out which - * render targets are supportable. - */ - assert(visual->redBits == 8); - assert(visual->depthBits == 24 || visual->depthBits == 0); - assert(visual->stencilBits == 8 || visual->stencilBits == 0); - - colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM; + drawable->color_format = (visual->redBits == 8) ? + PIPE_FORMAT_A8R8G8B8_UNORM : PIPE_FORMAT_R5G6B5_UNORM; + + debug_printf("Red bits is %d\n", visual->redBits); + + switch(visual->depthBits) { + default: + case 0: + debug_printf("Depth buffer 0.\n"); + drawable->depth_format = PIPE_FORMAT_NONE; + break; + case 16: + debug_printf("Depth buffer 16.\n"); + drawable->depth_format = PIPE_FORMAT_Z16_UNORM; + break; + case 24: + if (visual->stencilBits == 0) { + debug_printf("Depth buffer 24. Stencil 0.\n"); + drawable->depth_format = (screen->d_depth_bits_last) ? + PIPE_FORMAT_X8Z24_UNORM: + PIPE_FORMAT_Z24X8_UNORM; + } else { + debug_printf("Combined depth stencil 24 / 8.\n"); + drawable->depth_format = (screen->sd_depth_bits_last) ? + PIPE_FORMAT_S8Z24_UNORM: + PIPE_FORMAT_Z24S8_UNORM; + } + break; + } - if (visual->depthBits) { - if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, - PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) - depthFormat = PIPE_FORMAT_Z24S8_UNORM; - else - depthFormat = PIPE_FORMAT_S8Z24_UNORM; - } else - depthFormat = PIPE_FORMAT_NONE; - - if (visual->stencilBits) { - if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, - PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) - stencilFormat = PIPE_FORMAT_Z24S8_UNORM; - else - stencilFormat = PIPE_FORMAT_S8Z24_UNORM; - } else - stencilFormat = PIPE_FORMAT_NONE; + switch(visual->stencilBits) { + default: + case 0: + drawable->stencil_format = PIPE_FORMAT_NONE; + break; + case 8: + drawable->stencil_format = (screen->sd_depth_bits_last) ? + PIPE_FORMAT_S8Z24_UNORM: + PIPE_FORMAT_Z24S8_UNORM; + break; + } drawable->stfb = st_create_framebuffer(visual, - colorFormat, - depthFormat, - stencilFormat, + drawable->color_format, + drawable->depth_format, + drawable->stencil_format, dPriv->w, dPriv->h, (void *)drawable); if (drawable->stfb == NULL) diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h index 0f654d804a7..2fbd5f1eb7c 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.h +++ b/src/gallium/state_trackers/dri/dri_drawable.h @@ -58,6 +58,10 @@ struct dri_drawable unsigned int tail; unsigned int desired_fences; unsigned int cur_fences; + + enum pipe_format color_format; + enum pipe_format depth_format; + enum pipe_format stencil_format; }; static INLINE struct dri_drawable * diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c index 2f48162526b..7c04c2b970e 100644 --- a/src/gallium/state_trackers/dri/dri_extensions.c +++ b/src/gallium/state_trackers/dri/dri_extensions.c @@ -82,8 +82,7 @@ const struct dri_extension card_extensions[] = { {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, {"GL_ARB_window_pos", GL_ARB_window_pos_functions}, {"GL_EXT_blend_color", GL_EXT_blend_color_functions}, - {"GL_EXT_blend_equation_separate", - GL_EXT_blend_equation_separate_functions}, + {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions}, {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, {"GL_EXT_blend_subtract", NULL}, diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index d3392ee690b..5f78b7264af 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -69,39 +69,65 @@ PUBLIC const char __driConfigOptions[] = struct dri1_api *__dri1_api_hooks = NULL; static const __DRIconfig ** -dri_fill_in_modes(__DRIscreenPrivate * psp, - unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer) +dri_fill_in_modes(struct dri_screen *screen, + unsigned pixel_bits) { __DRIconfig **configs; - __GLcontextModes *m; unsigned num_modes; - uint8_t depth_bits_array[3]; - uint8_t stencil_bits_array[3]; + uint8_t depth_bits_array[4]; + uint8_t stencil_bits_array[4]; uint8_t msaa_samples_array[1]; unsigned depth_buffer_factor; unsigned back_buffer_factor; unsigned msaa_samples_factor; GLenum fb_format; GLenum fb_type; - int i; + struct pipe_screen *p_screen = screen->pipe_screen; static const GLenum back_buffer_modes[] = { GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML }; - /* TODO probe the hardware of what is supports */ depth_bits_array[0] = 0; - depth_bits_array[1] = 24; - depth_bits_array[2] = 24; - - stencil_bits_array[0] = 0; /* no depth or stencil */ - stencil_bits_array[1] = 0; /* z24x8 */ - stencil_bits_array[2] = 8; /* z24s8 */ + stencil_bits_array[0] = 0; + depth_buffer_factor = 1; + + if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) { + depth_bits_array[depth_buffer_factor] = 16; + stencil_bits_array[depth_buffer_factor++] = 0; + } + if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8Z24_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) { + depth_bits_array[depth_buffer_factor] = 24; + stencil_bits_array[depth_buffer_factor++] = 0; + screen->d_depth_bits_last = TRUE; + } else if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, + 0)) { + depth_bits_array[depth_buffer_factor] = 24; + stencil_bits_array[depth_buffer_factor++] = 0; + screen->d_depth_bits_last = FALSE; + } + if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_S8Z24_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) { + depth_bits_array[depth_buffer_factor] = 24; + stencil_bits_array[depth_buffer_factor++] = 8; + screen->sd_depth_bits_last = TRUE; + } else if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24S8_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, + 0)) { + depth_bits_array[depth_buffer_factor] = 24; + stencil_bits_array[depth_buffer_factor++] = 8; + screen->sd_depth_bits_last = FALSE; + } msaa_samples_array[0] = 0; - - depth_buffer_factor = 3; back_buffer_factor = 3; msaa_samples_factor = 1; @@ -109,9 +135,19 @@ dri_fill_in_modes(__DRIscreenPrivate * psp, depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4; if (pixel_bits == 16) { + if (!p_screen->is_format_supported(p_screen, + PIPE_FORMAT_R5G6B5_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) + return NULL; fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; } else { + if (!p_screen->is_format_supported(p_screen, + PIPE_FORMAT_A8R8G8B8_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) + return NULL; fb_format = GL_BGRA; fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } @@ -126,13 +162,6 @@ dri_fill_in_modes(__DRIscreenPrivate * psp, return NULL; } - for (i = 0; configs[i]; i++) { - m = &configs[i]->modes; - if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { - m->visualRating = GLX_SLOW_CONFIG; - } - } - return (const const __DRIconfig **)configs; } @@ -170,6 +199,7 @@ dri_init_screen(__DRIscreenPrivate * sPriv) if (!screen) return NULL; + screen->api = drm_api_create(); screen->sPriv = sPriv; screen->fd = sPriv->fd; screen->drmLock = (drmLock *) & sPriv->pSAREA->lock; @@ -187,7 +217,7 @@ dri_init_screen(__DRIscreenPrivate * sPriv) dri_copy_version(&arg.drm_version, &sPriv->drm_version); arg.api = NULL; - screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, &arg.base); + screen->pipe_screen = screen->api->create_screen(screen->api, screen->fd, &arg.base); if (!screen->pipe_screen || !arg.api) { debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__); @@ -200,7 +230,13 @@ dri_init_screen(__DRIscreenPrivate * sPriv) driParseOptionInfo(&screen->optionCache, __driConfigOptions, __driNConfigOptions); - configs = dri_fill_in_modes(sPriv, sPriv->fbBPP, 24, 8, 1); + /** + * FIXME: If the driver supports format conversion swapbuffer blits, we might + * want to support other color bit depths than the server is currently + * using. + */ + + configs = dri_fill_in_modes(screen, sPriv->fbBPP); if (!configs) goto out_no_configs; @@ -230,13 +266,14 @@ dri_init_screen2(__DRIscreenPrivate * sPriv) if (!screen) goto fail; + screen->api = drm_api_create(); screen->sPriv = sPriv; screen->fd = sPriv->fd; sPriv->private = (void *)screen; sPriv->extensions = dri_screen_extensions; arg.mode = DRM_CREATE_NORMAL; - screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, &arg); + screen->pipe_screen = screen->api->create_screen(screen->api, screen->fd, &arg); if (!screen->pipe_screen) { debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__); goto fail; @@ -248,7 +285,7 @@ dri_init_screen2(__DRIscreenPrivate * sPriv) driParseOptionInfo(&screen->optionCache, __driConfigOptions, __driNConfigOptions); - return dri_fill_in_modes(sPriv, 4 * 8, 24, 8, 1); + return dri_fill_in_modes(screen, 32); fail: return NULL; } diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h index 100d9e50e07..f3335bb09f9 100644 --- a/src/gallium/state_trackers/dri/dri_screen.h +++ b/src/gallium/state_trackers/dri/dri_screen.h @@ -60,8 +60,11 @@ struct dri_screen drmLock *drmLock; /* gallium */ + struct drm_api *api; struct pipe_winsys *pipe_winsys; struct pipe_screen *pipe_screen; + boolean d_depth_bits_last; + boolean sd_depth_bits_last; }; /** cast wrapper */ diff --git a/src/gallium/state_trackers/egl/egl_context.c b/src/gallium/state_trackers/egl/egl_context.c index 36548fae263..edd49486e5b 100644 --- a/src/gallium/state_trackers/egl/egl_context.c +++ b/src/gallium/state_trackers/egl/egl_context.c @@ -115,7 +115,7 @@ drm_create_context(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext _eglInitContext(drv, dpy, &ctx->base, config, attrib_list); - ctx->pipe = drm_api_hooks.create_context(dev->screen); + ctx->pipe = dev->api->create_context(dev->api, dev->screen); if (!ctx->pipe) goto err_pipe; diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index 489aa8d9af5..de8194a46af 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -132,7 +132,7 @@ drm_create_texture(_EGLDriver *drv, scrn->front.width = w; scrn->front.height = h; scrn->front.pitch = pitch; - drm_api_hooks.handle_from_buffer(screen, scrn->buffer, &scrn->front.handle); + dev->api->handle_from_buffer(dev->api, screen, scrn->buffer, &scrn->front.handle); if (0) goto err_handle; diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index 8e620084617..521c91d8958 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -35,6 +35,8 @@ _eglMain(_EGLDisplay *dpy, const char *args) return NULL; } + drm->api = drm_api_create(); + /* First fill in the dispatch table with defaults */ _eglInitDriverFallbacks(&drm->base); /* then plug in our Drm-specific functions */ @@ -146,7 +148,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor) dev->drmFD = fd; drm_get_device_id(dev); - dev->screen = drm_api_hooks.create_screen(dev->drmFD, NULL); + dev->screen = dev->api->create_screen(dev->api, dev->drmFD, NULL); if (!dev->screen) goto err_screen; dev->winsys = dev->screen->winsys; @@ -234,6 +236,7 @@ drm_terminate(_EGLDriver *drv, EGLDisplay dpy) dev->screen->destroy(dev->screen); dev->winsys = NULL; + dev->api->destroy(dev->api); drmClose(dev->drmFD); diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h index ce2717de639..3b8836720d6 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.h +++ b/src/gallium/state_trackers/egl/egl_tracker.h @@ -38,6 +38,7 @@ struct drm_device * pipe */ + struct drm_api *api; struct pipe_winsys *winsys; struct pipe_screen *screen; diff --git a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c index 16d4f1e32c9..643e68e6a6f 100644 --- a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c +++ b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c @@ -669,7 +669,6 @@ static int vlInit sampler.compare_func = PIPE_FUNC_ALWAYS; sampler.normalized_coords = 1; /*sampler.prefilter = ;*/ - /*sampler.shadow_ambient = ;*/ /*sampler.lod_bias = ;*/ /*sampler.min_lod = ;*/ /*sampler.max_lod = ;*/ diff --git a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c index eb8270ecad3..79318fe24b2 100644 --- a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c +++ b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c @@ -1074,7 +1074,6 @@ static int vlInit sampler.compare_func = PIPE_FUNC_ALWAYS; sampler.normalized_coords = 1; /*sampler.prefilter = ;*/ - /*sampler.shadow_ambient = ;*/ /*sampler.lod_bias = ;*/ sampler.min_lod = 0; /*sampler.max_lod = ;*/ diff --git a/src/gallium/state_trackers/glx/xlib/fakeglx.c b/src/gallium/state_trackers/glx/xlib/fakeglx.c index 85e7ecfb9e8..23777c76f6c 100644 --- a/src/gallium/state_trackers/glx/xlib/fakeglx.c +++ b/src/gallium/state_trackers/glx/xlib/fakeglx.c @@ -1820,7 +1820,7 @@ Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap, if (!dpy || !config || !pixmap) return 0; - for (attr = attribList; *attr; attr++) { + for (attr = attribList; attr && *attr; attr++) { switch (*attr) { case GLX_TEXTURE_FORMAT_EXT: attr++; diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py index 1fa7fe6f3b3..202ccfc3509 100755 --- a/src/gallium/state_trackers/python/tests/base.py +++ b/src/gallium/state_trackers/python/tests/base.py @@ -46,6 +46,14 @@ for name, value in globals().items(): if name.startswith("PIPE_FORMAT_") and isinstance(value, int): formats[value] = name +def is_depth_stencil_format(format): + # FIXME: make and use binding to pf_is_depth_stencil + return format in ( + PIPE_FORMAT_Z32_UNORM, + PIPE_FORMAT_Z24S8_UNORM, + PIPE_FORMAT_Z24X8_UNORM, + PIPE_FORMAT_Z16_UNORM, + ) def make_image(width, height, rgba): import Image diff --git a/src/gallium/state_trackers/python/tests/texture_sample.py b/src/gallium/state_trackers/python/tests/texture_sample.py index 06130ea1c9c..c7b78abbbec 100755 --- a/src/gallium/state_trackers/python/tests/texture_sample.py +++ b/src/gallium/state_trackers/python/tests/texture_sample.py @@ -497,17 +497,13 @@ def main(): PIPE_TEXTURE_3D, ] - formats = [ + color_formats = [ PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_FORMAT_X8R8G8B8_UNORM, #PIPE_FORMAT_A8R8G8B8_SRGB, PIPE_FORMAT_R5G6B5_UNORM, PIPE_FORMAT_A1R5G5B5_UNORM, PIPE_FORMAT_A4R4G4B4_UNORM, - PIPE_FORMAT_Z32_UNORM, - PIPE_FORMAT_Z24S8_UNORM, - PIPE_FORMAT_Z24X8_UNORM, - PIPE_FORMAT_Z16_UNORM, PIPE_FORMAT_A8_UNORM, PIPE_FORMAT_L8_UNORM, PIPE_FORMAT_YCBCR, @@ -517,6 +513,13 @@ def main(): #PIPE_FORMAT_DXT5_RGBA, ] + depth_formats = [ + PIPE_FORMAT_Z32_UNORM, + PIPE_FORMAT_Z24S8_UNORM, + PIPE_FORMAT_Z24X8_UNORM, + PIPE_FORMAT_Z16_UNORM, + ] + sizes = [64, 32, 16, 8, 4, 2, 1] #sizes = [1020, 508, 252, 62, 30, 14, 6, 3] #sizes = [64] @@ -531,8 +534,8 @@ def main(): PIPE_TEX_FACE_NEG_Z, ] - for target in targets: - for format in formats: + for format in color_formats: + for target in targets: for size in sizes: if target == PIPE_TEXTURE_3D: depth = size @@ -546,17 +549,7 @@ def main(): for level in range(0, last_level + 1): zslice = 0 while zslice < depth >> level: - if format in ( - PIPE_FORMAT_Z32_UNORM, - PIPE_FORMAT_Z24S8_UNORM, - PIPE_FORMAT_Z24X8_UNORM, - PIPE_FORMAT_Z16_UNORM, - ): - klass = TextureDepthSampleTest - else: - klass = TextureColorSampleTest - - test = klass( + test = TextureColorSampleTest( dev = dev, target = target, format = format, @@ -570,6 +563,27 @@ def main(): ) suite.add_test(test) zslice = (zslice + 1)*2 - 1 + for format in depth_formats: + target = PIPE_TEXTURE_2D + depth = 1 + face = 0 + last_level = 0 + level = 0 + zslice = 0 + for size in sizes: + test = TextureDepthSampleTest( + dev = dev, + target = target, + format = format, + width = size, + height = size, + depth = depth, + last_level = last_level, + face = face, + level = level, + zslice = zslice, + ) + suite.add_test(test) suite.run() diff --git a/src/gallium/state_trackers/vega/Makefile b/src/gallium/state_trackers/vega/Makefile new file mode 100644 index 00000000000..b8c805b06c4 --- /dev/null +++ b/src/gallium/state_trackers/vega/Makefile @@ -0,0 +1,128 @@ +# src/mesa/Makefile + +TOP = ../../../.. +include $(TOP)/configs/current +GALLIUM = $(TOP) + +### Lists of source files, included by Makefiles + +VG_SOURCES = \ + api_context.c \ + api_filters.c \ + api_images.c \ + api_masks.c \ + api_misc.c \ + api_paint.c \ + api_params.c \ + api_path.c \ + api_text.c \ + api_transform.c \ + vgu.c \ + vg_context.c \ + vg_state.c \ + vg_tracker.c \ + vg_translate.c \ + polygon.c \ + bezier.c \ + path.c \ + paint.c \ + arc.c \ + image.c \ + renderer.c \ + stroker.c \ + mask.c \ + shader.c \ + shaders_cache.c + + +### All the core C sources + +ALL_SOURCES = \ + $(VG_SOURCES) + + +### Object files +VG_OBJECTS = \ + $(VG_SOURCES:.c=.o) + +### Include directories + +INCLUDE_DIRS = \ + -I$(TOP)/include \ + -I$(GALLIUM)/include \ + -I$(GALLIUM)/src/gallium/include \ + -I$(GALLIUM)/src/gallium/auxiliary + +VG_LIB = OpenVG +VG_LIB_NAME = lib$(VG_LIB).so + +VG_MAJOR = 1 +VG_MINOR = 0 +VG_TINY = 0 + +GALLIUM_LIBS = \ + $(GALLIUM)/src/gallium/auxiliary/pipebuffer/libpipebuffer.a \ + $(GALLIUM)/src/gallium/auxiliary/sct/libsct.a \ + $(GALLIUM)/src/gallium/auxiliary/draw/libdraw.a \ + $(GALLIUM)/src/gallium/auxiliary/rtasm/librtasm.a \ + $(GALLIUM)/src/gallium/auxiliary/translate/libtranslate.a \ + $(GALLIUM)/src/gallium/auxiliary/cso_cache/libcso_cache.a \ + $(GALLIUM)/src/gallium/auxiliary/util/libutil.a \ + $(GALLIUM)/src/gallium/auxiliary/tgsi/libtgsi.a + +.SUFFIXES : .cpp + +.c.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + +.cpp.o: + $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + + +default: depend subdirs $(TOP)/$(LIB_DIR)/$(VG_LIB_NAME) + +# Make the OpenVG library +$(TOP)/$(LIB_DIR)/$(VG_LIB_NAME): $(VG_OBJECTS) $(GALLIUM_LIBS) + $(TOP)/bin/mklib -o $(VG_LIB) \ + -major $(VG_MAJOR) \ + -minor $(VG_MINOR) \ + -patch $(VG_TINY) \ + -install $(TOP)/$(LIB_DIR) \ + $(VG_OBJECTS) $(GALLIUM_LIBS) \ + -Wl,--whole-archive $(LIBS) -Wl,--no-whole-archive $(SYS_LIBS) + +###################################################################### +# Generic stuff + +depend: $(ALL_SOURCES) + @ echo "running $(MKDEP)" + @ rm -f depend # workaround oops on gutsy?!? + @ touch depend + @ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \ + > /dev/null 2>/dev/null + + +subdirs: + +install: default + $(INSTALL) -d $(INSTALL_DIR)/include/VG + $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR) + $(INSTALL) -m 644 $(TOP)/include/VG/*.h $(INSTALL_DIR)/include/VG + @if [ -e $(TOP)/$(LIB_DIR)/$(VG_LIB_NAME) ]; then \ + $(INSTALL) $(TOP)/$(LIB_DIR)/libOpenVG* $(INSTALL_DIR)/$(LIB_DIR); \ + fi + +# Emacs tags +tags: + etags `find . -name \*.[ch]` $(TOP)/include/VG/*.h + +clean: + -rm -f *.o + -rm -f */*.o + -rm -f */*/*.o + -rm -f depend depend.bak + +include depend diff --git a/src/gallium/state_trackers/vega/api_consts.h b/src/gallium/state_trackers/vega/api_consts.h new file mode 100644 index 00000000000..e1b48d4a46c --- /dev/null +++ b/src/gallium/state_trackers/vega/api_consts.h @@ -0,0 +1,56 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 API_CONSTS_H +#define API_CONSTS_H + +/*must be at least 32*/ +#define VEGA_MAX_SCISSOR_RECTS 32 + +/*must be at least 16*/ +#define VEGA_MAX_DASH_COUNT 32 + +/*must be at least 7*/ +#define VEGA_MAX_KERNEL_SIZE 7 + +/*must be at least 15*/ +#define VEGA_MAX_SEPARABLE_KERNEL_SIZE 15 + +/*must be at least 32*/ +#define VEGA_MAX_COLOR_RAMP_STOPS 256 + +#define VEGA_MAX_IMAGE_WIDTH 2048 + +#define VEGA_MAX_IMAGE_HEIGHT 2048 + +#define VEGA_MAX_IMAGE_PIXELS (2048*2048) + +#define VEGA_MAX_IMAGE_BYTES (2048*2048 * 4) + +/*must be at least 128*/ +#define VEGA_MAX_GAUSSIAN_STD_DEVIATION 128 + +#endif diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c new file mode 100644 index 00000000000..47db102dd2d --- /dev/null +++ b/src/gallium/state_trackers/vega/api_context.c @@ -0,0 +1,75 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" + +#include "vg_context.h" + +#include "pipe/p_context.h" +#include "pipe/p_screen.h" + +VGErrorCode vgGetError(void) +{ + struct vg_context *ctx = vg_current_context(); + VGErrorCode error = VG_NO_CONTEXT_ERROR; + + if (!ctx) + return error; + + error = ctx->_error; + ctx->_error = VG_NO_ERROR; + + return error; +} + +void vgFlush(void) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_context *pipe; + + if (!ctx) + return; + + pipe = ctx->pipe; + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); +} + +void vgFinish(void) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_fence_handle *fence = NULL; + struct pipe_context *pipe; + + if (!ctx) + return; + + pipe = ctx->pipe; + + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); + + pipe->screen->fence_finish(pipe->screen, fence, 0); + pipe->screen->fence_reference(pipe->screen, &fence, NULL); +} diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c new file mode 100644 index 00000000000..862cbb03c43 --- /dev/null +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -0,0 +1,805 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" + +#include "vg_context.h" +#include "image.h" +#include "renderer.h" +#include "shaders_cache.h" +#include "st_inlines.h" + +#include "pipe/p_context.h" +#include "pipe/p_state.h" +#include "pipe/p_inlines.h" +#include "pipe/p_screen.h" +#include "pipe/p_shader_tokens.h" + +#include "util/u_memory.h" + + +#include "asm_filters.h" + + +struct filter_info { + struct vg_image *dst; + struct vg_image *src; + struct vg_shader * (*setup_shader)(struct vg_context *, void *); + void *user_data; + const void *const_buffer; + VGint const_buffer_len; + VGTilingMode tiling_mode; + struct pipe_texture *extra_texture; +}; + +static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx, + const VGuint *color_data, + const VGint color_data_len) +{ + struct pipe_context *pipe = ctx->pipe; + struct pipe_screen *screen = pipe->screen; + struct pipe_texture *tex = 0; + struct pipe_texture templ; + + memset(&templ, 0, sizeof(templ)); + templ.target = PIPE_TEXTURE_1D; + templ.format = PIPE_FORMAT_A8R8G8B8_UNORM; + templ.last_level = 0; + templ.width[0] = color_data_len; + templ.height[0] = 1; + templ.depth[0] = 1; + pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block); + templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + + tex = screen->texture_create(screen, &templ); + + { /* upload color_data */ + struct pipe_transfer *transfer = + screen->get_tex_transfer(screen, tex, + 0, 0, 0, + PIPE_TRANSFER_READ_WRITE , + 0, 0, tex->width[0], tex->height[0]); + void *map = screen->transfer_map(screen, transfer); + memcpy(map, color_data, sizeof(VGint)*color_data_len); + screen->transfer_unmap(screen, transfer); + screen->tex_transfer_destroy(transfer); + } + + return tex; +} + +static INLINE struct pipe_surface * setup_framebuffer(struct vg_image *dst) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_context *pipe = ctx->pipe; + struct pipe_framebuffer_state fb; + struct pipe_surface *dst_surf = pipe->screen->get_tex_surface( + pipe->screen, dst->texture, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* drawing dest */ + memset(&fb, 0, sizeof(fb)); + fb.width = dst->x + dst_surf->width; + fb.height = dst->y + dst_surf->height; + fb.nr_cbufs = 1; + fb.cbufs[0] = dst_surf; + { + VGint i; + for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) + fb.cbufs[i] = 0; + } + cso_set_framebuffer(ctx->cso_context, &fb); + + return dst_surf; +} + +static void setup_viewport(struct vg_image *dst) +{ + struct vg_context *ctx = vg_current_context(); + vg_set_viewport(ctx, VEGA_Y0_TOP); +} + +static void setup_blend() +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_blend_state blend; + memset(&blend, 0, sizeof(blend)); + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; + if (ctx->state.vg.filter_channel_mask & VG_RED) + blend.colormask |= PIPE_MASK_R; + if (ctx->state.vg.filter_channel_mask & VG_GREEN) + blend.colormask |= PIPE_MASK_G; + if (ctx->state.vg.filter_channel_mask & VG_BLUE) + blend.colormask |= PIPE_MASK_B; + if (ctx->state.vg.filter_channel_mask & VG_ALPHA) + blend.colormask |= PIPE_MASK_A; + blend.blend_enable = 1; + cso_set_blend(ctx->cso_context, &blend); +} + +static void setup_constant_buffer(struct vg_context *ctx, const void *buffer, + VGint param_bytes) +{ + struct pipe_context *pipe = ctx->pipe; + struct pipe_constant_buffer *cbuf = &ctx->filter.buffer; + + /* We always need to get a new buffer, to keep the drivers simple and + * avoid gratuitous rendering synchronization. */ + pipe_buffer_reference(&cbuf->buffer, NULL); + + cbuf->buffer = pipe_buffer_create(pipe->screen, 16, + PIPE_BUFFER_USAGE_CONSTANT, + param_bytes); + + if (cbuf->buffer) { + st_no_flush_pipe_buffer_write(ctx, cbuf->buffer, + 0, param_bytes, buffer); + } + + ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, cbuf); +} + +static void setup_samplers(struct vg_context *ctx, struct filter_info *info) +{ + struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; + struct pipe_texture *textures[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_state sampler[3]; + int num_samplers = 0; + int num_textures = 0; + + samplers[0] = NULL; + samplers[1] = NULL; + samplers[2] = NULL; + samplers[3] = NULL; + textures[0] = NULL; + textures[1] = NULL; + textures[2] = NULL; + textures[3] = NULL; + + memset(&sampler[0], 0, sizeof(struct pipe_sampler_state)); + sampler[0].wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler[0].wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler[0].wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler[0].min_img_filter = PIPE_TEX_MIPFILTER_LINEAR; + sampler[0].mag_img_filter = PIPE_TEX_MIPFILTER_LINEAR; + sampler[0].normalized_coords = 1; + + switch(info->tiling_mode) { + case VG_TILE_FILL: + sampler[0].wrap_s = PIPE_TEX_WRAP_CLAMP_TO_BORDER; + sampler[0].wrap_t = PIPE_TEX_WRAP_CLAMP_TO_BORDER; + memcpy(sampler[0].border_color, + ctx->state.vg.tile_fill_color, + sizeof(VGfloat) * 4); + break; + case VG_TILE_PAD: + sampler[0].wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler[0].wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + break; + case VG_TILE_REPEAT: + sampler[0].wrap_s = PIPE_TEX_WRAP_REPEAT; + sampler[0].wrap_t = PIPE_TEX_WRAP_REPEAT; + break; + case VG_TILE_REFLECT: + sampler[0].wrap_s = PIPE_TEX_WRAP_MIRROR_REPEAT; + sampler[0].wrap_t = PIPE_TEX_WRAP_MIRROR_REPEAT; + break; + default: + debug_assert(!"Unknown tiling mode"); + } + + samplers[0] = &sampler[0]; + textures[0] = info->src->texture; + ++num_samplers; + ++num_textures; + + if (info->extra_texture) { + memcpy(&sampler[1], &sampler[0], sizeof(struct pipe_sampler_state)); + samplers[1] = &sampler[1]; + textures[1] = info->extra_texture; + ++num_samplers; + ++num_textures; + } + + + cso_set_samplers(ctx->cso_context, num_samplers, (const struct pipe_sampler_state **)samplers); + cso_set_sampler_textures(ctx->cso_context, num_textures, textures); +} + +static struct vg_shader * setup_color_matrix(struct vg_context *ctx, void *user_data) +{ + struct vg_shader *shader = + shader_create_from_text(ctx->pipe, color_matrix_asm, 200, + PIPE_SHADER_FRAGMENT); + cso_set_fragment_shader_handle(ctx->cso_context, shader->driver); + return shader; +} + +static struct vg_shader * setup_convolution(struct vg_context *ctx, void *user_data) +{ + char buffer[1024]; + VGint num_consts = (VGint)(long)(user_data); + struct vg_shader *shader; + + snprintf(buffer, 1023, convolution_asm, num_consts, num_consts / 2 + 1); + + shader = shader_create_from_text(ctx->pipe, buffer, 200, + PIPE_SHADER_FRAGMENT); + + cso_set_fragment_shader_handle(ctx->cso_context, shader->driver); + return shader; +} + +static struct vg_shader * setup_lookup(struct vg_context *ctx, void *user_data) +{ + struct vg_shader *shader = + shader_create_from_text(ctx->pipe, lookup_asm, + 200, PIPE_SHADER_FRAGMENT); + + cso_set_fragment_shader_handle(ctx->cso_context, shader->driver); + return shader; +} + + +static struct vg_shader * setup_lookup_single(struct vg_context *ctx, void *user_data) +{ + char buffer[1024]; + VGImageChannel channel = (VGImageChannel)(user_data); + struct vg_shader *shader; + + switch(channel) { + case VG_RED: + snprintf(buffer, 1023, lookup_single_asm, "xxxx"); + break; + case VG_GREEN: + snprintf(buffer, 1023, lookup_single_asm, "yyyy"); + break; + case VG_BLUE: + snprintf(buffer, 1023, lookup_single_asm, "zzzz"); + break; + case VG_ALPHA: + snprintf(buffer, 1023, lookup_single_asm, "wwww"); + break; + default: + debug_assert(!"Unknown color channel"); + } + + shader = shader_create_from_text(ctx->pipe, buffer, 200, + PIPE_SHADER_FRAGMENT); + + cso_set_fragment_shader_handle(ctx->cso_context, shader->driver); + return shader; +} + +static void execute_filter(struct vg_context *ctx, + struct filter_info *info) +{ + struct pipe_surface *dst_surf; + struct vg_shader *shader; + + cso_save_framebuffer(ctx->cso_context); + cso_save_fragment_shader(ctx->cso_context); + cso_save_viewport(ctx->cso_context); + cso_save_blend(ctx->cso_context); + cso_save_samplers(ctx->cso_context); + cso_save_sampler_textures(ctx->cso_context); + + dst_surf = setup_framebuffer(info->dst); + setup_viewport(info->dst); + setup_blend(); + setup_constant_buffer(ctx, info->const_buffer, info->const_buffer_len); + shader = info->setup_shader(ctx, info->user_data); + setup_samplers(ctx, info); + + renderer_draw_texture(ctx->renderer, + info->src->texture, + info->dst->x, info->dst->y, + info->dst->x + info->dst->width, + info->dst->y + info->dst->height, + info->dst->x, info->dst->y, + info->dst->x + info->dst->width, + info->dst->y + info->dst->height); + + cso_restore_framebuffer(ctx->cso_context); + cso_restore_fragment_shader(ctx->cso_context); + cso_restore_viewport(ctx->cso_context); + cso_restore_blend(ctx->cso_context); + cso_restore_samplers(ctx->cso_context); + cso_restore_sampler_textures(ctx->cso_context); + + vg_shader_destroy(ctx, shader); + + pipe_surface_reference(&dst_surf, NULL); +} + +void vgColorMatrix(VGImage dst, VGImage src, + const VGfloat * matrix) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *d, *s; + struct filter_info info; + + if (dst == VG_INVALID_HANDLE || src == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (!matrix || !is_aligned(matrix)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + d = (struct vg_image*)dst; + s = (struct vg_image*)src; + + if (vg_image_overlaps(d, s)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + info.dst = d; + info.src = s; + info.setup_shader = &setup_color_matrix; + info.user_data = NULL; + info.const_buffer = matrix; + info.const_buffer_len = 20 * sizeof(VGfloat); + info.tiling_mode = VG_TILE_PAD; + info.extra_texture = 0; + execute_filter(ctx, &info); +} + +static VGfloat texture_offset(VGfloat width, VGint kernelSize, VGint current, VGint shift) +{ + VGfloat diff = current - shift; + + return diff / width; +} + +void vgConvolve(VGImage dst, VGImage src, + VGint kernelWidth, VGint kernelHeight, + VGint shiftX, VGint shiftY, + const VGshort * kernel, + VGfloat scale, + VGfloat bias, + VGTilingMode tilingMode) +{ + struct vg_context *ctx = vg_current_context(); + VGfloat *buffer; + VGint buffer_len; + VGint i, j; + VGint idx = 0; + struct vg_image *d, *s; + VGint kernel_size = kernelWidth * kernelHeight; + struct filter_info info; + const VGint max_kernel_size = vgGeti(VG_MAX_KERNEL_SIZE); + + if (dst == VG_INVALID_HANDLE || src == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (kernelWidth <= 0 || kernelHeight <= 0 || + kernelWidth > max_kernel_size || kernelHeight > max_kernel_size) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (!kernel || !is_aligned_to(kernel, 2)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (tilingMode < VG_TILE_FILL || + tilingMode > VG_TILE_REFLECT) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + d = (struct vg_image*)dst; + s = (struct vg_image*)src; + + if (vg_image_overlaps(d, s)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + vg_validate_state(ctx); + + buffer_len = 8 + 2 * 4 * kernel_size; + buffer = (VGfloat*)malloc(buffer_len * sizeof(VGfloat)); + + buffer[0] = 0.f; + buffer[1] = 1.f; + buffer[2] = 2.f; /*unused*/ + buffer[3] = 4.f; /*unused*/ + + buffer[4] = kernelWidth * kernelHeight; + buffer[5] = scale; + buffer[6] = bias; + buffer[7] = 0.f; + + idx = 8; + for (j = 0; j < kernelHeight; ++j) { + for (i = 0; i < kernelWidth; ++i) { + VGint index = j * kernelWidth + i; + VGfloat x, y; + + x = texture_offset(s->width, kernelWidth, i, shiftX); + y = texture_offset(s->height, kernelHeight, j, shiftY); + + buffer[idx + index*4 + 0] = x; + buffer[idx + index*4 + 1] = y; + buffer[idx + index*4 + 2] = 0.f; + buffer[idx + index*4 + 3] = 0.f; + } + } + idx += kernel_size * 4; + + for (j = 0; j < kernelHeight; ++j) { + for (i = 0; i < kernelWidth; ++i) { + /* transpose the kernel */ + VGint index = j * kernelWidth + i; + VGint kindex = (kernelWidth - i - 1) * kernelHeight + (kernelHeight - j - 1); + buffer[idx + index*4 + 0] = kernel[kindex]; + buffer[idx + index*4 + 1] = kernel[kindex]; + buffer[idx + index*4 + 2] = kernel[kindex]; + buffer[idx + index*4 + 3] = kernel[kindex]; + } + } + + info.dst = d; + info.src = s; + info.setup_shader = &setup_convolution; + info.user_data = (void*)(long)(buffer_len/4); + info.const_buffer = buffer; + info.const_buffer_len = buffer_len * sizeof(VGfloat); + info.tiling_mode = tilingMode; + info.extra_texture = 0; + execute_filter(ctx, &info); + + free(buffer); +} + +void vgSeparableConvolve(VGImage dst, VGImage src, + VGint kernelWidth, + VGint kernelHeight, + VGint shiftX, VGint shiftY, + const VGshort * kernelX, + const VGshort * kernelY, + VGfloat scale, + VGfloat bias, + VGTilingMode tilingMode) +{ + struct vg_context *ctx = vg_current_context(); + VGshort *kernel; + VGint i, j, idx = 0; + const VGint max_kernel_size = vgGeti(VG_MAX_SEPARABLE_KERNEL_SIZE); + + if (dst == VG_INVALID_HANDLE || src == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (kernelWidth <= 0 || kernelHeight <= 0 || + kernelWidth > max_kernel_size || kernelHeight > max_kernel_size) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (!kernelX || !kernelY || + !is_aligned_to(kernelX, 2) || !is_aligned_to(kernelY, 2)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (tilingMode < VG_TILE_FILL || + tilingMode > VG_TILE_REFLECT) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + kernel = malloc(sizeof(VGshort)*kernelWidth*kernelHeight); + for (i = 0; i < kernelWidth; ++i) { + for (j = 0; j < kernelHeight; ++j) { + kernel[idx] = kernelX[i] * kernelY[j]; + ++idx; + } + } + vgConvolve(dst, src, kernelWidth, kernelHeight, shiftX, shiftY, + kernel, scale, bias, tilingMode); + free(kernel); +} + +static INLINE VGfloat compute_gaussian_componenet(VGfloat x, VGfloat y, + VGfloat stdDeviationX, + VGfloat stdDeviationY) +{ + VGfloat mult = 1 / ( 2 * M_PI * stdDeviationX * stdDeviationY); + VGfloat e = exp( - ( pow(x, 2)/(2*pow(stdDeviationX, 2)) + + pow(y, 2)/(2*pow(stdDeviationY, 2)) ) ); + return mult * e; +} + +static INLINE VGint compute_kernel_size(VGfloat deviation) +{ + VGint size = ceil(2.146 * deviation); + if (size > 11) + return 11; + return size; +} + +static void compute_gaussian_kernel(VGfloat *kernel, + VGint width, VGint height, + VGfloat stdDeviationX, + VGfloat stdDeviationY) +{ + VGint i, j; + VGfloat scale = 0.0f; + + for (j = 0; j < height; ++j) { + for (i = 0; i < width; ++i) { + VGint idx = (height - j -1) * width + (width - i -1); + kernel[idx] = compute_gaussian_componenet(i-(ceil(width/2))-1, + j-ceil(height/2)-1, + stdDeviationX, stdDeviationY); + scale += kernel[idx]; + } + } + + for (j = 0; j < height; ++j) { + for (i = 0; i < width; ++i) { + VGint idx = j * width + i; + kernel[idx] /= scale; + } + } +} + +void vgGaussianBlur(VGImage dst, VGImage src, + VGfloat stdDeviationX, + VGfloat stdDeviationY, + VGTilingMode tilingMode) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *d, *s; + VGfloat *buffer, *kernel; + VGint kernel_width, kernel_height, kernel_size; + VGint buffer_len; + VGint idx, i, j; + struct filter_info info; + + if (dst == VG_INVALID_HANDLE || src == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (stdDeviationX <= 0 || stdDeviationY <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (tilingMode < VG_TILE_FILL || + tilingMode > VG_TILE_REFLECT) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + d = (struct vg_image*)dst; + s = (struct vg_image*)src; + + if (vg_image_overlaps(d, s)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + kernel_width = compute_kernel_size(stdDeviationX); + kernel_height = compute_kernel_size(stdDeviationY); + kernel_size = kernel_width * kernel_height; + kernel = malloc(sizeof(VGfloat)*kernel_size); + compute_gaussian_kernel(kernel, kernel_width, kernel_height, + stdDeviationX, stdDeviationY); + + buffer_len = 8 + 2 * 4 * kernel_size; + buffer = (VGfloat*)malloc(buffer_len * sizeof(VGfloat)); + + buffer[0] = 0.f; + buffer[1] = 1.f; + buffer[2] = 2.f; /*unused*/ + buffer[3] = 4.f; /*unused*/ + + buffer[4] = kernel_width * kernel_height; + buffer[5] = 1.f;/*scale*/ + buffer[6] = 0.f;/*bias*/ + buffer[7] = 0.f; + + idx = 8; + for (j = 0; j < kernel_height; ++j) { + for (i = 0; i < kernel_width; ++i) { + VGint index = j * kernel_width + i; + VGfloat x, y; + + x = texture_offset(s->width, kernel_width, i, kernel_width/2); + y = texture_offset(s->height, kernel_height, j, kernel_height/2); + + buffer[idx + index*4 + 0] = x; + buffer[idx + index*4 + 1] = y; + buffer[idx + index*4 + 2] = 0.f; + buffer[idx + index*4 + 3] = 0.f; + } + } + idx += kernel_size * 4; + + for (j = 0; j < kernel_height; ++j) { + for (i = 0; i < kernel_width; ++i) { + /* transpose the kernel */ + VGint index = j * kernel_width + i; + VGint kindex = (kernel_width - i - 1) * kernel_height + (kernel_height - j - 1); + buffer[idx + index*4 + 0] = kernel[kindex]; + buffer[idx + index*4 + 1] = kernel[kindex]; + buffer[idx + index*4 + 2] = kernel[kindex]; + buffer[idx + index*4 + 3] = kernel[kindex]; + } + } + + info.dst = d; + info.src = s; + info.setup_shader = &setup_convolution; + info.user_data = (void*)(long)(buffer_len/4); + info.const_buffer = buffer; + info.const_buffer_len = buffer_len * sizeof(VGfloat); + info.tiling_mode = tilingMode; + info.extra_texture = 0; + execute_filter(ctx, &info); + + free(buffer); + free(kernel); +} + +void vgLookup(VGImage dst, VGImage src, + const VGubyte * redLUT, + const VGubyte * greenLUT, + const VGubyte * blueLUT, + const VGubyte * alphaLUT, + VGboolean outputLinear, + VGboolean outputPremultiplied) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *d, *s; + VGuint color_data[256]; + VGint i; + struct pipe_texture *lut_texture; + VGfloat buffer[4]; + struct filter_info info; + + if (dst == VG_INVALID_HANDLE || src == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (!redLUT || !greenLUT || !blueLUT || !alphaLUT) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + d = (struct vg_image*)dst; + s = (struct vg_image*)src; + + if (vg_image_overlaps(d, s)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + for (i = 0; i < 256; ++i) { + color_data[i] = blueLUT[i] << 24 | greenLUT[i] << 16 | + redLUT[i] << 8 | alphaLUT[i]; + } + lut_texture = create_texture_1d(ctx, color_data, 255); + + buffer[0] = 0.f; + buffer[1] = 0.f; + buffer[2] = 1.f; + buffer[3] = 1.f; + + info.dst = d; + info.src = s; + info.setup_shader = &setup_lookup; + info.user_data = NULL; + info.const_buffer = buffer; + info.const_buffer_len = 4 * sizeof(VGfloat); + info.tiling_mode = VG_TILE_PAD; + info.extra_texture = lut_texture; + + execute_filter(ctx, &info); + + pipe_texture_reference(&lut_texture, NULL); +} + +void vgLookupSingle(VGImage dst, VGImage src, + const VGuint * lookupTable, + VGImageChannel sourceChannel, + VGboolean outputLinear, + VGboolean outputPremultiplied) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *d, *s; + struct pipe_texture *lut_texture; + VGfloat buffer[4]; + struct filter_info info; + VGuint color_data[256]; + VGint i; + + if (dst == VG_INVALID_HANDLE || src == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (!lookupTable || !is_aligned(lookupTable)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (sourceChannel != VG_RED && sourceChannel != VG_GREEN && + sourceChannel != VG_BLUE && sourceChannel != VG_ALPHA) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + d = (struct vg_image*)dst; + s = (struct vg_image*)src; + + if (vg_image_overlaps(d, s)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + for (i = 0; i < 256; ++i) { + VGuint rgba = lookupTable[i]; + VGubyte blue, green, red, alpha; + red = (rgba & 0xff000000)>>24; + green = (rgba & 0x00ff0000)>>16; + blue = (rgba & 0x0000ff00)>> 8; + alpha = (rgba & 0x000000ff)>> 0; + color_data[i] = blue << 24 | green << 16 | + red << 8 | alpha; + } + lut_texture = create_texture_1d(ctx, color_data, 256); + + buffer[0] = 0.f; + buffer[1] = 0.f; + buffer[2] = 1.f; + buffer[3] = 1.f; + + info.dst = d; + info.src = s; + info.setup_shader = &setup_lookup_single; + info.user_data = (void*)sourceChannel; + info.const_buffer = buffer; + info.const_buffer_len = 4 * sizeof(VGfloat); + info.tiling_mode = VG_TILE_PAD; + info.extra_texture = lut_texture; + + execute_filter(ctx, &info); + + pipe_texture_reference(&lut_texture, NULL); +} diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c new file mode 100644 index 00000000000..c437553bc23 --- /dev/null +++ b/src/gallium/state_trackers/vega/api_images.c @@ -0,0 +1,489 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "image.h" + +#include "VG/openvg.h" + +#include "vg_context.h" +#include "vg_translate.h" +#include "api_consts.h" +#include "image.h" + +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "pipe/p_inlines.h" +#include "util/u_blit.h" +#include "util/u_tile.h" +#include "util/u_memory.h" + +static INLINE VGboolean supported_image_format(VGImageFormat format) +{ + switch(format) { + case VG_sRGBX_8888: + case VG_sRGBA_8888: + case VG_sRGBA_8888_PRE: + case VG_sRGB_565: + case VG_sRGBA_5551: + case VG_sRGBA_4444: + case VG_sL_8: + case VG_lRGBX_8888: + case VG_lRGBA_8888: + case VG_lRGBA_8888_PRE: + case VG_lL_8: + case VG_A_8: + case VG_BW_1: +#ifdef OPENVG_VERSION_1_1 + case VG_A_1: + case VG_A_4: +#endif + case VG_sXRGB_8888: + case VG_sARGB_8888: + case VG_sARGB_8888_PRE: + case VG_sARGB_1555: + case VG_sARGB_4444: + case VG_lXRGB_8888: + case VG_lARGB_8888: + case VG_lARGB_8888_PRE: + case VG_sBGRX_8888: + case VG_sBGRA_8888: + case VG_sBGRA_8888_PRE: + case VG_sBGR_565: + case VG_sBGRA_5551: + case VG_sBGRA_4444: + case VG_lBGRX_8888: + case VG_lBGRA_8888: + case VG_lBGRA_8888_PRE: + case VG_sXBGR_8888: + case VG_sABGR_8888: + case VG_sABGR_8888_PRE: + case VG_sABGR_1555: + case VG_sABGR_4444: + case VG_lXBGR_8888: + case VG_lABGR_8888: + case VG_lABGR_8888_PRE: + return VG_TRUE; + default: + return VG_FALSE; + } + return VG_FALSE; +} + +VGImage vgCreateImage(VGImageFormat format, + VGint width, VGint height, + VGbitfield allowedQuality) +{ + struct vg_context *ctx = vg_current_context(); + + if (!supported_image_format(format)) { + vg_set_error(ctx, VG_UNSUPPORTED_IMAGE_FORMAT_ERROR); + return VG_INVALID_HANDLE; + } + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + if (width > vgGeti(VG_MAX_IMAGE_WIDTH) || + height > vgGeti(VG_MAX_IMAGE_HEIGHT)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + if (width * height > vgGeti(VG_MAX_IMAGE_PIXELS)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + + if (!(allowedQuality & ((VG_IMAGE_QUALITY_NONANTIALIASED | + VG_IMAGE_QUALITY_FASTER | + VG_IMAGE_QUALITY_BETTER)))) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + + return (VGImage)image_create(format, width, height); +} + +void vgDestroyImage(VGImage image) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *img = (struct vg_image *)image; + + if (image == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (!vg_object_is_valid((void*)image, VG_OBJECT_IMAGE)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + image_destroy(img); +} + +void vgClearImage(VGImage image, + VGint x, VGint y, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *img; + + if (image == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + img = (struct vg_image*)image; + + if (x + width < 0 || y + height < 0) + return; + + image_clear(img, x, y, width, height); + +} + +void vgImageSubData(VGImage image, + const void * data, + VGint dataStride, + VGImageFormat dataFormat, + VGint x, VGint y, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *img; + + if (image == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (!supported_image_format(dataFormat)) { + vg_set_error(ctx, VG_UNSUPPORTED_IMAGE_FORMAT_ERROR); + return; + } + if (width <= 0 || height <= 0 || !data || !is_aligned(data)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + img = (struct vg_image*)(image); + image_sub_data(img, data, dataStride, dataFormat, + x, y, width, height); +} + +void vgGetImageSubData(VGImage image, + void * data, + VGint dataStride, + VGImageFormat dataFormat, + VGint x, VGint y, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *img; + + if (image == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (!supported_image_format(dataFormat)) { + vg_set_error(ctx, VG_UNSUPPORTED_IMAGE_FORMAT_ERROR); + return; + } + if (width <= 0 || height <= 0 || !data || !is_aligned(data)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + img = (struct vg_image*)image; + image_get_sub_data(img, data, dataStride, dataFormat, + x, y, width, height); +} + +VGImage vgChildImage(VGImage parent, + VGint x, VGint y, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *p; + + if (parent == VG_INVALID_HANDLE || + !vg_context_is_object_valid(ctx, VG_OBJECT_IMAGE, (void*)parent) || + !vg_object_is_valid((void*)parent, VG_OBJECT_IMAGE)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return VG_INVALID_HANDLE; + } + if (width <= 0 || height <= 0 || x < 0 || y < 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + p = (struct vg_image *)parent; + if (x > p->width || y > p->height) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + if (x + width > p->width || y + height > p->height) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + + return (VGImage)image_child_image(p, x, y, width, height); +} + +VGImage vgGetParent(VGImage image) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *img; + + if (image == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return VG_INVALID_HANDLE; + } + + img = (struct vg_image*)image; + if (img->parent) + return (VGImage)img->parent; + else + return image; +} + +void vgCopyImage(VGImage dst, VGint dx, VGint dy, + VGImage src, VGint sx, VGint sy, + VGint width, VGint height, + VGboolean dither) +{ + struct vg_context *ctx = vg_current_context(); + + if (src == VG_INVALID_HANDLE || dst == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + vg_validate_state(ctx); + image_copy((struct vg_image*)dst, dx, dy, + (struct vg_image*)src, sx, sy, + width, height, dither); +} + +void vgDrawImage(VGImage image) +{ + struct vg_context *ctx = vg_current_context(); + + if (!ctx) + return; + + if (image == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + vg_validate_state(ctx); + image_draw((struct vg_image*)image); +} + +void vgSetPixels(VGint dx, VGint dy, + VGImage src, VGint sx, VGint sy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + + vg_validate_state(ctx); + + if (src == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + image_set_pixels(dx, dy, (struct vg_image*)src, sx, sy, width, + height); +} + +void vgGetPixels(VGImage dst, VGint dx, VGint dy, + VGint sx, VGint sy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *img; + + if (dst == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + img = (struct vg_image*)dst; + + image_get_pixels(img, dx, dy, + sx, sy, width, height); +} + +void vgWritePixels(const void * data, VGint dataStride, + VGImageFormat dataFormat, + VGint dx, VGint dy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_context *pipe = ctx->pipe; + + if (!supported_image_format(dataFormat)) { + vg_set_error(ctx, VG_UNSUPPORTED_IMAGE_FORMAT_ERROR); + return; + } + if (!data || !is_aligned(data)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + vg_validate_state(ctx); + { + struct vg_image *img = image_create(dataFormat, width, height); + image_sub_data(img, data, dataStride, dataFormat, 0, 0, + width, height); +#if 0 + struct matrix *matrix = &ctx->state.vg.image_user_to_surface_matrix; + matrix_translate(matrix, dx, dy); + image_draw(img); + matrix_translate(matrix, -dx, -dy); +#else + /* this looks like a better approach */ + image_set_pixels(dx, dy, img, 0, 0, width, height); +#endif + image_destroy(img); + } + /* make sure rendering has completed */ + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); +} + +void vgReadPixels(void * data, VGint dataStride, + VGImageFormat dataFormat, + VGint sx, VGint sy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_context *pipe = ctx->pipe; + struct pipe_screen *screen = pipe->screen; + + struct st_framebuffer *stfb = ctx->draw_buffer; + struct st_renderbuffer *strb = stfb->strb; + struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + + VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4]; + VGfloat *df = (VGfloat*)temp; + VGint y = (fb->height - sy) - 1, yStep = -1; + VGint i; + VGubyte *dst = (VGubyte *)data; + VGint xoffset = 0, yoffset = 0; + + if (!supported_image_format(dataFormat)) { + vg_set_error(ctx, VG_UNSUPPORTED_IMAGE_FORMAT_ERROR); + return; + } + if (!data || !is_aligned(data)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + /* make sure rendering has completed */ + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + if (sx < 0) { + xoffset = -sx; + xoffset *= _vega_size_for_format(dataFormat); + width += sx; + sx = 0; + } + if (sy < 0) { + yoffset = -sy; + height += sy; + sy = 0; + y = (fb->height - sy) - 1; + yoffset *= dataStride; + } + + { + struct pipe_transfer *transfer; + + transfer = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, + 0, 0, width, height); + + /* Do a row at a time to flip image data vertically */ + for (i = 0; i < height; i++) { +#if 0 + debug_printf("%d-%d == %d\n", sy, height, y); +#endif + pipe_get_tile_rgba(transfer, sx, y, width, 1, df); + y += yStep; + _vega_pack_rgba_span_float(ctx, width, temp, dataFormat, + dst + yoffset + xoffset); + dst += dataStride; + } + + screen->tex_transfer_destroy(transfer); + } +} + +void vgCopyPixels(VGint dx, VGint dy, + VGint sx, VGint sy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + struct st_renderbuffer *strb = ctx->draw_buffer->strb; + + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + /* do nothing if we copy from outside the fb */ + if (dx >= (VGint)fb->width || dy >= (VGint)fb->height || + sx >= (VGint)fb->width || sy >= (VGint)fb->height) + return; + + vg_validate_state(ctx); + /* make sure rendering has completed */ + vgFinish(); + + vg_copy_surface(ctx, strb->surface, dx, dy, + strb->surface, sx, sy, width, height); +} diff --git a/src/gallium/state_trackers/vega/api_masks.c b/src/gallium/state_trackers/vega/api_masks.c new file mode 100644 index 00000000000..4f9f3dae173 --- /dev/null +++ b/src/gallium/state_trackers/vega/api_masks.c @@ -0,0 +1,373 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" + +#include "mask.h" +#include "renderer.h" + +#include "vg_context.h" +#include "pipe/p_context.h" +#include "pipe/p_inlines.h" +#include "pipe/internal/p_winsys_screen.h" /* for winsys->update_buffer */ + +#include "util/u_pack_color.h" +#include "util/u_draw_quad.h" +#include "util/u_memory.h" + + +#define DISABLE_1_1_MASKING 1 + +/** + * Draw a screen-aligned quadrilateral. + * Coords are window coords with y=0=bottom. These coords will be transformed + * by the vertex shader and viewport transform. + */ +static void +draw_clear_quad(struct vg_context *st, + float x0, float y0, float x1, float y1, float z, + const VGfloat color[4]) +{ + struct pipe_context *pipe = st->pipe; + struct pipe_buffer *buf; + VGuint i; + + /* positions */ + st->clear.vertices[0][0][0] = x0; + st->clear.vertices[0][0][1] = y0; + + st->clear.vertices[1][0][0] = x1; + st->clear.vertices[1][0][1] = y0; + + st->clear.vertices[2][0][0] = x1; + st->clear.vertices[2][0][1] = y1; + + st->clear.vertices[3][0][0] = x0; + st->clear.vertices[3][0][1] = y1; + + /* same for all verts: */ + for (i = 0; i < 4; i++) { + st->clear.vertices[i][0][2] = z; + st->clear.vertices[i][0][3] = 1.0; + st->clear.vertices[i][1][0] = color[0]; + st->clear.vertices[i][1][1] = color[1]; + st->clear.vertices[i][1][2] = color[2]; + st->clear.vertices[i][1][3] = color[3]; + } + + + /* put vertex data into vbuf */ + buf = pipe_user_buffer_create(pipe->screen, + st->clear.vertices, + sizeof(st->clear.vertices)); + + + /* draw */ + if (buf) { + util_draw_vertex_buffer(pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 2); /* attribs/vert */ + + pipe_buffer_reference(&buf, NULL); + } +} + +/** + * Do vgClear by drawing a quadrilateral. + */ +static void +clear_with_quad(struct vg_context *st, float x0, float y0, + float width, float height, const VGfloat clear_color[4]) +{ + VGfloat x1, y1; + + vg_validate_state(st); + + x1 = x0 + width; + y1 = y0 + height; + + /* + printf("%s %f,%f %f,%f\n", __FUNCTION__, + x0, y0, + x1, y1); + */ + + if (st->pipe->winsys && st->pipe->winsys->update_buffer) + st->pipe->winsys->update_buffer( st->pipe->winsys, + st->pipe->priv ); + + cso_save_blend(st->cso_context); + cso_save_rasterizer(st->cso_context); + cso_save_fragment_shader(st->cso_context); + cso_save_vertex_shader(st->cso_context); + + /* blend state: RGBA masking */ + { + struct pipe_blend_state blend; + memset(&blend, 0, sizeof(blend)); + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.colormask |= PIPE_MASK_R; + blend.colormask |= PIPE_MASK_G; + blend.colormask |= PIPE_MASK_B; + blend.colormask |= PIPE_MASK_A; + cso_set_blend(st->cso_context, &blend); + } + + cso_set_rasterizer(st->cso_context, &st->clear.raster); + + cso_set_fragment_shader_handle(st->cso_context, st->clear.fs); + cso_set_vertex_shader_handle(st->cso_context, vg_clear_vs(st)); + + /* draw quad matching scissor rect (XXX verify coord round-off) */ + draw_clear_quad(st, x0, y0, x1, y1, 0, clear_color); + + /* Restore pipe state */ + cso_restore_blend(st->cso_context); + cso_restore_rasterizer(st->cso_context); + cso_restore_fragment_shader(st->cso_context); + cso_restore_vertex_shader(st->cso_context); +} + + +void vgMask(VGHandle mask, VGMaskOperation operation, + VGint x, VGint y, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + + if (width <=0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (operation < VG_CLEAR_MASK || operation > VG_SUBTRACT_MASK) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + + vg_validate_state(ctx); + + if (operation == VG_CLEAR_MASK) { + mask_fill(x, y, width, height, 0.f); + } else if (operation == VG_FILL_MASK) { + mask_fill(x, y, width, height, 1.f); + } else if (vg_object_is_valid((void*)mask, VG_OBJECT_IMAGE)) { + struct vg_image *image = (struct vg_image *)mask; + mask_using_image(image, operation, x, y, width, height); + } else if (vg_object_is_valid((void*)mask, VG_OBJECT_MASK)) { +#if DISABLE_1_1_MASKING + return; +#else + struct vg_mask_layer *layer = (struct vg_mask_layer *)mask; + mask_using_layer(layer, operation, x, y, width, height); +#endif + } else { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + } +} + +void vgClear(VGint x, VGint y, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_framebuffer_state *fb; + + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + vg_validate_state(ctx); +#if 0 + debug_printf("Clear [%d, %d, %d, %d] with [%f, %f, %f, %f]\n", + x, y, width, height, + ctx->state.vg.clear_color[0], + ctx->state.vg.clear_color[1], + ctx->state.vg.clear_color[2], + ctx->state.vg.clear_color[3]); +#endif + + fb = &ctx->state.g3d.fb; + /* check for a whole surface clear */ + if (!ctx->state.vg.scissoring && + (x == 0 && y == 0 && width == fb->width && height == fb->height)) { + ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL, + ctx->state.vg.clear_color, 1., 0); + } else { + clear_with_quad(ctx, x, y, width, height, ctx->state.vg.clear_color); + } +} + + +#ifdef OPENVG_VERSION_1_1 + + +void vgRenderToMask(VGPath path, + VGbitfield paintModes, + VGMaskOperation operation) +{ + struct vg_context *ctx = vg_current_context(); + + if (path == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (!paintModes || (paintModes&(~(VG_STROKE_PATH|VG_FILL_PATH)))) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (operation < VG_CLEAR_MASK || + operation > VG_SUBTRACT_MASK) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (!vg_object_is_valid((void*)path, VG_OBJECT_PATH)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + +#if DISABLE_1_1_MASKING + return; +#endif + + vg_validate_state(ctx); + + mask_render_to((struct path *)path, paintModes, operation); +} + +VGMaskLayer vgCreateMaskLayer(VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + + if (width <= 0 || height <= 0 || + width > vgGeti(VG_MAX_IMAGE_WIDTH) || + height > vgGeti(VG_MAX_IMAGE_HEIGHT)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + + return (VGMaskLayer)mask_layer_create(width, height); +} + +void vgDestroyMaskLayer(VGMaskLayer maskLayer) +{ + struct vg_mask_layer *mask = 0; + struct vg_context *ctx = vg_current_context(); + + if (maskLayer == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (!vg_object_is_valid((void*)maskLayer, VG_OBJECT_MASK)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + mask = (struct vg_mask_layer *)maskLayer; + mask_layer_destroy(mask); +} + +void vgFillMaskLayer(VGMaskLayer maskLayer, + VGint x, VGint y, + VGint width, VGint height, + VGfloat value) +{ + struct vg_mask_layer *mask = 0; + struct vg_context *ctx = vg_current_context(); + + if (maskLayer == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (value < 0 || value > 1) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (x < 0 || y < 0 || (x + width) < 0 || (y + height) < 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (!vg_object_is_valid((void*)maskLayer, VG_OBJECT_MASK)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + mask = (struct vg_mask_layer*)maskLayer; + + if (x + width > mask_layer_width(mask) || + y + height > mask_layer_height(mask)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + +#if DISABLE_1_1_MASKING + return; +#endif + mask_layer_fill(mask, x, y, width, height, value); +} + +void vgCopyMask(VGMaskLayer maskLayer, + VGint sx, VGint sy, + VGint dx, VGint dy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_mask_layer *mask = 0; + + if (maskLayer == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (!vg_object_is_valid((void*)maskLayer, VG_OBJECT_MASK)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + +#if DISABLE_1_1_MASKING + return; +#endif + + mask = (struct vg_mask_layer*)maskLayer; + mask_copy(mask, sx, sy, dx, dy, width, height); +} + +#endif diff --git a/src/gallium/state_trackers/vega/api_misc.c b/src/gallium/state_trackers/vega/api_misc.c new file mode 100644 index 00000000000..78ba0bc1103 --- /dev/null +++ b/src/gallium/state_trackers/vega/api_misc.c @@ -0,0 +1,83 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" + +#include "vg_context.h" + +/* Hardware Queries */ +VGHardwareQueryResult vgHardwareQuery(VGHardwareQueryType key, + VGint setting) +{ + struct vg_context *ctx = vg_current_context(); + + if (key < VG_IMAGE_FORMAT_QUERY || + key > VG_PATH_DATATYPE_QUERY) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_HARDWARE_UNACCELERATED; + } + + if (key == VG_IMAGE_FORMAT_QUERY) { + if (setting < VG_sRGBX_8888 || + setting > VG_lABGR_8888_PRE) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_HARDWARE_UNACCELERATED; + } + } else if (key == VG_PATH_DATATYPE_QUERY) { + if (setting < VG_PATH_DATATYPE_S_8 || + setting > VG_PATH_DATATYPE_F) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_HARDWARE_UNACCELERATED; + } + } + /* we're supposed to accelerate everything */ + return VG_HARDWARE_ACCELERATED; +} + +/* Renderer and Extension Information */ +const VGubyte *vgGetString(VGStringID name) +{ + struct vg_context *ctx = vg_current_context(); + static const VGubyte *vendor = (VGubyte *)"Tungsten Graphics, Inc"; + static const VGubyte *renderer = (VGubyte *)"Vega OpenVG 1.0"; + static const VGubyte *version = (VGubyte *)"1.0"; + + if (!ctx) + return NULL; + + switch(name) { + case VG_VENDOR: + return vendor; + case VG_RENDERER: + return renderer; + case VG_VERSION: + return version; + case VG_EXTENSIONS: + return NULL; + default: + return NULL; + } +} diff --git a/src/gallium/state_trackers/vega/api_paint.c b/src/gallium/state_trackers/vega/api_paint.c new file mode 100644 index 00000000000..dd3ac5bdb09 --- /dev/null +++ b/src/gallium/state_trackers/vega/api_paint.c @@ -0,0 +1,166 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" + +#include "vg_context.h" +#include "paint.h" +#include "image.h" + +VGPaint vgCreatePaint(void) +{ + return (VGPaint) paint_create(vg_current_context()); +} + +void vgDestroyPaint(VGPaint p) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_paint *paint; + + if (p == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + paint = (struct vg_paint *)p; + paint_destroy(paint); +} + +void vgSetPaint(VGPaint paint, VGbitfield paintModes) +{ + struct vg_context *ctx = vg_current_context(); + + if (paint == VG_INVALID_HANDLE) { + /* restore the default */ + paint = (VGPaint)ctx->default_paint; + } else if (!vg_object_is_valid((void*)paint, VG_OBJECT_PAINT)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (!(paintModes & ((VG_FILL_PATH|VG_STROKE_PATH)))) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (paintModes & VG_FILL_PATH) { + ctx->state.vg.fill_paint = (struct vg_paint *)paint; + } + if (paintModes & VG_STROKE_PATH) { + ctx->state.vg.stroke_paint = (struct vg_paint *)paint; + } +} + +VGPaint vgGetPaint(VGPaintMode paintMode) +{ + struct vg_context *ctx = vg_current_context(); + VGPaint paint = VG_INVALID_HANDLE; + + if (paintMode < VG_STROKE_PATH || paintMode > VG_FILL_PATH) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + + if (paintMode == VG_FILL_PATH) + paint = (VGPaint)ctx->state.vg.fill_paint; + else if (paintMode == VG_STROKE_PATH) + paint = (VGPaint)ctx->state.vg.stroke_paint; + + if (paint == (VGPaint)ctx->default_paint) + paint = VG_INVALID_HANDLE; + + return paint; +} + +void vgSetColor(VGPaint paint, VGuint rgba) +{ + struct vg_context *ctx = vg_current_context(); + + if (paint == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (!vg_object_is_valid((void*)paint, VG_OBJECT_PAINT)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + { + struct vg_paint *p = (struct vg_paint *)paint; + paint_set_colori(p, rgba); + } +} + +VGuint vgGetColor(VGPaint paint) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_paint *p; + VGuint rgba = 0; + + if (paint == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return rgba; + } + + if (!vg_object_is_valid((void*)paint, VG_OBJECT_PAINT)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return rgba; + } + p = (struct vg_paint *)paint; + + return paint_colori(p); +} + +void vgPaintPattern(VGPaint paint, VGImage pattern) +{ + struct vg_context *ctx = vg_current_context(); + + if (paint == VG_INVALID_HANDLE || + !vg_context_is_object_valid(ctx, VG_OBJECT_PAINT, (void *)paint)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (pattern == VG_INVALID_HANDLE) { + paint_set_type((struct vg_paint*)paint, VG_PAINT_TYPE_COLOR); + return; + } + + if (!vg_context_is_object_valid(ctx, VG_OBJECT_IMAGE, (void *)pattern)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + + if (!vg_object_is_valid((void*)paint, VG_OBJECT_PAINT) || + !vg_object_is_valid((void*)pattern, VG_OBJECT_IMAGE)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + paint_set_pattern((struct vg_paint*)paint, + (struct vg_image*)pattern); +} + diff --git a/src/gallium/state_trackers/vega/api_params.c b/src/gallium/state_trackers/vega/api_params.c new file mode 100644 index 00000000000..db77fd9cb05 --- /dev/null +++ b/src/gallium/state_trackers/vega/api_params.c @@ -0,0 +1,1673 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" + +#include "vg_context.h" +#include "paint.h" +#include "path.h" +#include "image.h" +#include "matrix.h" +#include "api_consts.h" + +#include "pipe/p_compiler.h" +#include "util/u_pointer.h" +#include "util/u_math.h" + +#include <math.h> + +static INLINE struct vg_state *current_state() +{ + struct vg_context *ctx = vg_current_context(); + if (!ctx) + return 0; + else + return &ctx->state.vg; +} + +static INLINE VGboolean count_in_bounds(VGParamType type, VGint count) +{ + if (count < 0) + return VG_FALSE; + + if (type == VG_SCISSOR_RECTS) + return (!(count % 4) && (count >= 0 || count <= VEGA_MAX_SCISSOR_RECTS * 4)); + else if (type == VG_STROKE_DASH_PATTERN) { + return count <= VEGA_MAX_DASH_COUNT; + } else { + VGint real_count = vgGetVectorSize(type); + return count == real_count; + } +} + +void vgSetf (VGParamType type, VGfloat value) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_state *state = current_state(); + VGErrorCode error = VG_NO_ERROR; + + switch(type) { + case VG_MATRIX_MODE: + case VG_FILL_RULE: + case VG_IMAGE_QUALITY: + case VG_RENDERING_QUALITY: + case VG_BLEND_MODE: + case VG_IMAGE_MODE: +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM: +#endif + case VG_STROKE_CAP_STYLE: + case VG_STROKE_JOIN_STYLE: + case VG_STROKE_DASH_PHASE_RESET: + case VG_MASKING: + case VG_SCISSORING: + case VG_PIXEL_LAYOUT: + case VG_SCREEN_LAYOUT: + case VG_FILTER_FORMAT_LINEAR: + case VG_FILTER_FORMAT_PREMULTIPLIED: + case VG_FILTER_CHANNEL_MASK: + + case VG_MAX_SCISSOR_RECTS: + case VG_MAX_DASH_COUNT: + case VG_MAX_KERNEL_SIZE: + case VG_MAX_SEPARABLE_KERNEL_SIZE: + case VG_MAX_COLOR_RAMP_STOPS: + case VG_MAX_IMAGE_WIDTH: + case VG_MAX_IMAGE_HEIGHT: + case VG_MAX_IMAGE_PIXELS: + case VG_MAX_IMAGE_BYTES: + case VG_MAX_GAUSSIAN_STD_DEVIATION: + case VG_MAX_FLOAT: + vgSeti(type, floor(value)); + return; + break; + case VG_STROKE_LINE_WIDTH: + state->stroke.line_width.f = value; + state->stroke.line_width.i = float_to_int_floor(*((VGuint*)(&value))); + break; + case VG_STROKE_MITER_LIMIT: + state->stroke.miter_limit.f = value; + state->stroke.miter_limit.i = float_to_int_floor(*((VGuint*)(&value))); + break; + case VG_STROKE_DASH_PHASE: + state->stroke.dash_phase.f = value; + state->stroke.dash_phase.i = float_to_int_floor(*((VGuint*)(&value))); + break; + default: + error = VG_ILLEGAL_ARGUMENT_ERROR; + break; + } + vg_set_error(ctx, error); +} + +void vgSeti (VGParamType type, VGint value) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_state *state = current_state(); + VGErrorCode error = VG_NO_ERROR; + + switch(type) { + case VG_MATRIX_MODE: + if (value < VG_MATRIX_PATH_USER_TO_SURFACE || +#ifdef OPENVG_VERSION_1_1 + value > VG_MATRIX_GLYPH_USER_TO_SURFACE) +#else + value > VG_MATRIX_STROKE_PAINT_TO_USER) +#endif + error = VG_ILLEGAL_ARGUMENT_ERROR; + else + state->matrix_mode = value; + break; + case VG_FILL_RULE: + if (value < VG_EVEN_ODD || + value > VG_NON_ZERO) + error = VG_ILLEGAL_ARGUMENT_ERROR; + else + state->fill_rule = value; + break; + case VG_IMAGE_QUALITY: + state->image_quality = value; + break; + case VG_RENDERING_QUALITY: + if (value < VG_RENDERING_QUALITY_NONANTIALIASED || + value > VG_RENDERING_QUALITY_BETTER) + error = VG_ILLEGAL_ARGUMENT_ERROR; + else + state->rendering_quality = value; + break; + case VG_BLEND_MODE: + if (value < VG_BLEND_SRC || + value > VG_BLEND_ADDITIVE) + error = VG_ILLEGAL_ARGUMENT_ERROR; + else { + ctx->state.dirty |= BLEND_DIRTY; + state->blend_mode = value; + } + break; + case VG_IMAGE_MODE: + if (value < VG_DRAW_IMAGE_NORMAL || + value > VG_DRAW_IMAGE_STENCIL) + error = VG_ILLEGAL_ARGUMENT_ERROR; + else + state->image_mode = value; +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM: + state->color_transform = value; +#endif + break; + case VG_STROKE_LINE_WIDTH: + state->stroke.line_width.f = value; + state->stroke.line_width.i = value; + break; + case VG_STROKE_CAP_STYLE: + if (value < VG_CAP_BUTT || + value > VG_CAP_SQUARE) + error = VG_ILLEGAL_ARGUMENT_ERROR; + else + state->stroke.cap_style = value; + break; + case VG_STROKE_JOIN_STYLE: + if (value < VG_JOIN_MITER || + value > VG_JOIN_BEVEL) + error = VG_ILLEGAL_ARGUMENT_ERROR; + else + state->stroke.join_style = value; + break; + case VG_STROKE_MITER_LIMIT: + state->stroke.miter_limit.f = value; + state->stroke.miter_limit.i = value; + break; + case VG_STROKE_DASH_PHASE: + state->stroke.dash_phase.f = value; + state->stroke.dash_phase.i = value; + break; + case VG_STROKE_DASH_PHASE_RESET: + state->stroke.dash_phase_reset = value; + break; + case VG_MASKING: + state->masking = value; + break; + case VG_SCISSORING: + state->scissoring = value; + ctx->state.dirty |= DEPTH_STENCIL_DIRTY; + break; + case VG_PIXEL_LAYOUT: + if (value < VG_PIXEL_LAYOUT_UNKNOWN || + value > VG_PIXEL_LAYOUT_BGR_HORIZONTAL) + error = VG_ILLEGAL_ARGUMENT_ERROR; + else + state->pixel_layout = value; + break; + case VG_SCREEN_LAYOUT: + /* read only ignore */ + break; + case VG_FILTER_FORMAT_LINEAR: + state->filter_format_linear = value; + break; + case VG_FILTER_FORMAT_PREMULTIPLIED: + state->filter_format_premultiplied = value; + break; + case VG_FILTER_CHANNEL_MASK: + state->filter_channel_mask = value; + break; + + case VG_MAX_SCISSOR_RECTS: + case VG_MAX_DASH_COUNT: + case VG_MAX_KERNEL_SIZE: + case VG_MAX_SEPARABLE_KERNEL_SIZE: + case VG_MAX_COLOR_RAMP_STOPS: + case VG_MAX_IMAGE_WIDTH: + case VG_MAX_IMAGE_HEIGHT: + case VG_MAX_IMAGE_PIXELS: + case VG_MAX_IMAGE_BYTES: + case VG_MAX_GAUSSIAN_STD_DEVIATION: + case VG_MAX_FLOAT: + /* read only ignore */ + break; + default: + error = VG_ILLEGAL_ARGUMENT_ERROR; + break; + } + vg_set_error(ctx, error); +} + +void vgSetfv(VGParamType type, VGint count, + const VGfloat * values) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_state *state = current_state(); + VGErrorCode error = VG_NO_ERROR; + + if ((count && !values) || !count_in_bounds(type, count) || !is_aligned(values)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + switch(type) { + case VG_MATRIX_MODE: + case VG_FILL_RULE: + case VG_IMAGE_QUALITY: + case VG_RENDERING_QUALITY: + case VG_BLEND_MODE: + case VG_IMAGE_MODE: +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM: +#endif + case VG_STROKE_CAP_STYLE: + case VG_STROKE_JOIN_STYLE: + case VG_STROKE_DASH_PHASE_RESET: + case VG_MASKING: + case VG_SCISSORING: + case VG_PIXEL_LAYOUT: + case VG_SCREEN_LAYOUT: + case VG_FILTER_FORMAT_LINEAR: + case VG_FILTER_FORMAT_PREMULTIPLIED: + case VG_FILTER_CHANNEL_MASK: + vgSeti(type, floor(values[0])); + return; + break; + case VG_SCISSOR_RECTS: { + VGint i; + VGuint *x = (VGuint*)values; + for (i = 0; i < count; ++i) { + state->scissor_rects[i].f = values[i]; + state->scissor_rects[i].i = float_to_int_floor(x[i]); + } + state->scissor_rects_num = count / 4; + ctx->state.dirty |= DEPTH_STENCIL_DIRTY; + } + break; +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM_VALUES: { + VGint i; + for (i = 0; i < count; ++i) { + state->color_transform_values[i] = values[i]; + } + } + break; +#endif + case VG_STROKE_LINE_WIDTH: + state->stroke.line_width.f = values[0]; + state->stroke.line_width.i = float_to_int_floor(*((VGuint*)(values))); + break; + case VG_STROKE_MITER_LIMIT: + state->stroke.miter_limit.f = values[0]; + state->stroke.miter_limit.i = float_to_int_floor(*((VGuint*)(values))); + break; + case VG_STROKE_DASH_PATTERN: { + int i; + for (i = 0; i < count; ++i) { + state->stroke.dash_pattern[i].f = values[i]; + state->stroke.dash_pattern[i].i = + float_to_int_floor(*((VGuint*)(values + i))); + } + state->stroke.dash_pattern_num = count; + } + break; + case VG_STROKE_DASH_PHASE: + state->stroke.dash_phase.f = values[0]; + state->stroke.dash_phase.i = float_to_int_floor(*((VGuint*)(values))); + break; + case VG_TILE_FILL_COLOR: + state->tile_fill_color[0] = values[0]; + state->tile_fill_color[1] = values[1]; + state->tile_fill_color[2] = values[2]; + state->tile_fill_color[3] = values[3]; + + state->tile_fill_colori[0] = float_to_int_floor(*((VGuint*)(values + 0))); + state->tile_fill_colori[1] = float_to_int_floor(*((VGuint*)(values + 1))); + state->tile_fill_colori[2] = float_to_int_floor(*((VGuint*)(values + 2))); + state->tile_fill_colori[3] = float_to_int_floor(*((VGuint*)(values + 3))); + break; + case VG_CLEAR_COLOR: + state->clear_color[0] = values[0]; + state->clear_color[1] = values[1]; + state->clear_color[2] = values[2]; + state->clear_color[3] = values[3]; + + state->clear_colori[0] = float_to_int_floor(*((VGuint*)(values + 0))); + state->clear_colori[1] = float_to_int_floor(*((VGuint*)(values + 1))); + state->clear_colori[2] = float_to_int_floor(*((VGuint*)(values + 2))); + state->clear_colori[3] = float_to_int_floor(*((VGuint*)(values + 3))); + break; +#ifdef OPENVG_VERSION_1_1 + case VG_GLYPH_ORIGIN: + state->glyph_origin[0].f = values[0]; + state->glyph_origin[1].f = values[1]; + + state->glyph_origin[0].i = float_to_int_floor(*((VGuint*)(values + 0))); + state->glyph_origin[1].i = float_to_int_floor(*((VGuint*)(values + 1))); + break; +#endif + + case VG_MAX_SCISSOR_RECTS: + case VG_MAX_DASH_COUNT: + case VG_MAX_KERNEL_SIZE: + case VG_MAX_SEPARABLE_KERNEL_SIZE: + case VG_MAX_COLOR_RAMP_STOPS: + case VG_MAX_IMAGE_WIDTH: + case VG_MAX_IMAGE_HEIGHT: + case VG_MAX_IMAGE_PIXELS: + case VG_MAX_IMAGE_BYTES: + case VG_MAX_GAUSSIAN_STD_DEVIATION: + case VG_MAX_FLOAT: + break; + default: + error = VG_ILLEGAL_ARGUMENT_ERROR; + break; + } + vg_set_error(ctx, error); +} + +void vgSetiv(VGParamType type, VGint count, + const VGint * values) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_state *state = current_state(); + + if ((count && !values) || !count_in_bounds(type, count) || !is_aligned(values)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + switch(type) { + case VG_MATRIX_MODE: + case VG_FILL_RULE: + case VG_IMAGE_QUALITY: + case VG_RENDERING_QUALITY: + case VG_BLEND_MODE: + case VG_IMAGE_MODE: +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM: +#endif + case VG_STROKE_CAP_STYLE: + case VG_STROKE_JOIN_STYLE: + case VG_STROKE_DASH_PHASE_RESET: + case VG_MASKING: + case VG_SCISSORING: + case VG_PIXEL_LAYOUT: + case VG_SCREEN_LAYOUT: + case VG_FILTER_FORMAT_LINEAR: + case VG_FILTER_FORMAT_PREMULTIPLIED: + case VG_FILTER_CHANNEL_MASK: + vgSeti(type, values[0]); + return; + break; + case VG_SCISSOR_RECTS: { + VGint i; + for (i = 0; i < count; ++i) { + state->scissor_rects[i].i = values[i]; + state->scissor_rects[i].f = values[i]; + } + state->scissor_rects_num = count / 4; + ctx->state.dirty |= DEPTH_STENCIL_DIRTY; + } + break; +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM_VALUES: { + VGint i; + for (i = 0; i < count; ++i) { + state->color_transform_values[i] = values[i]; + } + } + break; +#endif + case VG_STROKE_LINE_WIDTH: + state->stroke.line_width.f = values[0]; + state->stroke.line_width.i = values[0]; + break; + case VG_STROKE_MITER_LIMIT: + state->stroke.miter_limit.f = values[0]; + state->stroke.miter_limit.i = values[0]; + break; + case VG_STROKE_DASH_PATTERN: { + int i; + for (i = 0; i < count; ++i) { + state->stroke.dash_pattern[i].f = values[i]; + state->stroke.dash_pattern[i].i = values[i]; + } + state->stroke.dash_pattern_num = count; + } + break; + case VG_STROKE_DASH_PHASE: + state->stroke.dash_phase.f = values[0]; + state->stroke.dash_phase.i = values[0]; + break; + case VG_TILE_FILL_COLOR: + state->tile_fill_color[0] = values[0]; + state->tile_fill_color[1] = values[1]; + state->tile_fill_color[2] = values[2]; + state->tile_fill_color[3] = values[3]; + + state->tile_fill_colori[0] = values[0]; + state->tile_fill_colori[1] = values[1]; + state->tile_fill_colori[2] = values[2]; + state->tile_fill_colori[3] = values[3]; + break; + case VG_CLEAR_COLOR: + state->clear_color[0] = values[0]; + state->clear_color[1] = values[1]; + state->clear_color[2] = values[2]; + state->clear_color[3] = values[3]; + + state->clear_colori[0] = values[0]; + state->clear_colori[1] = values[1]; + state->clear_colori[2] = values[2]; + state->clear_colori[3] = values[3]; + break; +#ifdef OPENVG_VERSION_1_1 + case VG_GLYPH_ORIGIN: + state->glyph_origin[0].f = values[0]; + state->glyph_origin[1].f = values[1]; + state->glyph_origin[0].i = values[0]; + state->glyph_origin[1].i = values[1]; + break; +#endif + + case VG_MAX_SCISSOR_RECTS: + case VG_MAX_DASH_COUNT: + case VG_MAX_KERNEL_SIZE: + case VG_MAX_SEPARABLE_KERNEL_SIZE: + case VG_MAX_COLOR_RAMP_STOPS: + case VG_MAX_IMAGE_WIDTH: + case VG_MAX_IMAGE_HEIGHT: + case VG_MAX_IMAGE_PIXELS: + case VG_MAX_IMAGE_BYTES: + case VG_MAX_GAUSSIAN_STD_DEVIATION: + case VG_MAX_FLOAT: + break; + + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + } +} + +VGfloat vgGetf(VGParamType type) +{ + struct vg_context *ctx = vg_current_context(); + const struct vg_state *state = current_state(); + VGErrorCode error = VG_NO_ERROR; + VGfloat value = 0.0f; + + switch(type) { + case VG_MATRIX_MODE: + case VG_FILL_RULE: + case VG_IMAGE_QUALITY: + case VG_RENDERING_QUALITY: + case VG_BLEND_MODE: + case VG_IMAGE_MODE: +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM: +#endif + case VG_STROKE_CAP_STYLE: + case VG_STROKE_JOIN_STYLE: + case VG_STROKE_DASH_PHASE_RESET: + case VG_MASKING: + case VG_SCISSORING: + case VG_PIXEL_LAYOUT: + case VG_SCREEN_LAYOUT: + case VG_FILTER_FORMAT_LINEAR: + case VG_FILTER_FORMAT_PREMULTIPLIED: + case VG_FILTER_CHANNEL_MASK: + return vgGeti(type); + break; + case VG_STROKE_LINE_WIDTH: + value = state->stroke.line_width.f; + break; + case VG_STROKE_MITER_LIMIT: + value = state->stroke.miter_limit.f; + break; + case VG_STROKE_DASH_PHASE: + value = state->stroke.dash_phase.f; + break; + + case VG_MAX_SCISSOR_RECTS: + case VG_MAX_DASH_COUNT: + case VG_MAX_KERNEL_SIZE: + case VG_MAX_SEPARABLE_KERNEL_SIZE: + case VG_MAX_COLOR_RAMP_STOPS: + case VG_MAX_IMAGE_WIDTH: + case VG_MAX_IMAGE_HEIGHT: + case VG_MAX_IMAGE_PIXELS: + case VG_MAX_IMAGE_BYTES: + case VG_MAX_GAUSSIAN_STD_DEVIATION: + return vgGeti(type); + break; + case VG_MAX_FLOAT: + value = 1e+10;/*must be at least 1e+10*/ + break; + default: + error = VG_ILLEGAL_ARGUMENT_ERROR; + break; + } + vg_set_error(ctx, error); + return value; +} + +VGint vgGeti(VGParamType type) +{ + const struct vg_state *state = current_state(); + struct vg_context *ctx = vg_current_context(); + VGErrorCode error = VG_NO_ERROR; + VGint value = 0; + + switch(type) { + case VG_MATRIX_MODE: + value = state->matrix_mode; + break; + case VG_FILL_RULE: + value = state->fill_rule; + break; + case VG_IMAGE_QUALITY: + value = state->image_quality; + break; + case VG_RENDERING_QUALITY: + value = state->rendering_quality; + break; + case VG_BLEND_MODE: + value = state->blend_mode; + break; + case VG_IMAGE_MODE: + value = state->image_mode; + break; +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM: + value = state->color_transform; + break; +#endif + case VG_STROKE_LINE_WIDTH: + value = state->stroke.line_width.i; + break; + case VG_STROKE_CAP_STYLE: + value = state->stroke.cap_style; + break; + case VG_STROKE_JOIN_STYLE: + value = state->stroke.join_style; + break; + case VG_STROKE_MITER_LIMIT: + value = state->stroke.miter_limit.i; + break; + case VG_STROKE_DASH_PHASE: + value = state->stroke.dash_phase.i; + break; + case VG_STROKE_DASH_PHASE_RESET: + value = state->stroke.dash_phase_reset; + break; + case VG_MASKING: + value = state->masking; + break; + case VG_SCISSORING: + value = state->scissoring; + break; + case VG_PIXEL_LAYOUT: + value = state->pixel_layout; + break; + case VG_SCREEN_LAYOUT: + value = state->screen_layout; + break; + case VG_FILTER_FORMAT_LINEAR: + value = state->filter_format_linear; + break; + case VG_FILTER_FORMAT_PREMULTIPLIED: + value = state->filter_format_premultiplied; + break; + case VG_FILTER_CHANNEL_MASK: + value = state->filter_channel_mask; + break; + + case VG_MAX_SCISSOR_RECTS: + value = 32; /*must be at least 32*/ + break; + case VG_MAX_DASH_COUNT: + value = 16; /*must be at least 16*/ + break; + case VG_MAX_KERNEL_SIZE: + value = 7; /*must be at least 7*/ + break; + case VG_MAX_SEPARABLE_KERNEL_SIZE: + value = 15; /*must be at least 15*/ + break; + case VG_MAX_COLOR_RAMP_STOPS: + value = 256; /*must be at least 32*/ + break; + case VG_MAX_IMAGE_WIDTH: + value = 2048; + break; + case VG_MAX_IMAGE_HEIGHT: + value = 2048; + break; + case VG_MAX_IMAGE_PIXELS: + value = 2048*2048; + break; + case VG_MAX_IMAGE_BYTES: + value = 2048*2048 * 4; + break; + case VG_MAX_GAUSSIAN_STD_DEVIATION: + value = 128; /*must be at least 128*/ + break; + + case VG_MAX_FLOAT: { + VGfloat val = vgGetf(type); + value = float_to_int_floor(*((VGuint*)&val)); + } + break; + default: + error = VG_ILLEGAL_ARGUMENT_ERROR; + break; + } + vg_set_error(ctx, error); + return value; +} + +VGint vgGetVectorSize(VGParamType type) +{ + struct vg_context *ctx = vg_current_context(); + const struct vg_state *state = current_state(); + switch(type) { + case VG_MATRIX_MODE: + case VG_FILL_RULE: + case VG_IMAGE_QUALITY: + case VG_RENDERING_QUALITY: + case VG_BLEND_MODE: + case VG_IMAGE_MODE: + return 1; + case VG_SCISSOR_RECTS: + return state->scissor_rects_num * 4; +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM: + return 1; + case VG_COLOR_TRANSFORM_VALUES: + return 8; +#endif + case VG_STROKE_LINE_WIDTH: + case VG_STROKE_CAP_STYLE: + case VG_STROKE_JOIN_STYLE: + case VG_STROKE_MITER_LIMIT: + return 1; + case VG_STROKE_DASH_PATTERN: + return state->stroke.dash_pattern_num; + case VG_STROKE_DASH_PHASE: + return 1; + case VG_STROKE_DASH_PHASE_RESET: + return 1; + case VG_TILE_FILL_COLOR: + return 4; + case VG_CLEAR_COLOR: + return 4; +#ifdef OPENVG_VERSION_1_1 + case VG_GLYPH_ORIGIN: + return 2; +#endif + case VG_MASKING: + return 1; + case VG_SCISSORING: + return 1; + case VG_PIXEL_LAYOUT: + return 1; + case VG_SCREEN_LAYOUT: + return 1; + case VG_FILTER_FORMAT_LINEAR: + return 1; + case VG_FILTER_FORMAT_PREMULTIPLIED: + return 1; + case VG_FILTER_CHANNEL_MASK: + return 1; + + case VG_MAX_COLOR_RAMP_STOPS: + return 1; + case VG_MAX_SCISSOR_RECTS: + case VG_MAX_DASH_COUNT: + case VG_MAX_KERNEL_SIZE: + case VG_MAX_SEPARABLE_KERNEL_SIZE: + case VG_MAX_IMAGE_WIDTH: + case VG_MAX_IMAGE_HEIGHT: + case VG_MAX_IMAGE_PIXELS: + case VG_MAX_IMAGE_BYTES: + case VG_MAX_FLOAT: + case VG_MAX_GAUSSIAN_STD_DEVIATION: + return 1; + default: + if (ctx) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return 0; + } +} + +void vgGetfv(VGParamType type, VGint count, + VGfloat * values) +{ + const struct vg_state *state = current_state(); + struct vg_context *ctx = vg_current_context(); + VGint real_count = vgGetVectorSize(type); + + if (!values || count <= 0 || count > real_count || !is_aligned(values)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + switch(type) { + case VG_MATRIX_MODE: + case VG_FILL_RULE: + case VG_IMAGE_QUALITY: + case VG_RENDERING_QUALITY: + case VG_BLEND_MODE: + case VG_IMAGE_MODE: +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM: +#endif + case VG_STROKE_CAP_STYLE: + case VG_STROKE_JOIN_STYLE: + case VG_STROKE_DASH_PHASE_RESET: + case VG_MASKING: + case VG_SCISSORING: + case VG_PIXEL_LAYOUT: + case VG_SCREEN_LAYOUT: + case VG_FILTER_FORMAT_LINEAR: + case VG_FILTER_FORMAT_PREMULTIPLIED: + case VG_FILTER_CHANNEL_MASK: + case VG_MAX_SCISSOR_RECTS: + case VG_MAX_DASH_COUNT: + case VG_MAX_KERNEL_SIZE: + case VG_MAX_SEPARABLE_KERNEL_SIZE: + case VG_MAX_COLOR_RAMP_STOPS: + case VG_MAX_IMAGE_WIDTH: + case VG_MAX_IMAGE_HEIGHT: + case VG_MAX_IMAGE_PIXELS: + case VG_MAX_IMAGE_BYTES: + case VG_MAX_GAUSSIAN_STD_DEVIATION: + values[0] = vgGeti(type); + break; + case VG_MAX_FLOAT: + values[0] = vgGetf(type); + break; + case VG_SCISSOR_RECTS: { + VGint i; + for (i = 0; i < count; ++i) { + values[i] = state->scissor_rects[i].f; + } + } + break; +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM_VALUES: { + memcpy(values, state->color_transform_values, + sizeof(VGfloat) * count); + } + break; +#endif + case VG_STROKE_LINE_WIDTH: + values[0] = state->stroke.line_width.f; + break; + case VG_STROKE_MITER_LIMIT: + values[0] = state->stroke.miter_limit.f; + break; + case VG_STROKE_DASH_PATTERN: { + VGint i; + for (i = 0; i < count; ++i) { + values[i] = state->stroke.dash_pattern[i].f; + } + } + break; + case VG_STROKE_DASH_PHASE: + values[0] = state->stroke.dash_phase.f; + break; + case VG_TILE_FILL_COLOR: + values[0] = state->tile_fill_color[0]; + values[1] = state->tile_fill_color[1]; + values[2] = state->tile_fill_color[2]; + values[3] = state->tile_fill_color[3]; + break; + case VG_CLEAR_COLOR: + values[0] = state->clear_color[0]; + values[1] = state->clear_color[1]; + values[2] = state->clear_color[2]; + values[3] = state->clear_color[3]; + break; +#ifdef OPENVG_VERSION_1_1 + case VG_GLYPH_ORIGIN: + values[0] = state->glyph_origin[0].f; + values[1] = state->glyph_origin[1].f; + break; +#endif + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + } +} + +void vgGetiv(VGParamType type, VGint count, + VGint * values) +{ + const struct vg_state *state = current_state(); + struct vg_context *ctx = vg_current_context(); + VGint real_count = vgGetVectorSize(type); + + if (!values || count <= 0 || count > real_count || !is_aligned(values)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + switch(type) { + case VG_MATRIX_MODE: + case VG_FILL_RULE: + case VG_IMAGE_QUALITY: + case VG_RENDERING_QUALITY: + case VG_BLEND_MODE: + case VG_IMAGE_MODE: +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM: +#endif + case VG_STROKE_CAP_STYLE: + case VG_STROKE_JOIN_STYLE: + case VG_STROKE_DASH_PHASE_RESET: + case VG_MASKING: + case VG_SCISSORING: + case VG_PIXEL_LAYOUT: + case VG_SCREEN_LAYOUT: + case VG_FILTER_FORMAT_LINEAR: + case VG_FILTER_FORMAT_PREMULTIPLIED: + case VG_FILTER_CHANNEL_MASK: + case VG_MAX_SCISSOR_RECTS: + case VG_MAX_DASH_COUNT: + case VG_MAX_KERNEL_SIZE: + case VG_MAX_SEPARABLE_KERNEL_SIZE: + case VG_MAX_COLOR_RAMP_STOPS: + case VG_MAX_IMAGE_WIDTH: + case VG_MAX_IMAGE_HEIGHT: + case VG_MAX_IMAGE_PIXELS: + case VG_MAX_IMAGE_BYTES: + case VG_MAX_GAUSSIAN_STD_DEVIATION: + values[0] = vgGeti(type); + break; + case VG_MAX_FLOAT: { + VGfloat val = vgGetf(type); + values[0] = float_to_int_floor(*((VGuint*)&val)); + } + break; + case VG_SCISSOR_RECTS: { + VGint i; + for (i = 0; i < count; ++i) { + values[i] = state->scissor_rects[i].i; + } + } + break; +#ifdef OPENVG_VERSION_1_1 + case VG_COLOR_TRANSFORM_VALUES: { + VGint i; + VGuint *x = (VGuint*)state->color_transform_values; + for (i = 0; i < count; ++i) { + values[i] = float_to_int_floor(x[i]); + } + } + break; +#endif + case VG_STROKE_LINE_WIDTH: + values[0] = state->stroke.line_width.i; + break; + case VG_STROKE_MITER_LIMIT: + values[0] = state->stroke.miter_limit.i; + break; + case VG_STROKE_DASH_PATTERN: { + VGint i; + for (i = 0; i < count; ++i) { + values[i] = state->stroke.dash_pattern[i].i; + } + } + break; + case VG_STROKE_DASH_PHASE: + values[0] = state->stroke.dash_phase.i; + break; + case VG_TILE_FILL_COLOR: + values[0] = state->tile_fill_colori[0]; + values[1] = state->tile_fill_colori[1]; + values[2] = state->tile_fill_colori[2]; + values[3] = state->tile_fill_colori[3]; + break; + case VG_CLEAR_COLOR: + values[0] = state->clear_colori[0]; + values[1] = state->clear_colori[1]; + values[2] = state->clear_colori[2]; + values[3] = state->clear_colori[3]; + break; +#ifdef OPENVG_VERSION_1_1 + case VG_GLYPH_ORIGIN: + values[0] = state->glyph_origin[0].i; + values[1] = state->glyph_origin[1].i; + break; +#endif + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + } +} + +void vgSetParameterf(VGHandle object, + VGint paramType, + VGfloat value) +{ + struct vg_context *ctx = vg_current_context(); + void *ptr = (void*)object; + + if (!object || object == VG_INVALID_HANDLE || !is_aligned(ptr)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + switch(paramType) { + case VG_PAINT_TYPE: + case VG_PAINT_COLOR_RAMP_SPREAD_MODE: + case VG_PAINT_PATTERN_TILING_MODE: + vgSetParameteri(object, paramType, floor(value)); + return; + break; + case VG_PAINT_COLOR: + case VG_PAINT_COLOR_RAMP_STOPS: + case VG_PAINT_LINEAR_GRADIENT: + case VG_PAINT_RADIAL_GRADIENT: + /* it's an error if paramType refers to a vector parameter */ + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: { + struct vg_paint *p = (struct vg_paint *)object; + paint_set_color_ramp_premultiplied(p, value); + } + break; + + case VG_PATH_DATATYPE: + case VG_PATH_FORMAT: + case VG_PATH_SCALE: + case VG_PATH_BIAS: + case VG_PATH_NUM_SEGMENTS: + case VG_PATH_NUM_COORDS: + + case VG_IMAGE_FORMAT: + case VG_IMAGE_WIDTH: + case VG_IMAGE_HEIGHT: + +#ifdef OPENVG_VERSION_1_1 + case VG_FONT_NUM_GLYPHS: + /* read only don't produce an error */ + break; +#endif + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + } +} + +void vgSetParameteri(VGHandle object, + VGint paramType, + VGint value) +{ + struct vg_context *ctx = vg_current_context(); + void *ptr = (void*)object; + + if (!object || object == VG_INVALID_HANDLE || !is_aligned(ptr)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + switch(paramType) { + case VG_PAINT_TYPE: + if (value < VG_PAINT_TYPE_COLOR || + value > VG_PAINT_TYPE_PATTERN) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + struct vg_paint *paint = (struct vg_paint *)ptr; + paint_set_type(paint, value); + } + break; + case VG_PAINT_COLOR: + case VG_PAINT_COLOR_RAMP_STOPS: + case VG_PAINT_LINEAR_GRADIENT: + case VG_PAINT_RADIAL_GRADIENT: + /* it's an error if paramType refers to a vector parameter */ + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + case VG_PAINT_COLOR_RAMP_SPREAD_MODE: + if (value < VG_COLOR_RAMP_SPREAD_PAD || + value > VG_COLOR_RAMP_SPREAD_REFLECT) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + struct vg_paint *paint = (struct vg_paint *)ptr; + paint_set_spread_mode(paint, value); + } + break; + case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: { + struct vg_paint *p = (struct vg_paint *)object; + paint_set_color_ramp_premultiplied(p, value); + } + break; + case VG_PAINT_PATTERN_TILING_MODE: + if (value < VG_TILE_FILL || + value > VG_TILE_REFLECT) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + struct vg_paint *paint = (struct vg_paint *)ptr; + paint_set_pattern_tiling(paint, value); + } + break; + + case VG_PATH_DATATYPE: + case VG_PATH_FORMAT: + case VG_PATH_SCALE: + case VG_PATH_BIAS: + case VG_PATH_NUM_SEGMENTS: + case VG_PATH_NUM_COORDS: + + case VG_IMAGE_FORMAT: + case VG_IMAGE_WIDTH: + case VG_IMAGE_HEIGHT: + +#ifdef OPENVG_VERSION_1_1 + case VG_FONT_NUM_GLYPHS: + /* read only don't produce an error */ + break; +#endif + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } +} + +void vgSetParameterfv(VGHandle object, + VGint paramType, + VGint count, + const VGfloat * values) +{ + struct vg_context *ctx = vg_current_context(); + void *ptr = (void*)object; + VGint real_count = vgGetParameterVectorSize(object, paramType); + + if (!object || object == VG_INVALID_HANDLE || !is_aligned(ptr)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (count < 0 || count < real_count || + (values == NULL && count != 0) || + !is_aligned(values)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + switch(paramType) { + case VG_PAINT_TYPE: + case VG_PAINT_COLOR_RAMP_SPREAD_MODE: + case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: + case VG_PAINT_PATTERN_TILING_MODE: + if (count != 1) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else + vgSetParameterf(object, paramType, values[0]); + return; + break; + case VG_PAINT_COLOR: { + if (count != 4) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + struct vg_paint *paint = (struct vg_paint *)object; + paint_set_color(paint, values); + } + } + break; + case VG_PAINT_COLOR_RAMP_STOPS: { + if (count && count < 4) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + struct vg_paint *paint = (struct vg_paint *)object; + count = MIN2(count, VEGA_MAX_COLOR_RAMP_STOPS); + paint_set_ramp_stops(paint, values, count); + { + VGint stopsi[VEGA_MAX_COLOR_RAMP_STOPS]; + int i = 0; + for (i = 0; i < count; ++i) { + stopsi[i] = float_to_int_floor(*((VGuint*)(values + i))); + } + paint_set_ramp_stopsi(paint, stopsi, count); + } + } + } + break; + case VG_PAINT_LINEAR_GRADIENT: { + if (count != 4) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + struct vg_paint *paint = (struct vg_paint *)object; + paint_set_linear_gradient(paint, values); + { + VGint vals[4]; + vals[0] = FLT_TO_INT(values[0]); + vals[1] = FLT_TO_INT(values[1]); + vals[2] = FLT_TO_INT(values[2]); + vals[3] = FLT_TO_INT(values[3]); + paint_set_linear_gradienti(paint, vals); + } + } + } + break; + case VG_PAINT_RADIAL_GRADIENT: { + if (count != 5) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + struct vg_paint *paint = (struct vg_paint *)object; + paint_set_radial_gradient(paint, values); + { + VGint vals[5]; + vals[0] = FLT_TO_INT(values[0]); + vals[1] = FLT_TO_INT(values[1]); + vals[2] = FLT_TO_INT(values[2]); + vals[3] = FLT_TO_INT(values[3]); + vals[4] = FLT_TO_INT(values[4]); + paint_set_radial_gradienti(paint, vals); + } + } + } + break; + + case VG_PATH_DATATYPE: + case VG_PATH_FORMAT: + case VG_PATH_SCALE: + case VG_PATH_BIAS: + case VG_PATH_NUM_SEGMENTS: + case VG_PATH_NUM_COORDS: + +#ifdef OPENVG_VERSION_1_1 + case VG_FONT_NUM_GLYPHS: + /* read only don't produce an error */ + break; +#endif + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } +} + +void vgSetParameteriv(VGHandle object, + VGint paramType, + VGint count, + const VGint * values) +{ + struct vg_context *ctx = vg_current_context(); + void *ptr = (void*)object; + VGint real_count = vgGetParameterVectorSize(object, paramType); + + if (!object || object == VG_INVALID_HANDLE || !is_aligned(ptr)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (count < 0 || count < real_count || + (values == NULL && count != 0) || + !is_aligned(values)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + switch(paramType) { + case VG_PAINT_TYPE: + case VG_PAINT_COLOR_RAMP_SPREAD_MODE: + case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: + case VG_PAINT_PATTERN_TILING_MODE: + if (count != 1) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else + vgSetParameteri(object, paramType, values[0]); + return; + break; + case VG_PAINT_COLOR: { + if (count != 4) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + struct vg_paint *paint = (struct vg_paint *)object; + paint_set_coloriv(paint, values); + } + } + break; + case VG_PAINT_COLOR_RAMP_STOPS: { + if ((count % 5)) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + VGfloat *vals = 0; + int i; + struct vg_paint *paint = (struct vg_paint *)object; + if (count) { + vals = malloc(sizeof(VGfloat)*count); + for (i = 0; i < count; ++i) + vals[i] = values[i]; + } + + paint_set_ramp_stopsi(paint, values, count); + paint_set_ramp_stops(paint, vals, count); + free(vals); + } + } + break; + case VG_PAINT_LINEAR_GRADIENT: { + if (count != 4) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + VGfloat vals[4]; + struct vg_paint *paint = (struct vg_paint *)object; + vals[0] = values[0]; + vals[1] = values[1]; + vals[2] = values[2]; + vals[3] = values[3]; + paint_set_linear_gradient(paint, vals); + paint_set_linear_gradienti(paint, values); + } + } + break; + case VG_PAINT_RADIAL_GRADIENT: { + if (count != 5) + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + else { + VGfloat vals[5]; + struct vg_paint *paint = (struct vg_paint *)object; + vals[0] = values[0]; + vals[1] = values[1]; + vals[2] = values[2]; + vals[3] = values[3]; + vals[4] = values[4]; + paint_set_radial_gradient(paint, vals); + paint_set_radial_gradienti(paint, values); + } + } + break; + case VG_PATH_DATATYPE: + case VG_PATH_FORMAT: + case VG_PATH_SCALE: + case VG_PATH_BIAS: + case VG_PATH_NUM_SEGMENTS: + case VG_PATH_NUM_COORDS: + /* read only don't produce an error */ + break; + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } +} + +VGint vgGetParameterVectorSize(VGHandle object, + VGint paramType) +{ + struct vg_context *ctx = vg_current_context(); + void *ptr = (void*)object; + + if (!ptr || object == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return 0; + } + + switch(paramType) { + case VG_PAINT_TYPE: + case VG_PAINT_COLOR_RAMP_SPREAD_MODE: + case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: + case VG_PAINT_PATTERN_TILING_MODE: + return 1; + case VG_PAINT_COLOR: + return 4; + case VG_PAINT_COLOR_RAMP_STOPS: { + struct vg_paint *p = (struct vg_paint *)object; + return paint_num_ramp_stops(p); + } + break; + case VG_PAINT_LINEAR_GRADIENT: + return 4; + case VG_PAINT_RADIAL_GRADIENT: + return 5; + + + case VG_PATH_FORMAT: + case VG_PATH_DATATYPE: + case VG_PATH_SCALE: + case VG_PATH_BIAS: + case VG_PATH_NUM_SEGMENTS: + case VG_PATH_NUM_COORDS: + return 1; + + case VG_IMAGE_FORMAT: + case VG_IMAGE_WIDTH: + case VG_IMAGE_HEIGHT: + return 1; + +#ifdef OPENVG_VERSION_1_1 + case VG_FONT_NUM_GLYPHS: + return 1; +#endif + + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + } + return 0; +} + + +VGfloat vgGetParameterf(VGHandle object, + VGint paramType) +{ + struct vg_context *ctx = vg_current_context(); + void *ptr = (void*)object; + + if (!ptr || object == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return 0; + } + + switch(paramType) { + case VG_PAINT_TYPE: + case VG_PAINT_COLOR_RAMP_SPREAD_MODE: + case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: + case VG_PAINT_PATTERN_TILING_MODE: + return vgGetParameteri(object, paramType); + break; + case VG_PAINT_COLOR: + case VG_PAINT_COLOR_RAMP_STOPS: + case VG_PAINT_LINEAR_GRADIENT: + case VG_PAINT_RADIAL_GRADIENT: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + + case VG_PATH_FORMAT: + return VG_PATH_FORMAT_STANDARD; + case VG_PATH_SCALE: { + struct path *p = (struct path*)object; + return path_scale(p); + } + case VG_PATH_BIAS: { + struct path *p = (struct path*)object; + return path_bias(p); + } + case VG_PATH_DATATYPE: + case VG_PATH_NUM_SEGMENTS: + case VG_PATH_NUM_COORDS: + return vgGetParameteri(object, paramType); + break; + + case VG_IMAGE_FORMAT: + case VG_IMAGE_WIDTH: + case VG_IMAGE_HEIGHT: +#ifdef OPENVG_VERSION_1_1 + case VG_FONT_NUM_GLYPHS: + return vgGetParameteri(object, paramType); + break; +#endif + + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + } + return 0; +} + +VGint vgGetParameteri(VGHandle object, + VGint paramType) +{ + struct vg_context *ctx = vg_current_context(); + void *ptr = (void*)object; + + if (!ptr || object == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return 0; + } + + switch(paramType) { + case VG_PAINT_TYPE: { + struct vg_paint *paint = (struct vg_paint *)ptr; + return paint_type(paint); + } + break; + case VG_PAINT_COLOR_RAMP_SPREAD_MODE: { + struct vg_paint *p = (struct vg_paint *)object; + return paint_spread_mode(p); + } + case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: { + struct vg_paint *p = (struct vg_paint *)object; + return paint_color_ramp_premultiplied(p); + } + break; + case VG_PAINT_PATTERN_TILING_MODE: { + struct vg_paint *p = (struct vg_paint *)object; + return paint_pattern_tiling(p); + } + break; + case VG_PAINT_COLOR: + case VG_PAINT_COLOR_RAMP_STOPS: + case VG_PAINT_LINEAR_GRADIENT: + case VG_PAINT_RADIAL_GRADIENT: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + + case VG_PATH_FORMAT: + return VG_PATH_FORMAT_STANDARD; + case VG_PATH_SCALE: + case VG_PATH_BIAS: + return vgGetParameterf(object, paramType); + case VG_PATH_DATATYPE: { + struct path *p = (struct path*)object; + return path_datatype(p); + } + case VG_PATH_NUM_SEGMENTS: { + struct path *p = (struct path*)object; + return path_num_segments(p); + } + case VG_PATH_NUM_COORDS: { + struct path *p = (struct path*)object; + return path_num_coords(p); + } + break; + + case VG_IMAGE_FORMAT: { + struct vg_image *img = (struct vg_image*)object; + return img->format; + } + break; + case VG_IMAGE_WIDTH: { + struct vg_image *img = (struct vg_image*)object; + return img->width; + } + break; + case VG_IMAGE_HEIGHT: { + struct vg_image *img = (struct vg_image*)object; + return img->height; + } + break; + +#ifdef OPENVG_VERSION_1_1 + case VG_FONT_NUM_GLYPHS: { + return 1; + } + break; +#endif + + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + } + return 0; +} + +void vgGetParameterfv(VGHandle object, + VGint paramType, + VGint count, + VGfloat * values) +{ + struct vg_context *ctx = vg_current_context(); + void *ptr = (void*)object; + VGint real_count = vgGetParameterVectorSize(object, paramType); + + if (!ptr || object == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (!values || count <= 0 || count > real_count || + !is_aligned(values)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + switch(paramType) { + case VG_PAINT_TYPE: { + struct vg_paint *p = (struct vg_paint *)object; + values[0] = paint_type(p); + } + break; + case VG_PAINT_COLOR_RAMP_SPREAD_MODE: { + struct vg_paint *p = (struct vg_paint *)object; + values[0] = paint_spread_mode(p); + } + break; + case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: { + struct vg_paint *p = (struct vg_paint *)object; + values[0] = paint_color_ramp_premultiplied(p); + } + break; + case VG_PAINT_PATTERN_TILING_MODE: { + values[0] = vgGetParameterf(object, paramType); + } + break; + case VG_PAINT_COLOR: { + struct vg_paint *paint = (struct vg_paint *)object; + paint_get_color(paint, values); + } + break; + case VG_PAINT_COLOR_RAMP_STOPS: { + struct vg_paint *paint = (struct vg_paint *)object; + paint_ramp_stops(paint, values, count); + } + break; + case VG_PAINT_LINEAR_GRADIENT: { + struct vg_paint *paint = (struct vg_paint *)object; + paint_linear_gradient(paint, values); + } + break; + case VG_PAINT_RADIAL_GRADIENT: { + struct vg_paint *paint = (struct vg_paint *)object; + paint_radial_gradient(paint, values); + } + break; + + case VG_PATH_FORMAT: + case VG_PATH_DATATYPE: + case VG_PATH_NUM_SEGMENTS: + case VG_PATH_NUM_COORDS: + values[0] = vgGetParameteri(object, paramType); + break; + case VG_PATH_SCALE: + case VG_PATH_BIAS: + values[0] = vgGetParameterf(object, paramType); + break; + + case VG_IMAGE_FORMAT: + case VG_IMAGE_WIDTH: + case VG_IMAGE_HEIGHT: +#ifdef OPENVG_VERSION_1_1 + case VG_FONT_NUM_GLYPHS: + values[0] = vgGetParameteri(object, paramType); + break; +#endif + + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + } +} + +void vgGetParameteriv(VGHandle object, + VGint paramType, + VGint count, + VGint * values) +{ + struct vg_context *ctx = vg_current_context(); + void *ptr = (void*)object; + VGint real_count = vgGetParameterVectorSize(object, paramType); + + if (!ptr || object == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (!values || count <= 0 || count > real_count || + !is_aligned(values)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + switch(paramType) { + case VG_PAINT_TYPE: + case VG_PAINT_COLOR_RAMP_SPREAD_MODE: + case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: + case VG_PAINT_PATTERN_TILING_MODE: +#ifdef OPENVG_VERSION_1_1 + case VG_FONT_NUM_GLYPHS: + values[0] = vgGetParameteri(object, paramType); + break; +#endif + case VG_PAINT_COLOR: { + struct vg_paint *paint = (struct vg_paint *)object; + paint_get_coloriv(paint, values); + } + break; + case VG_PAINT_COLOR_RAMP_STOPS: { + struct vg_paint *paint = (struct vg_paint *)object; + paint_ramp_stopsi(paint, values, count); + } + break; + case VG_PAINT_LINEAR_GRADIENT: { + struct vg_paint *paint = (struct vg_paint *)object; + paint_linear_gradienti(paint, values); + } + break; + case VG_PAINT_RADIAL_GRADIENT: { + struct vg_paint *paint = (struct vg_paint *)object; + paint_radial_gradienti(paint, values); + } + break; + + case VG_PATH_SCALE: + case VG_PATH_BIAS: + values[0] = vgGetParameterf(object, paramType); + break; + case VG_PATH_FORMAT: + case VG_PATH_DATATYPE: + case VG_PATH_NUM_SEGMENTS: + case VG_PATH_NUM_COORDS: + values[0] = vgGetParameteri(object, paramType); + break; + + case VG_IMAGE_FORMAT: + case VG_IMAGE_WIDTH: + case VG_IMAGE_HEIGHT: + values[0] = vgGetParameteri(object, paramType); + break; + + default: + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + break; + } +} diff --git a/src/gallium/state_trackers/vega/api_path.c b/src/gallium/state_trackers/vega/api_path.c new file mode 100644 index 00000000000..a6b7a2bb93a --- /dev/null +++ b/src/gallium/state_trackers/vega/api_path.c @@ -0,0 +1,488 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" + +#include "vg_context.h" +#include "path.h" +#include "polygon.h" +#include "paint.h" + +#include "pipe/p_context.h" +#include "pipe/p_inlines.h" +#include "util/u_draw_quad.h" + +VGPath vgCreatePath(VGint pathFormat, + VGPathDatatype datatype, + VGfloat scale, VGfloat bias, + VGint segmentCapacityHint, + VGint coordCapacityHint, + VGbitfield capabilities) +{ + struct vg_context *ctx = vg_current_context(); + + if (pathFormat != VG_PATH_FORMAT_STANDARD) { + vg_set_error(ctx, VG_UNSUPPORTED_PATH_FORMAT_ERROR); + return VG_INVALID_HANDLE; + } + if (datatype < VG_PATH_DATATYPE_S_8 || + datatype > VG_PATH_DATATYPE_F) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + if (!scale) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + + return (VGPath)path_create(datatype, scale, bias, + segmentCapacityHint, coordCapacityHint, + capabilities); +} + +void vgClearPath(VGPath path, VGbitfield capabilities) +{ + struct vg_context *ctx = vg_current_context(); + struct path *p = 0; + + if (path == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + p = (struct path *)path; + path_clear(p, capabilities); +} + +void vgDestroyPath(VGPath p) +{ + struct path *path = 0; + struct vg_context *ctx = vg_current_context(); + + if (p == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + path = (struct path *)p; + path_destroy(path); +} + +void vgRemovePathCapabilities(VGPath path, + VGbitfield capabilities) +{ + struct vg_context *ctx = vg_current_context(); + VGbitfield current; + struct path *p; + + if (path == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + p = (struct path*)path; + current = path_capabilities(p); + path_set_capabilities(p, (current & + (~(capabilities & VG_PATH_CAPABILITY_ALL)))); +} + +VGbitfield vgGetPathCapabilities(VGPath path) +{ + struct vg_context *ctx = vg_current_context(); + struct path *p = 0; + + if (path == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return 0; + } + p = (struct path*)path; + return path_capabilities(p); +} + +void vgAppendPath(VGPath dstPath, VGPath srcPath) +{ + struct vg_context *ctx = vg_current_context(); + struct path *src, *dst; + + if (dstPath == VG_INVALID_HANDLE || srcPath == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + src = (struct path *)srcPath; + dst = (struct path *)dstPath; + + if (!(path_capabilities(src) & VG_PATH_CAPABILITY_APPEND_FROM) || + !(path_capabilities(dst) & VG_PATH_CAPABILITY_APPEND_TO)) { + vg_set_error(ctx, VG_PATH_CAPABILITY_ERROR); + return; + } + path_append_path(dst, src); +} + +void vgAppendPathData(VGPath dstPath, + VGint numSegments, + const VGubyte * pathSegments, + const void * pathData) +{ + struct vg_context *ctx = vg_current_context(); + struct path *p = 0; + VGint i; + + if (dstPath == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (!pathSegments) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (numSegments <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + for (i = 0; i < numSegments; ++i) { + if (pathSegments[i] < VG_CLOSE_PATH || + pathSegments[i] > VG_LCWARC_TO_REL) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + } + + p = (struct path*)dstPath; + + if (!pathData || !is_aligned_to(pathData, path_datatype_size(p))) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (!(path_capabilities(p)&VG_PATH_CAPABILITY_APPEND_TO)) { + vg_set_error(ctx, VG_PATH_CAPABILITY_ERROR); + return; + } + + path_append_data(p, numSegments, pathSegments, pathData); +} + +void vgModifyPathCoords(VGPath dstPath, + VGint startIndex, + VGint numSegments, + const void * pathData) +{ + struct vg_context *ctx = vg_current_context(); + struct path *p = 0; + + if (dstPath == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (startIndex < 0 || numSegments <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + p = (struct path *)dstPath; + + if (!pathData || !is_aligned_to(pathData, path_datatype_size(p))) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (startIndex + numSegments > path_num_segments(p)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (!(path_capabilities(p)&VG_PATH_CAPABILITY_MODIFY)) { + vg_set_error(ctx, VG_PATH_CAPABILITY_ERROR); + return; + } + path_modify_coords(p, startIndex, numSegments, pathData); +} + +void vgTransformPath(VGPath dstPath, VGPath srcPath) +{ + struct vg_context *ctx = vg_current_context(); + struct path *src = 0, *dst = 0; + + if (dstPath == VG_INVALID_HANDLE || srcPath == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + src = (struct path *)srcPath; + dst = (struct path *)dstPath; + + if (!(path_capabilities(src) & VG_PATH_CAPABILITY_TRANSFORM_FROM) || + !(path_capabilities(dst) & VG_PATH_CAPABILITY_TRANSFORM_TO)) { + vg_set_error(ctx, VG_PATH_CAPABILITY_ERROR); + return; + } + path_transform(dst, src); +} + +VGboolean vgInterpolatePath(VGPath dstPath, + VGPath startPath, + VGPath endPath, + VGfloat amount) +{ + struct vg_context *ctx = vg_current_context(); + struct path *start = 0, *dst = 0, *end = 0; + + if (dstPath == VG_INVALID_HANDLE || + startPath == VG_INVALID_HANDLE || + endPath == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return VG_FALSE; + } + dst = (struct path *)dstPath; + start = (struct path *)startPath; + end = (struct path *)endPath; + + if (!(path_capabilities(dst) & VG_PATH_CAPABILITY_INTERPOLATE_TO) || + !(path_capabilities(start) & VG_PATH_CAPABILITY_INTERPOLATE_FROM) || + !(path_capabilities(end) & VG_PATH_CAPABILITY_INTERPOLATE_FROM)) { + vg_set_error(ctx, VG_PATH_CAPABILITY_ERROR); + return VG_FALSE; + } + + return path_interpolate(dst, + start, end, amount); +} + +VGfloat vgPathLength(VGPath path, + VGint startSegment, + VGint numSegments) +{ + struct vg_context *ctx = vg_current_context(); + struct path *p = 0; + + if (path == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return -1; + } + if (startSegment < 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return -1; + } + if (numSegments <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return -1; + } + p = (struct path*)path; + + if (!(path_capabilities(p) & VG_PATH_CAPABILITY_PATH_LENGTH)) { + vg_set_error(ctx, VG_PATH_CAPABILITY_ERROR); + return -1; + } + if (startSegment + numSegments > path_num_segments(p)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return -1; + } + + return path_length(p, startSegment, numSegments); +} + +void vgPointAlongPath(VGPath path, + VGint startSegment, + VGint numSegments, + VGfloat distance, + VGfloat * x, VGfloat * y, + VGfloat * tangentX, + VGfloat * tangentY) +{ + struct vg_context *ctx = vg_current_context(); + struct path *p = 0; + VGbitfield caps; + + if (path == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (startSegment < 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (numSegments <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (!is_aligned(x) || !is_aligned(y) || + !is_aligned(tangentX) || !is_aligned(tangentY)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + p = (struct path*)path; + + caps = path_capabilities(p); + if (!(caps & VG_PATH_CAPABILITY_POINT_ALONG_PATH) || + !(caps & VG_PATH_CAPABILITY_TANGENT_ALONG_PATH)) { + vg_set_error(ctx, VG_PATH_CAPABILITY_ERROR); + return; + } + + if (startSegment + numSegments > path_num_segments(p)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + { + VGfloat point[2], normal[2]; + path_point(p, startSegment, numSegments, distance, + point, normal); + if (x) + *x = point[0]; + if (y) + *y = point[1]; + if (tangentX) + *tangentX = -normal[1]; + if (tangentY) + *tangentY = normal[0]; + } +} + +void vgPathBounds(VGPath path, + VGfloat * minX, + VGfloat * minY, + VGfloat * width, + VGfloat * height) +{ + struct vg_context *ctx = vg_current_context(); + struct path *p = 0; + VGbitfield caps; + + if (path == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (!minX || !minY || !width || !height) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (!is_aligned(minX) || !is_aligned(minY) || + !is_aligned(width) || !is_aligned(height)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + p = (struct path*)path; + + caps = path_capabilities(p); + if (!(caps & VG_PATH_CAPABILITY_PATH_BOUNDS)) { + vg_set_error(ctx, VG_PATH_CAPABILITY_ERROR); + return; + } + + path_bounding_rect(p, minX, minY, width, height); +} + +void vgPathTransformedBounds(VGPath path, + VGfloat * minX, + VGfloat * minY, + VGfloat * width, + VGfloat * height) +{ + struct vg_context *ctx = vg_current_context(); + struct path *p = 0; + VGbitfield caps; + + if (path == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (!minX || !minY || !width || !height) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (!is_aligned(minX) || !is_aligned(minY) || + !is_aligned(width) || !is_aligned(height)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + p = (struct path*)path; + + caps = path_capabilities(p); + if (!(caps & VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS)) { + vg_set_error(ctx, VG_PATH_CAPABILITY_ERROR); + return; + } + +#if 0 + /* faster, but seems to have precision problems... */ + path_bounding_rect(p, minX, minY, width, height); + if (*width > 0 && *height > 0) { + VGfloat pts[] = {*minX, *minY, + *minX + *width, *minY, + *minX + *width, *minY + *height, + *minX, *minY + *height}; + struct matrix *matrix = &ctx->state.vg.path_user_to_surface_matrix; + VGfloat maxX, maxY; + matrix_map_point(matrix, pts[0], pts[1], pts + 0, pts + 1); + matrix_map_point(matrix, pts[2], pts[3], pts + 2, pts + 3); + matrix_map_point(matrix, pts[4], pts[5], pts + 4, pts + 5); + matrix_map_point(matrix, pts[6], pts[7], pts + 6, pts + 7); + *minX = MIN2(pts[0], MIN2(pts[2], MIN2(pts[4], pts[6]))); + *minY = MIN2(pts[1], MIN2(pts[3], MIN2(pts[5], pts[7]))); + maxX = MAX2(pts[0], MAX2(pts[2], MAX2(pts[4], pts[6]))); + maxY = MAX2(pts[1], MAX2(pts[3], MAX2(pts[5], pts[7]))); + *width = maxX - *minX; + *height = maxY - *minY; + } +#else + { + struct path *dst = path_create(VG_PATH_DATATYPE_F, 1.0, 0, + 0, 0, VG_PATH_CAPABILITY_ALL); + path_transform(dst, p); + path_bounding_rect(dst, minX, minY, width, height); + path_destroy(dst); + } +#endif +} + + +void vgDrawPath(VGPath path, VGbitfield paintModes) +{ + struct vg_context *ctx = vg_current_context(); + + if (path == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + if (!(paintModes & (VG_STROKE_PATH | VG_FILL_PATH))) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (path_is_empty((struct path*)path)) + return; + path_render((struct path*)path, paintModes); +} + diff --git a/src/gallium/state_trackers/vega/api_text.c b/src/gallium/state_trackers/vega/api_text.c new file mode 100644 index 00000000000..d8411cf3e87 --- /dev/null +++ b/src/gallium/state_trackers/vega/api_text.c @@ -0,0 +1,258 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" + +#include "vg_context.h" + +#include "util/u_memory.h" + +#ifdef OPENVG_VERSION_1_1 + +struct vg_font { + struct vg_object base; + + VGint glyph_indices[200]; + VGint num_glyphs; +}; + +VGFont vgCreateFont(VGint glyphCapacityHint) +{ + struct vg_font *font = 0; + struct vg_context *ctx = vg_current_context(); + + if (glyphCapacityHint < 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return VG_INVALID_HANDLE; + } + + font = CALLOC_STRUCT(vg_font); + vg_init_object(&font->base, ctx, VG_OBJECT_FONT); + vg_context_add_object(ctx, VG_OBJECT_FONT, font); + return (VGFont)font; +} + +void vgDestroyFont(VGFont f) +{ + struct vg_font *font = (struct vg_font *)f; + struct vg_context *ctx = vg_current_context(); + + if (f == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + vg_context_remove_object(ctx, VG_OBJECT_FONT, font); + /*free(font);*/ +} + +void vgSetGlyphToPath(VGFont font, + VGuint glyphIndex, + VGPath path, + VGboolean isHinted, + VGfloat glyphOrigin [2], + VGfloat escapement[2]) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_object *pathObj; + struct vg_font *f; + + if (font == VG_INVALID_HANDLE || + !vg_context_is_object_valid(ctx, VG_OBJECT_FONT, (void *)font)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (!glyphOrigin || !escapement || + !is_aligned(glyphOrigin) || !is_aligned(escapement)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (path != VG_INVALID_HANDLE && + !vg_context_is_object_valid(ctx, VG_OBJECT_PATH, (void *)path)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + pathObj = (struct vg_object*)path; + if (pathObj && pathObj->type != VG_OBJECT_PATH) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + + f = (struct vg_font*)font; + f->glyph_indices[f->num_glyphs] = glyphIndex; + ++f->num_glyphs; +} + +void vgSetGlyphToImage(VGFont font, + VGuint glyphIndex, + VGImage image, + VGfloat glyphOrigin [2], + VGfloat escapement[2]) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_object *img_obj; + struct vg_font *f; + + if (font == VG_INVALID_HANDLE || + !vg_context_is_object_valid(ctx, VG_OBJECT_FONT, (void *)font)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (!glyphOrigin || !escapement || + !is_aligned(glyphOrigin) || !is_aligned(escapement)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (image != VG_INVALID_HANDLE && + !vg_context_is_object_valid(ctx, VG_OBJECT_IMAGE, (void *)image)) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + img_obj = (struct vg_object*)image; + if (img_obj && img_obj->type != VG_OBJECT_IMAGE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + f = (struct vg_font*)font; + f->glyph_indices[f->num_glyphs] = glyphIndex; + ++f->num_glyphs; +} + +static INLINE VGboolean font_contains_glyph(struct vg_font *font, + VGuint glyph_index) +{ + VGint i; + for (i = 0; i < font->num_glyphs; ++i) { + if (font->glyph_indices[i] == glyph_index) { + return VG_TRUE; + } + } + return VG_FALSE; +} + +void vgClearGlyph(VGFont font, + VGuint glyphIndex) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_font *f; + VGint i; + + if (font == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (glyphIndex <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + f = (struct vg_font*)font; + if (!font_contains_glyph(f, glyphIndex)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + for (i = 0; i < f->num_glyphs; ++i) { + if (f->glyph_indices[i] == glyphIndex) { + /*FIXME*/ + f->glyph_indices[f->num_glyphs] = 0; + --f->num_glyphs; + return; + } + } +} + +void vgDrawGlyph(VGFont font, + VGuint glyphIndex, + VGbitfield paintModes, + VGboolean allowAutoHinting) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_font *f; + + if (font == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (glyphIndex <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (paintModes & (~(VG_STROKE_PATH|VG_FILL_PATH))) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + f = (struct vg_font*)font; + if (!font_contains_glyph(f, glyphIndex)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } +} + +void vgDrawGlyphs(VGFont font, + VGint glyphCount, + VGuint *glyphIndices, + VGfloat *adjustments_x, + VGfloat *adjustments_y, + VGbitfield paintModes, + VGboolean allowAutoHinting) +{ + struct vg_context *ctx = vg_current_context(); + VGint i; + struct vg_font *f; + + if (font == VG_INVALID_HANDLE) { + vg_set_error(ctx, VG_BAD_HANDLE_ERROR); + return; + } + if (glyphCount <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (!glyphIndices || !is_aligned(glyphIndices)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (!adjustments_x || !is_aligned(adjustments_x) || + !adjustments_y || !is_aligned(adjustments_y)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + if (paintModes & (~(VG_STROKE_PATH|VG_FILL_PATH))) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + f = (struct vg_font*)font; + for (i = 0; i < glyphCount; ++i) { + VGuint glyph_index = glyphIndices[i]; + if (!font_contains_glyph(f, glyph_index)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + } +} + +#endif diff --git a/src/gallium/state_trackers/vega/api_transform.c b/src/gallium/state_trackers/vega/api_transform.c new file mode 100644 index 00000000000..763a5ec415c --- /dev/null +++ b/src/gallium/state_trackers/vega/api_transform.c @@ -0,0 +1,128 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" + +#include "vg_context.h" + +#include "matrix.h" + +void vgLoadIdentity(void) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *mat = vg_state_matrix(&ctx->state.vg); + matrix_load_identity(mat); +} + +void vgLoadMatrix(const VGfloat * m) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *mat; + + if (!ctx) + return; + + if (!m || !is_aligned(m)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + mat = vg_state_matrix(&ctx->state.vg); + matrix_init(mat, m); + if (!matrix_is_affine(mat)) { + if (ctx->state.vg.matrix_mode != VG_MATRIX_IMAGE_USER_TO_SURFACE) { + matrix_make_affine(mat); + } + } +} + +void vgGetMatrix(VGfloat * m) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *mat; + + if (!ctx) + return; + + if (!m || !is_aligned(m)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + mat = vg_state_matrix(&ctx->state.vg); + memcpy(m, mat->m, sizeof(VGfloat)*9); +} + +void vgMultMatrix(const VGfloat * m) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *dst, src; + + if (!ctx) + return; + + if (!m || !is_aligned(m)) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + matrix_init(&src, m); + dst = vg_state_matrix(&ctx->state.vg); + if (!matrix_is_affine(&src)) { + if (ctx->state.vg.matrix_mode != VG_MATRIX_IMAGE_USER_TO_SURFACE) { + matrix_make_affine(&src); + } + } + matrix_mult(dst, &src); + +} + +void vgTranslate(VGfloat tx, VGfloat ty) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *dst = vg_state_matrix(&ctx->state.vg); + matrix_translate(dst, tx, ty); +} + +void vgScale(VGfloat sx, VGfloat sy) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *dst = vg_state_matrix(&ctx->state.vg); + matrix_scale(dst, sx, sy); +} + +void vgShear(VGfloat shx, VGfloat shy) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *dst = vg_state_matrix(&ctx->state.vg); + matrix_shear(dst, shx, shy); +} + +void vgRotate(VGfloat angle) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *dst = vg_state_matrix(&ctx->state.vg); + matrix_rotate(dst, angle); +} diff --git a/src/gallium/state_trackers/vega/arc.c b/src/gallium/state_trackers/vega/arc.c new file mode 100644 index 00000000000..e74c7f03345 --- /dev/null +++ b/src/gallium/state_trackers/vega/arc.c @@ -0,0 +1,708 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "arc.h" + +#include "matrix.h" +#include "bezier.h" +#include "polygon.h" +#include "stroker.h" +#include "path.h" + +#include "util/u_debug.h" + +#include <math.h> + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#define DEBUG_ARCS 0 + +static const VGfloat two_pi = M_PI * 2; + + +static const double coeffs3Low[2][4][4] = { + { + { 3.85268, -21.229, -0.330434, 0.0127842 }, + { -1.61486, 0.706564, 0.225945, 0.263682 }, + { -0.910164, 0.388383, 0.00551445, 0.00671814 }, + { -0.630184, 0.192402, 0.0098871, 0.0102527 } + }, + { + { -0.162211, 9.94329, 0.13723, 0.0124084 }, + { -0.253135, 0.00187735, 0.0230286, 0.01264 }, + { -0.0695069, -0.0437594, 0.0120636, 0.0163087 }, + { -0.0328856, -0.00926032, -0.00173573, 0.00527385 } + } +}; + +/* coefficients for error estimation + while using cubic Bézier curves for approximation + 1/4 <= b/a <= 1 */ +static const double coeffs3High[2][4][4] = { + { + { 0.0899116, -19.2349, -4.11711, 0.183362 }, + { 0.138148, -1.45804, 1.32044, 1.38474 }, + { 0.230903, -0.450262, 0.219963, 0.414038 }, + { 0.0590565, -0.101062, 0.0430592, 0.0204699 } + }, + { + { 0.0164649, 9.89394, 0.0919496, 0.00760802 }, + { 0.0191603, -0.0322058, 0.0134667, -0.0825018 }, + { 0.0156192, -0.017535, 0.00326508, -0.228157 }, + { -0.0236752, 0.0405821, -0.0173086, 0.176187 } + } +}; + +/* safety factor to convert the "best" error approximation + into a "max bound" error */ +static const double safety3[] = { + 0.001, 4.98, 0.207, 0.0067 +}; + +/* The code below is from the OpenVG 1.1 Spec + * Section 18.4 */ + +/* Given: Points (x0, y0) and (x1, y1) + * Return: TRUE if a solution exists, FALSE otherwise + * Circle centers are written to (cx0, cy0) and (cx1, cy1) + */ +static VGboolean +find_unit_circles(double x0, double y0, double x1, double y1, + double *cx0, double *cy0, + double *cx1, double *cy1) +{ + /* Compute differences and averages */ + double dx = x0 - x1; + double dy = y0 - y1; + double xm = (x0 + x1)/2; + double ym = (y0 + y1)/2; + double dsq, disc, s, sdx, sdy; + + /* Solve for intersecting unit circles */ + dsq = dx*dx + dy*dy; + if (dsq == 0.0) return VG_FALSE; /* Points are coincident */ + disc = 1.0/dsq - 1.0/4.0; + + /* the precision we care about here is around float so if we're + * around the float defined zero then make it official to avoid + * precision problems later on */ + if (floatIsZero(disc)) + disc = 0.0; + + if (disc < 0.0) return VG_FALSE; /* Points are too far apart */ + s = sqrt(disc); + sdx = s*dx; + sdy = s*dy; + *cx0 = xm + sdy; + *cy0 = ym - sdx; + *cx1 = xm - sdy; + *cy1 = ym + sdx; + return VG_TRUE; +} + + +/* Given: Ellipse parameters rh, rv, rot (in degrees), + * endpoints (x0, y0) and (x1, y1) + * Return: TRUE if a solution exists, FALSE otherwise + * Ellipse centers are written to (cx0, cy0) and (cx1, cy1) + */ +static VGboolean +find_ellipses(double rh, double rv, double rot, + double x0, double y0, double x1, double y1, + double *cx0, double *cy0, double *cx1, double *cy1) +{ + double COS, SIN, x0p, y0p, x1p, y1p, pcx0, pcy0, pcx1, pcy1; + /* Convert rotation angle from degrees to radians */ + rot *= M_PI/180.0; + /* Pre-compute rotation matrix entries */ + COS = cos(rot); SIN = sin(rot); + /* Transform (x0, y0) and (x1, y1) into unit space */ + /* using (inverse) rotate, followed by (inverse) scale */ + x0p = (x0*COS + y0*SIN)/rh; + y0p = (-x0*SIN + y0*COS)/rv; + x1p = (x1*COS + y1*SIN)/rh; + y1p = (-x1*SIN + y1*COS)/rv; + if (!find_unit_circles(x0p, y0p, x1p, y1p, + &pcx0, &pcy0, &pcx1, &pcy1)) { + return VG_FALSE; + } + /* Transform back to original coordinate space */ + /* using (forward) scale followed by (forward) rotate */ + pcx0 *= rh; pcy0 *= rv; + pcx1 *= rh; pcy1 *= rv; + *cx0 = pcx0*COS - pcy0*SIN; + *cy0 = pcx0*SIN + pcy0*COS; + *cx1 = pcx1*COS - pcy1*SIN; + *cy1 = pcx1*SIN + pcy1*COS; + return VG_TRUE; +} + +static INLINE VGboolean +try_to_fix_radii(struct arc *arc) +{ + double COS, SIN, rot, x0p, y0p, x1p, y1p; + double dx, dy, dsq, scale; + + /* Convert rotation angle from degrees to radians */ + rot = DEGREES_TO_RADIANS(arc->theta); + + /* Pre-compute rotation matrix entries */ + COS = cos(rot); SIN = sin(rot); + + /* Transform (x0, y0) and (x1, y1) into unit space */ + /* using (inverse) rotate, followed by (inverse) scale */ + x0p = (arc->x1*COS + arc->y1*SIN)/arc->a; + y0p = (-arc->x1*SIN + arc->y1*COS)/arc->b; + x1p = (arc->x2*COS + arc->y2*SIN)/arc->a; + y1p = (-arc->x2*SIN + arc->y2*COS)/arc->b; + /* Compute differences and averages */ + dx = x0p - x1p; + dy = y0p - y1p; + + dsq = dx*dx + dy*dy; +#if 0 + if (dsq <= 0.001) { + debug_printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaa\n"); + } +#endif + scale = 1/(2/sqrt(dsq)); + arc->a *= scale; + arc->b *= scale; + return VG_TRUE; +} + +static INLINE double vector_normalize(double *v) +{ + double sq = v[0] * v[0] + v[1] * v[1]; + return sqrt(sq); +} +static INLINE double vector_orientation(double *v) +{ + double norm = vector_normalize(v); + double cosa = v[0] / norm; + double sina = v[1] / norm; + return (sina>=0 ? acos(cosa) : 2*M_PI - acos(cosa)); +} +static INLINE double vector_dot(double *v0, + double *v1) +{ + return v0[0] * v1[0] + v0[1] * v1[1]; +} + +static INLINE double vector_angles(double *v0, + double *v1) +{ + double dot = vector_dot(v0, v1); + double norm0 = vector_normalize(v0); + double norm1 = vector_normalize(v1); + + return acos(dot / (norm0 * norm1)); +} + +static VGboolean find_angles(struct arc *arc) +{ + double vec0[2], vec1[2]; + double lambda1, lambda2; + double angle; + struct matrix matrix; + + if (floatIsZero(arc->a) || floatIsZero(arc->b)) { + return VG_FALSE; + } + /* map the points to an identity circle */ + matrix_load_identity(&matrix); + matrix_scale(&matrix, 1.f, arc->a/arc->b); + matrix_rotate(&matrix, -arc->theta); + matrix_map_point(&matrix, + arc->x1, arc->y1, + &arc->x1, &arc->y1); + matrix_map_point(&matrix, + arc->x2, arc->y2, + &arc->x2, &arc->y2); + matrix_map_point(&matrix, + arc->cx, arc->cy, + &arc->cx, &arc->cy); + +#if DEBUG_ARCS + debug_printf("Matrix 3 [%f, %f, %f| %f, %f, %f| %f, %f, %f]\n", + matrix.m[0], matrix.m[1], matrix.m[2], + matrix.m[3], matrix.m[4], matrix.m[5], + matrix.m[6], matrix.m[7], matrix.m[8]); + debug_printf("Endpoints [%f, %f], [%f, %f]\n", + arc->x1, arc->y1, arc->x2, arc->y2); +#endif + + vec0[0] = arc->x1 - arc->cx; + vec0[1] = arc->y1 - arc->cy; + vec1[0] = arc->x2 - arc->cx; + vec1[1] = arc->y2 - arc->cy; + +#if DEBUG_ARCS + debug_printf("Vec is [%f, %f], [%f, %f], [%f, %f]\n", + vec0[0], vec0[1], vec1[0], vec1[1], arc->cx, arc->cy); +#endif + + lambda1 = vector_orientation(vec0); + + if (isnan(lambda1)) + lambda1 = 0.f; + + if (arc->type == VG_SCWARC_TO || + arc->type == VG_SCCWARC_TO) + angle = vector_angles(vec0, vec1); + else if (arc->type == VG_LCWARC_TO || + arc->type == VG_LCCWARC_TO) { + angle = 2*M_PI - vector_angles(vec0, vec1); + } else + abort(); + + if (isnan(angle)) + angle = M_PI; + + + if (arc->type == VG_SCWARC_TO || + arc->type == VG_LCWARC_TO) + lambda2 = lambda1 - angle; + else + lambda2 = lambda1 + angle; + +#if DEBUG_ARCS + debug_printf("Angle is %f and (%f, %f)\n", angle, lambda1, lambda2); +#endif + +#if 0 + arc->eta1 = atan2(sin(lambda1) / arc->b, + cos(lambda1) / arc->a); + arc->eta2 = atan2(sin(lambda2) / arc->b, + cos(lambda2) / arc->a); + + /* make sure we have eta1 <= eta2 <= eta1 + 2 PI */ + arc->eta2 -= two_pi * floor((arc->eta2 - arc->eta1) / two_pi); + + /* the preceding correction fails if we have exactly et2 - eta1 = 2 PI + it reduces the interval to zero length */ + if ((lambda2 - lambda1 > M_PI) && (arc->eta2 - arc->eta1 < M_PI)) { + arc->eta2 += 2 * M_PI; + } +#else + arc->eta1 = lambda1; + arc->eta2 = lambda2; +#endif + + return VG_TRUE; +} + +#if DEBUG_ARCS +static void check_endpoints(struct arc *arc) +{ + double x1, y1, x2, y2; + + double a_cos_eta1 = arc->a * cos(arc->eta1); + double b_sin_eta1 = arc->b * sin(arc->eta1); + x1 = arc->cx + a_cos_eta1 * arc->cos_theta - + b_sin_eta1 * arc->sin_theta; + y1 = arc->cy + a_cos_eta1 * arc->sin_theta + + b_sin_eta1 * arc->cos_theta; + + double a_cos_eta2 = arc->a * cos(arc->eta2); + double b_sin_eta2 = arc->b * sin(arc->eta2); + x2 = arc->cx + a_cos_eta2 * arc->cos_theta - + b_sin_eta2 * arc->sin_theta; + y2 = arc->cy + a_cos_eta2 * arc->sin_theta + + b_sin_eta2 * arc->cos_theta; + + debug_printf("Computed (%f, %f), (%f, %f)\n", + x1, y1, x2, y2); + debug_printf("Real (%f, %f), (%f, %f)\n", + arc->x1, arc->y1, + arc->x2, arc->y2); +} +#endif + +void arc_init(struct arc *arc, + VGPathSegment type, + VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2, + VGfloat rh, VGfloat rv, + VGfloat rot) +{ + assert(type == VG_SCCWARC_TO || + type == VG_SCWARC_TO || + type == VG_LCCWARC_TO || + type == VG_LCWARC_TO); + arc->type = type; + arc->x1 = x1; + arc->y1 = y1; + arc->x2 = x2; + arc->y2 = y2; + arc->a = rh; + arc->b = rv; + arc->theta = rot; + arc->cos_theta = cos(arc->theta); + arc->sin_theta = sin(arc->theta); + { + double cx0, cy0, cx1, cy1; + double cx, cy; + arc->is_valid = find_ellipses(rh, rv, rot, x1, y1, x2, y2, + &cx0, &cy0, &cx1, &cy1); + + if (!arc->is_valid && try_to_fix_radii(arc)) { + rh = arc->a; + rv = arc->b; + arc->is_valid = + find_ellipses(rh, rv, rot, x1, y1, x2, y2, + &cx0, &cy0, &cx1, &cy1); + } + + if (type == VG_SCWARC_TO || + type == VG_LCCWARC_TO) { + cx = cx1; + cy = cy1; + } else { + cx = cx0; + cy = cy0; + } +#if DEBUG_ARCS + debug_printf("Centers are : (%f, %f) , (%f, %f). Real (%f, %f)\n", + cx0, cy0, cx1, cy1, cx, cy); +#endif + arc->cx = cx; + arc->cy = cy; + if (arc->is_valid) { + arc->is_valid = find_angles(arc); +#if DEBUG_ARCS + check_endpoints(arc); +#endif + /* remap a few points. find_angles requires + * rot in angles, the rest of the code + * will need them in radians. and find_angles + * modifies the center to match an identity + * circle so lets reset it */ + arc->theta = DEGREES_TO_RADIANS(rot); + arc->cos_theta = cos(arc->theta); + arc->sin_theta = sin(arc->theta); + arc->cx = cx; + arc->cy = cy; + } + } +} + +static INLINE double rational_function(double x, const double *c) +{ + return (x * (x * c[0] + c[1]) + c[2]) / (x + c[3]); +} + +static double estimate_error(struct arc *arc, + double etaA, double etaB) +{ + double eta = 0.5 * (etaA + etaB); + + double x = arc->b / arc->a; + double dEta = etaB - etaA; + double cos2 = cos(2 * eta); + double cos4 = cos(4 * eta); + double cos6 = cos(6 * eta); + double c0, c1; + + /* select the right coeficients set according to degree and b/a */ + const double (*coeffs)[4][4]; + const double *safety; + coeffs = (x < 0.25) ? coeffs3Low : coeffs3High; + safety = safety3; + + c0 = rational_function(x, coeffs[0][0]) + + cos2 * rational_function(x, coeffs[0][1]) + + cos4 * rational_function(x, coeffs[0][2]) + + cos6 * rational_function(x, coeffs[0][3]); + + c1 = rational_function(x, coeffs[1][0]) + + cos2 * rational_function(x, coeffs[1][1]) + + cos4 * rational_function(x, coeffs[1][2]) + + cos6 * rational_function(x, coeffs[1][3]); + + return rational_function(x, safety) * arc->a * exp(c0 + c1 * dEta); +} + +struct arc_cb { + void (*move)(struct arc_cb *cb, VGfloat x, VGfloat y); + void (*point)(struct arc_cb *cb, VGfloat x, VGfloat y); + void (*bezier)(struct arc_cb *cb, struct bezier *bezier); + + void *user_data; +}; + +static void cb_null_move(struct arc_cb *cb, VGfloat x, VGfloat y) +{ +} + +static void polygon_point(struct arc_cb *cb, VGfloat x, VGfloat y) +{ + struct polygon *poly = (struct polygon*)cb->user_data; + polygon_vertex_append(poly, x, y); +} + +static void polygon_bezier(struct arc_cb *cb, struct bezier *bezier) +{ + struct polygon *poly = (struct polygon*)cb->user_data; + bezier_add_to_polygon(bezier, poly); +} + +static void stroke_point(struct arc_cb *cb, VGfloat x, VGfloat y) +{ + struct stroker *stroker = (struct stroker*)cb->user_data; + stroker_line_to(stroker, x, y); +} + +static void stroke_curve(struct arc_cb *cb, struct bezier *bezier) +{ + struct stroker *stroker = (struct stroker*)cb->user_data; + stroker_curve_to(stroker, + bezier->x2, bezier->y2, + bezier->x3, bezier->y3, + bezier->x4, bezier->y4); +} + +static void stroke_emit_point(struct arc_cb *cb, VGfloat x, VGfloat y) +{ + struct stroker *stroker = (struct stroker*)cb->user_data; + stroker_emit_line_to(stroker, x, y); +} + +static void stroke_emit_curve(struct arc_cb *cb, struct bezier *bezier) +{ + struct stroker *stroker = (struct stroker*)cb->user_data; + stroker_emit_curve_to(stroker, + bezier->x2, bezier->y2, + bezier->x3, bezier->y3, + bezier->x4, bezier->y4); +} + +static void arc_path_move(struct arc_cb *cb, VGfloat x, VGfloat y) +{ + struct path *path = (struct path*)cb->user_data; + path_move_to(path, x, y); +} + +static void arc_path_point(struct arc_cb *cb, VGfloat x, VGfloat y) +{ + struct path *path = (struct path*)cb->user_data; + path_line_to(path, x, y); +} + +static void arc_path_bezier(struct arc_cb *cb, struct bezier *bezier) +{ + struct path *path = (struct path*)cb->user_data; + path_cubic_to(path, + bezier->x2, bezier->y2, + bezier->x3, bezier->y3, + bezier->x4, bezier->y4); +} + +static INLINE int num_beziers_needed(struct arc *arc) +{ + double threshold = 0.05; + VGboolean found = VG_FALSE; + int n = 1; + double min_eta, max_eta; + + min_eta = MIN2(arc->eta1, arc->eta2); + max_eta = MAX2(arc->eta1, arc->eta2); + + while ((! found) && (n < 1024)) { + double d_eta = (max_eta - min_eta) / n; + if (d_eta <= 0.5 * M_PI) { + double eta_b = min_eta; + found = VG_TRUE; + for (int i = 0; found && (i < n); ++i) { + double etaA = eta_b; + eta_b += d_eta; + found = (estimate_error(arc, etaA, eta_b) <= threshold); + } + } + n = n << 1; + } + + return n; +} + +static void arc_to_beziers(struct arc *arc, + struct arc_cb cb, + struct matrix *matrix) +{ + int n = 1; + double d_eta, eta_b, cos_eta_b, + sin_eta_b, a_cos_eta_b, b_sin_eta_b, a_sin_eta_b, + b_cos_eta_b, x_b, y_b, x_b_dot, y_b_dot, lx, ly; + double t, alpha; + + { /* always move to the start of the arc */ + VGfloat x = arc->x1; + VGfloat y = arc->y1; + matrix_map_point(matrix, x, y, &x, &y); + cb.move(&cb, x, y); + } + + if (!arc->is_valid) { + VGfloat x = arc->x2; + VGfloat y = arc->y2; + matrix_map_point(matrix, x, y, &x, &y); + cb.point(&cb, x, y); + return; + } + + /* find the number of Bézier curves needed */ + n = num_beziers_needed(arc); + + d_eta = (arc->eta2 - arc->eta1) / n; + eta_b = arc->eta1; + + cos_eta_b = cos(eta_b); + sin_eta_b = sin(eta_b); + a_cos_eta_b = arc->a * cos_eta_b; + b_sin_eta_b = arc->b * sin_eta_b; + a_sin_eta_b = arc->a * sin_eta_b; + b_cos_eta_b = arc->b * cos_eta_b; + x_b = arc->cx + a_cos_eta_b * arc->cos_theta - + b_sin_eta_b * arc->sin_theta; + y_b = arc->cy + a_cos_eta_b * arc->sin_theta + + b_sin_eta_b * arc->cos_theta; + x_b_dot = -a_sin_eta_b * arc->cos_theta - + b_cos_eta_b * arc->sin_theta; + y_b_dot = -a_sin_eta_b * arc->sin_theta + + b_cos_eta_b * arc->cos_theta; + + { + VGfloat x = x_b, y = y_b; + matrix_map_point(matrix, x, y, &x, &y); + cb.point(&cb, x, y); + } + lx = x_b; + ly = y_b; + + t = tan(0.5 * d_eta); + alpha = sin(d_eta) * (sqrt(4 + 3 * t * t) - 1) / 3; + + for (int i = 0; i < n; ++i) { + struct bezier bezier; + double xA = x_b; + double yA = y_b; + double xADot = x_b_dot; + double yADot = y_b_dot; + + eta_b += d_eta; + cos_eta_b = cos(eta_b); + sin_eta_b = sin(eta_b); + a_cos_eta_b = arc->a * cos_eta_b; + b_sin_eta_b = arc->b * sin_eta_b; + a_sin_eta_b = arc->a * sin_eta_b; + b_cos_eta_b = arc->b * cos_eta_b; + x_b = arc->cx + a_cos_eta_b * arc->cos_theta - + b_sin_eta_b * arc->sin_theta; + y_b = arc->cy + a_cos_eta_b * arc->sin_theta + + b_sin_eta_b * arc->cos_theta; + x_b_dot = -a_sin_eta_b * arc->cos_theta - + b_cos_eta_b * arc->sin_theta; + y_b_dot = -a_sin_eta_b * arc->sin_theta + + b_cos_eta_b * arc->cos_theta; + + bezier_init(&bezier, + lx, ly, + (float) (xA + alpha * xADot), (float) (yA + alpha * yADot), + (float) (x_b - alpha * x_b_dot), (float) (y_b - alpha * y_b_dot), + (float) x_b, (float) y_b); +#if 0 + debug_printf("%d) Bezier (%f, %f), (%f, %f), (%f, %f), (%f, %f)\n", + i, + bezier.x1, bezier.y1, + bezier.x2, bezier.y2, + bezier.x3, bezier.y3, + bezier.x4, bezier.y4); +#endif + bezier_transform(&bezier, matrix); + cb.bezier(&cb, &bezier); + lx = x_b; + ly = y_b; + } +} + + +void arc_add_to_polygon(struct arc *arc, + struct polygon *poly, + struct matrix *matrix) +{ + struct arc_cb cb; + + cb.move = cb_null_move; + cb.point = polygon_point; + cb.bezier = polygon_bezier; + cb.user_data = poly; + + arc_to_beziers(arc, cb, matrix); +} + +void arc_stroke_cb(struct arc *arc, + struct stroker *stroke, + struct matrix *matrix) +{ + struct arc_cb cb; + + cb.move = cb_null_move; + cb.point = stroke_point; + cb.bezier = stroke_curve; + cb.user_data = stroke; + + arc_to_beziers(arc, cb, matrix); +} + +void arc_stroker_emit(struct arc *arc, + struct stroker *stroker, + struct matrix *matrix) +{ + struct arc_cb cb; + + cb.move = cb_null_move; + cb.point = stroke_emit_point; + cb.bezier = stroke_emit_curve; + cb.user_data = stroker; + + arc_to_beziers(arc, cb, matrix); +} + +void arc_to_path(struct arc *arc, + struct path *path, + struct matrix *matrix) +{ + struct arc_cb cb; + + cb.move = arc_path_move; + cb.point = arc_path_point; + cb.bezier = arc_path_bezier; + cb.user_data = path; + + arc_to_beziers(arc, cb, matrix); +} diff --git a/src/gallium/state_trackers/vega/arc.h b/src/gallium/state_trackers/vega/arc.h new file mode 100644 index 00000000000..3205cd5021d --- /dev/null +++ b/src/gallium/state_trackers/vega/arc.h @@ -0,0 +1,80 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 ARC_H +#define ARC_H + +#include "VG/openvg.h" + +struct polygon; +struct matrix; +struct stroker; +struct path; + +struct arc { + VGPathSegment type; + + VGfloat cx, cy; + + VGfloat a, b; + + VGfloat theta; + VGfloat cos_theta, sin_theta; + + VGfloat eta1; + VGfloat eta2; + + VGfloat x1, y1, x2, y2; + + VGboolean is_valid; +}; + +void arc_init(struct arc *arc, + VGPathSegment type, + VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2, + VGfloat rh, VGfloat rv, + VGfloat rot); + +void arc_add_to_polygon(struct arc *arc, + struct polygon *poly, + struct matrix *matrix); + + +void arc_to_path(struct arc *arc, + struct path *p, + struct matrix *matrix); + +void arc_stroke_cb(struct arc *arc, + struct stroker *stroke, + struct matrix *matrix); + +void arc_stroker_emit(struct arc *arc, + struct stroker *stroke, + struct matrix *matrix); + + +#endif diff --git a/src/gallium/state_trackers/vega/asm_fill.h b/src/gallium/state_trackers/vega/asm_fill.h new file mode 100644 index 00000000000..2f394ad6c55 --- /dev/null +++ b/src/gallium/state_trackers/vega/asm_fill.h @@ -0,0 +1,246 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 ASM_FILL_H +#define ASM_FILL_H + +static const char solid_fill_asm[] = + "MOV %s, CONST[0]\n"; + + +static const char linear_grad_asm[] = + "MOV TEMP[0].xy, IN[0]\n" + "MOV TEMP[0].z, CONST[1].yyyy\n" + "DP3 TEMP[1], CONST[2], TEMP[0]\n" + "DP3 TEMP[2], CONST[3], TEMP[0]\n" + "DP3 TEMP[3], CONST[4], TEMP[0]\n" + "RCP TEMP[3], TEMP[3]\n" + "MUL TEMP[1], TEMP[1], TEMP[3]\n" + "MUL TEMP[2], TEMP[2], TEMP[3]\n" + "MOV TEMP[4].x, TEMP[1]\n" + "MOV TEMP[4].y, TEMP[2]\n" + "MUL TEMP[0], CONST[0].yyyy, TEMP[4].yyyy\n" + "MAD TEMP[1], CONST[0].xxxx, TEMP[4].xxxx, TEMP[0]\n" + "MUL TEMP[2], TEMP[1], CONST[0].zzzz\n" + "TEX %s, TEMP[2], SAMP[0], 1D\n"; + +static const char radial_grad_asm[] = + "MOV TEMP[0].xy, IN[0]\n" + "MOV TEMP[0].z, CONST[1].yyyy\n" + "DP3 TEMP[1], CONST[2], TEMP[0]\n" + "DP3 TEMP[2], CONST[3], TEMP[0]\n" + "DP3 TEMP[3], CONST[4], TEMP[0]\n" + "RCP TEMP[3], TEMP[3]\n" + "MUL TEMP[1], TEMP[1], TEMP[3]\n" + "MUL TEMP[2], TEMP[2], TEMP[3]\n" + "MOV TEMP[5].x, TEMP[1]\n" + "MOV TEMP[5].y, TEMP[2]\n" + "MUL TEMP[0], CONST[0].yyyy, TEMP[5].yyyy\n" + "MAD TEMP[1], CONST[0].xxxx, TEMP[5].xxxx, TEMP[0]\n" + "ADD TEMP[1], TEMP[1], TEMP[1]\n" + "MUL TEMP[3], TEMP[5].yyyy, TEMP[5].yyyy\n" + "MAD TEMP[4], TEMP[5].xxxx, TEMP[5].xxxx, TEMP[3]\n" + "MOV TEMP[4], -TEMP[4]\n" + "MUL TEMP[2], CONST[0].zzzz, TEMP[4]\n" + "MUL TEMP[0], CONST[1].wwww, TEMP[2]\n" + "MUL TEMP[3], TEMP[1], TEMP[1]\n" + "SUB TEMP[2], TEMP[3], TEMP[0]\n" + "RSQ TEMP[2], |TEMP[2]|\n" + "RCP TEMP[2], TEMP[2]\n" + "SUB TEMP[1], TEMP[2], TEMP[1]\n" + "ADD TEMP[0], CONST[0].zzzz, CONST[0].zzzz\n" + "RCP TEMP[0], TEMP[0]\n" + "MUL TEMP[2], TEMP[1], TEMP[0]\n" + "TEX %s, TEMP[2], SAMP[0], 1D\n"; + +static const char pattern_asm[] = + "MOV TEMP[0].xy, IN[0]\n" + "MOV TEMP[0].z, CONST[1].yyyy\n" + "DP3 TEMP[1], CONST[2], TEMP[0]\n" + "DP3 TEMP[2], CONST[3], TEMP[0]\n" + "DP3 TEMP[3], CONST[4], TEMP[0]\n" + "RCP TEMP[3], TEMP[3]\n" + "MUL TEMP[1], TEMP[1], TEMP[3]\n" + "MUL TEMP[2], TEMP[2], TEMP[3]\n" + "MOV TEMP[4].x, TEMP[1]\n" + "MOV TEMP[4].y, TEMP[2]\n" + "RCP TEMP[0], CONST[1].zwzw\n" + "MOV TEMP[1], TEMP[4]\n" + "MUL TEMP[1].x, TEMP[1], TEMP[0]\n" + "MUL TEMP[1].y, TEMP[1], TEMP[0]\n" + "TEX %s, TEMP[1], SAMP[0], 2D\n"; + + +static const char mask_asm[] = + "TEX TEMP[1], IN[0], SAMP[1], 2D\n" + "MUL TEMP[0].w, TEMP[0].wwww, TEMP[1].wwww\n" + "MOV %s, TEMP[0]\n"; + + +static const char image_normal_asm[] = + "TEX %s, IN[1], SAMP[3], 2D\n"; + +static const char image_multiply_asm[] = + "TEX TEMP[1], IN[1], SAMP[3], 2D\n" + "MUL %s, TEMP[0], TEMP[1]\n"; + +static const char image_stencil_asm[] = + "TEX TEMP[1], IN[1], SAMP[3], 2D\n" + "MUL %s, TEMP[0], TEMP[1]\n"; + + +#define EXTENDED_BLEND_OVER \ + "SUB TEMP[3], CONST[1].yyyy, TEMP[1].wwww\n" \ + "SUB TEMP[4], CONST[1].yyyy, TEMP[0].wwww\n" \ + "MUL TEMP[3], TEMP[0], TEMP[3]\n" \ + "MUL TEMP[4], TEMP[1], TEMP[4]\n" \ + "ADD TEMP[3], TEMP[3], TEMP[4]\n" + +static const char blend_multiply_asm[] = + "TEX TEMP[1], IN[0], SAMP[2], 2D\n" + EXTENDED_BLEND_OVER + "MUL TEMP[4], TEMP[0], TEMP[1]\n" + "ADD TEMP[1], TEMP[4], TEMP[3]\n"/*result.rgb*/ + "MUL TEMP[2], TEMP[0].wwww, TEMP[1].wwww\n" + "ADD TEMP[3], TEMP[0].wwww, TEMP[1].wwww\n" + "SUB TEMP[1].w, TEMP[3], TEMP[2]\n" + "MOV %s, TEMP[1]\n"; +#if 1 +static const char blend_screen_asm[] = + "TEX TEMP[1], IN[0], SAMP[2], 2D\n" + "ADD TEMP[3], TEMP[0], TEMP[1]\n" + "MUL TEMP[2], TEMP[0], TEMP[1]\n" + "SUB %s, TEMP[3], TEMP[2]\n"; +#else +static const char blend_screen_asm[] = + "TEX TEMP[1], IN[0], SAMP[2], 2D\n" + "MOV %s, TEMP[1]\n"; +#endif + +static const char blend_darken_asm[] = + "TEX TEMP[1], IN[0], SAMP[2], 2D\n" + EXTENDED_BLEND_OVER + "MUL TEMP[4], TEMP[0], TEMP[1].wwww\n" + "MUL TEMP[5], TEMP[1], TEMP[0].wwww\n" + "MIN TEMP[4], TEMP[4], TEMP[5]\n" + "ADD TEMP[1], TEMP[3], TEMP[4]\n" + "MUL TEMP[2], TEMP[0].wwww, TEMP[1].wwww\n" + "ADD TEMP[3], TEMP[0].wwww, TEMP[1].wwww\n" + "SUB TEMP[1].w, TEMP[3], TEMP[2]\n" + "MOV %s, TEMP[1]\n"; + +static const char blend_lighten_asm[] = + "TEX TEMP[1], IN[0], SAMP[2], 2D\n" + EXTENDED_BLEND_OVER + "MUL TEMP[4], TEMP[0], TEMP[1].wwww\n" + "MUL TEMP[5], TEMP[1], TEMP[0].wwww\n" + "MAX TEMP[4], TEMP[4], TEMP[5]\n" + "ADD TEMP[1], TEMP[3], TEMP[4]\n" + "MUL TEMP[2], TEMP[0].wwww, TEMP[1].wwww\n" + "ADD TEMP[3], TEMP[0].wwww, TEMP[1].wwww\n" + "SUB TEMP[1].w, TEMP[3], TEMP[2]\n" + "MOV %s, TEMP[1]\n"; + + +static const char premultiply_asm[] = + "MUL TEMP[0].xyz, TEMP[0], TEMP[0].wwww\n"; + +static const char unpremultiply_asm[] = + "TEX TEMP[0], IN[0], SAMP[1], 2D\n"; + + +static const char color_bw_asm[] = + "ADD TEMP[1], CONST[1].yyyy, CONST[1].yyyy\n" + "RCP TEMP[2], TEMP[1]\n" + "ADD TEMP[1], CONST[1].yyyy, TEMP[2]\n" + "ADD TEMP[2].x, TEMP[0].xxxx, TEMP[0].yyyy\n" + "ADD TEMP[2].x, TEMP[0].zzzz, TEMP[0].xxxx\n" + "SGE TEMP[0].xyz, TEMP[2].xxxx, TEMP[1]\n" + "SGE TEMP[0].w, TEMP[0].wwww, TEMP[2].yyyy\n" + "MOV %s, TEMP[0]\n"; + + +struct shader_asm_info { + VGint id; + VGint num_tokens; + const char * txt; + + VGboolean needs_position; + + VGint start_const; + VGint num_consts; + + VGint start_sampler; + VGint num_samplers; + + VGint start_temp; + VGint num_temps; +}; + + +static const struct shader_asm_info shaders_asm[] = { + /* fills */ + {VEGA_SOLID_FILL_SHADER, 40, solid_fill_asm, + VG_FALSE, 0, 1, 0, 0, 0, 0}, + {VEGA_LINEAR_GRADIENT_SHADER, 200, linear_grad_asm, + VG_TRUE, 0, 5, 0, 1, 0, 5}, + {VEGA_RADIAL_GRADIENT_SHADER, 200, radial_grad_asm, + VG_TRUE, 0, 5, 0, 1, 0, 6}, + {VEGA_PATTERN_SHADER, 100, pattern_asm, + VG_TRUE, 1, 4, 0, 1, 0, 5}, + + /* image draw modes */ + {VEGA_IMAGE_NORMAL_SHADER, 200, image_normal_asm, + VG_TRUE, 0, 0, 3, 1, 0, 0}, + {VEGA_IMAGE_MULTIPLY_SHADER, 200, image_multiply_asm, + VG_TRUE, 0, 0, 3, 1, 0, 2}, + {VEGA_IMAGE_STENCIL_SHADER, 200, image_stencil_asm, + VG_TRUE, 0, 0, 3, 1, 0, 2}, + + {VEGA_MASK_SHADER, 100, mask_asm, + VG_TRUE, 0, 0, 1, 1, 0, 2}, + + /* extra blend modes */ + {VEGA_BLEND_MULTIPLY_SHADER, 200, blend_multiply_asm, + VG_TRUE, 1, 1, 2, 1, 0, 5}, + {VEGA_BLEND_SCREEN_SHADER, 200, blend_screen_asm, + VG_TRUE, 0, 0, 2, 1, 0, 4}, + {VEGA_BLEND_DARKEN_SHADER, 200, blend_darken_asm, + VG_TRUE, 1, 1, 2, 1, 0, 6}, + {VEGA_BLEND_LIGHTEN_SHADER, 200, blend_lighten_asm, + VG_TRUE, 1, 1, 2, 1, 0, 6}, + + /* premultiply */ + {VEGA_PREMULTIPLY_SHADER, 100, premultiply_asm, + VG_FALSE, 0, 0, 0, 0, 0, 1}, + {VEGA_UNPREMULTIPLY_SHADER, 100, unpremultiply_asm, + VG_FALSE, 0, 0, 0, 0, 0, 1}, + + /* color transform to black and white */ + {VEGA_BW_SHADER, 150, color_bw_asm, + VG_FALSE, 1, 1, 0, 0, 0, 3}, +}; +#endif diff --git a/src/gallium/state_trackers/vega/asm_filters.h b/src/gallium/state_trackers/vega/asm_filters.h new file mode 100644 index 00000000000..49807b9ab41 --- /dev/null +++ b/src/gallium/state_trackers/vega/asm_filters.h @@ -0,0 +1,117 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 ASM_FILTERS_H +#define ASM_FILTERS_H + +static const char color_matrix_asm[] = + "FRAG1.1\n" + "DCL IN[0], GENERIC[0], PERSPECTIVE\n" + "DCL OUT[0], COLOR, CONSTANT\n" + "DCL CONST[0..4], CONSTANT\n" + "DCL TEMP[0..4], CONSTANT\n" + "DCL SAMP[0], CONSTANT\n" + "TEX TEMP[0], IN[0], SAMP[0], 2D\n" + "MOV TEMP[1], TEMP[0].xxxx\n" + "MOV TEMP[2], TEMP[0].yyyy\n" + "MOV TEMP[3], TEMP[0].zzzz\n" + "MOV TEMP[4], TEMP[0].wwww\n" + "MUL TEMP[1], TEMP[1], CONST[0]\n" + "MUL TEMP[2], TEMP[2], CONST[1]\n" + "MUL TEMP[3], TEMP[3], CONST[2]\n" + "MUL TEMP[4], TEMP[4], CONST[3]\n" + "ADD TEMP[0], TEMP[1], CONST[4]\n" + "ADD TEMP[0], TEMP[0], TEMP[2]\n" + "ADD TEMP[0], TEMP[0], TEMP[3]\n" + "ADD TEMP[0], TEMP[0], TEMP[4]\n" + "MOV OUT[0], TEMP[0]\n" + "END\n"; + +static const char convolution_asm[] = + "FRAG1.1\n" + "DCL IN[0], GENERIC[0], PERSPECTIVE\n" + "DCL OUT[0], COLOR, CONSTANT\n" + "DCL TEMP[0..4], CONSTANT\n" + "DCL ADDR[0], CONSTANT\n" + "DCL CONST[0..%d], CONSTANT\n" + "DCL SAMP[0], CONSTANT\n" + "0: MOV TEMP[0], CONST[0].xxxx\n" + "1: MOV TEMP[1], CONST[0].xxxx\n" + "2: BGNLOOP2 :14\n" + "3: SGE TEMP[0].z, TEMP[0].yyyy, CONST[1].xxxx\n" + "4: IF TEMP[0].zzzz :7\n" + "5: BRK\n" + "6: ENDIF\n" + "7: ARL ADDR[0].x, TEMP[0].yyyy\n" + "8: MOV TEMP[3], CONST[ADDR[0]+2]\n" + "9: ADD TEMP[4].xy, IN[0], TEMP[3]\n" + "10: TEX TEMP[2], TEMP[4], SAMP[0], 2D\n" + "11: MOV TEMP[3], CONST[ADDR[0]+%d]\n" + "12: MAD TEMP[1], TEMP[2], TEMP[3], TEMP[1]\n" + "13: ADD TEMP[0].y, TEMP[0].yyyy, CONST[0].yyyy\n" + "14: ENDLOOP2 :2\n" + "15: MAD OUT[0], TEMP[1], CONST[1].yyyy, CONST[1].zzzz\n" + "16: END\n"; + + +static const char lookup_asm[] = + "FRAG1.1\n" + "DCL IN[0], GENERIC[0], PERSPECTIVE\n" + "DCL OUT[0], COLOR, CONSTANT\n" + "DCL TEMP[0..2], CONSTANT\n" + "DCL CONST[0], CONSTANT\n" + "DCL SAMP[0..1], CONSTANT\n" + "TEX TEMP[0], IN[0], SAMP[0], 2D\n" + "MOV TEMP[1], TEMP[0]\n" + /* do red */ + "TEX TEMP[2], TEMP[1].xxxx, SAMP[1], 1D\n" + "MOV TEMP[0].x, TEMP[2].xxxx\n" + /* do blue */ + "TEX TEMP[2], TEMP[1].yyyy, SAMP[1], 1D\n" + "MOV TEMP[0].y, TEMP[2].yyyy\n" + /* do green */ + "TEX TEMP[2], TEMP[1].zzzz, SAMP[1], 1D\n" + "MOV TEMP[0].z, TEMP[2].zzzz\n" + /* do alpha */ + "TEX TEMP[2], TEMP[1].wwww, SAMP[1], 1D\n" + "MOV TEMP[0].w, TEMP[2].wwww\n" + "MOV OUT[0], TEMP[0]\n" + "END\n"; + + +static const char lookup_single_asm[] = + "FRAG1.1\n" + "DCL IN[0], GENERIC[0], PERSPECTIVE\n" + "DCL OUT[0], COLOR, CONSTANT\n" + "DCL TEMP[0..2], CONSTANT\n" + "DCL CONST[0], CONSTANT\n" + "DCL SAMP[0..1], CONSTANT\n" + "TEX TEMP[0], IN[0], SAMP[0], 2D\n" + "TEX TEMP[1], TEMP[0].%s, SAMP[1], 1D\n" + "MOV OUT[0], TEMP[1]\n" + "END\n"; + +#endif diff --git a/src/gallium/state_trackers/vega/asm_util.h b/src/gallium/state_trackers/vega/asm_util.h new file mode 100644 index 00000000000..218e1d166db --- /dev/null +++ b/src/gallium/state_trackers/vega/asm_util.h @@ -0,0 +1,136 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 ASM_UTIL_H +#define ASM_UTIL_H + + +static const char pass_through_depth_asm[] = + "FRAG1.1\n" + "DCL IN[0], POSITION, LINEAR\n" + "DCL OUT[0].z, POSITION, CONSTANT\n" + "0: MOV OUT[0].z, IN[0].zzzz\n" + "1: END\n"; + + + +/* μnew = μmask */ +static const char set_mask_asm[] = + "FRAG1.1\n" + "DCL IN[0], GENERIC[0], PERSPECTIVE\n" + "DCL SAMP[0], CONSTANT\n" + "DCL OUT[0], COLOR, CONSTANT\n" + "0: TEX OUT[0], IN[0], SAMP[0], 2D\n"/*umask*/ + "1: END\n"; + +/* μnew = 1 – (1 – μmask)*(1 – μprev) */ +static const char union_mask_asm[] = + "FRAG1.1\n" + "DCL IN[0], GENERIC[0], PERSPECTIVE\n" + "DCL IN[1], POSITION, LINEAR\n" + "DCL CONST[0], CONSTANT\n" + "DCL SAMP[0..1], CONSTANT\n" + "DCL TEMP[0..3], CONSTANT\n" + "DCL OUT[0], COLOR, CONSTANT\n" + "0: TEX TEMP[1], IN[0], SAMP[0], 2D\n"/*umask*/ + "1: TEX TEMP[0], IN[1], SAMP[1], 2D\n"/*uprev*/ + "2: SUB TEMP[2], CONST[0], TEMP[0]\n" + "3: SUB TEMP[3], CONST[0], TEMP[1]\n" + "4: MUL TEMP[0].w, TEMP[2].wwww, TEMP[3].wwww\n" + "5: SUB OUT[0], CONST[0], TEMP[0]\n" + "6: END\n"; + +/* μnew = μmask *μprev */ +static const char intersect_mask_asm[] = + "FRAG1.1\n" + "DCL IN[0], GENERIC[0], PERSPECTIVE\n" + "DCL IN[1], POSITION, LINEAR\n" + "DCL CONST[0], CONSTANT\n" + "DCL SAMP[0..1], CONSTANT\n" + "DCL TEMP[0..1], CONSTANT\n" + "DCL OUT[0], COLOR, CONSTANT\n" + "0: TEX TEMP[0], IN[1], SAMP[1], 2D\n"/*uprev*/ + "1: TEX TEMP[1], IN[0], SAMP[0], 2D\n"/*umask*/ + "2: MUL OUT[0], TEMP[0].wwww, TEMP[1].wwww\n" + "3: END\n"; + +/* μnew = μprev*(1 – μmask) */ +static const char subtract_mask_asm[] = + "FRAG1.1\n" + "DCL IN[0], GENERIC[0], PERSPECTIVE\n" + "DCL IN[1], POSITION, LINEAR\n" + "DCL CONST[0], CONSTANT\n" + "DCL SAMP[0..1], CONSTANT\n" + "DCL TEMP[0..2], CONSTANT\n" + "DCL OUT[0], COLOR, CONSTANT\n" + "0: TEX TEMP[1], IN[0], SAMP[0], 2D\n"/*umask*/ + "1: TEX TEMP[0], IN[1], SAMP[1], 2D\n"/*uprev*/ + "2: SUB TEMP[2], CONST[0], TEMP[1]\n" + "3: MUL OUT[0], TEMP[2].wwww, TEMP[0].wwww\n" + "4: END\n"; + + +static const char vs_plain_asm[] = + "VERT1.1\n" + "DCL IN[0]\n" + "DCL OUT[0], POSITION\n" + "DCL TEMP[0]\n" + "DCL CONST[0..1]\n" + "0: MUL TEMP[0], IN[0], CONST[0]\n" + "1: ADD TEMP[0], TEMP[0], CONST[1]\n" + "2: MOV OUT[0], TEMP[0]\n" + "3: END\n"; + +static const char vs_clear_asm[] = + "VERT1.1\n" + "DCL IN[0]\n" + "DCL IN[1]\n" + "DCL OUT[0], POSITION\n" + "DCL OUT[1], COLOR\n" + "DCL TEMP[0]\n" + "DCL CONST[0..1]\n" + "0: MUL TEMP[0], IN[0], CONST[0]\n" + "1: ADD TEMP[0], TEMP[0], CONST[1]\n" + "2: MOV OUT[0], TEMP[0]\n" + "3: MOV OUT[1], IN[1]\n" + "4: END\n"; + + +static const char vs_texture_asm[] = + "VERT1.1\n" + "DCL IN[0]\n" + "DCL IN[1]\n" + "DCL OUT[0], POSITION\n" + "DCL OUT[1], GENERIC\n" + "DCL TEMP[0]\n" + "DCL CONST[0..1]\n" + "0: MUL TEMP[0], IN[0], CONST[0]\n" + "1: ADD TEMP[0], TEMP[0], CONST[1]\n" + "2: MOV OUT[0], TEMP[0]\n" + "3: MOV OUT[1], IN[1]\n" + "4: END\n"; + +#endif diff --git a/src/gallium/state_trackers/vega/bezier.c b/src/gallium/state_trackers/vega/bezier.c new file mode 100644 index 00000000000..39a7ade0161 --- /dev/null +++ b/src/gallium/state_trackers/vega/bezier.c @@ -0,0 +1,704 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "bezier.h" + +#include "matrix.h" +#include "polygon.h" + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + +#include <stdlib.h> +#include <stdio.h> +#include <assert.h> +#include <math.h> + +static const float flatness = 0.5; + + +static INLINE void split_left(struct bezier *bez, VGfloat t, struct bezier* left) +{ + left->x1 = bez->x1; + left->y1 = bez->y1; + + left->x2 = bez->x1 + t * (bez->x2 - bez->x1); + left->y2 = bez->y1 + t * (bez->y2 - bez->y1); + + left->x3 = bez->x2 + t * (bez->x3 - bez->x2); + left->y3 = bez->y2 + t * (bez->y3 - bez->y2); + + bez->x3 = bez->x3 + t * (bez->x4 - bez->x3); + bez->y3 = bez->y3 + t * (bez->y4 - bez->y3); + + bez->x2 = left->x3 + t * (bez->x3 - left->x3); + bez->y2 = left->y3 + t * (bez->y3 - left->y3); + + left->x3 = left->x2 + t * (left->x3 - left->x2); + left->y3 = left->y2 + t * (left->y3 - left->y2); + + left->x4 = bez->x1 = left->x3 + t * (bez->x2 - left->x3); + left->y4 = bez->y1 = left->y3 + t * (bez->y2 - left->y3); +} + +static INLINE void split(struct bezier *bez, + struct bezier *first_half, + struct bezier *second_half) +{ + double c = (bez->x2 + bez->x3) * 0.5; + first_half->x2 = (bez->x1 + bez->x2) * 0.5; + second_half->x3 = (bez->x3 + bez->x4) * 0.5; + first_half->x1 = bez->x1; + second_half->x4 = bez->x4; + first_half->x3 = (first_half->x2 + c) * 0.5; + second_half->x2 = (second_half->x3 + c) * 0.5; + first_half->x4 = second_half->x1 = + (first_half->x3 + second_half->x2) * 0.5; + + c = (bez->y2 + bez->y3) / 2; + first_half->y2 = (bez->y1 + bez->y2) * 0.5; + second_half->y3 = (bez->y3 + bez->y4) * 0.5; + first_half->y1 = bez->y1; + second_half->y4 = bez->y4; + first_half->y3 = (first_half->y2 + c) * 0.5; + second_half->y2 = (second_half->y3 + c) * 0.5; + first_half->y4 = second_half->y1 = + (first_half->y3 + second_half->y2) * 0.5; +} + +struct polygon * bezier_to_polygon(struct bezier *bez) +{ + struct polygon *poly = polygon_create(64); + polygon_vertex_append(poly, bez->x1, bez->y1); + bezier_add_to_polygon(bez, poly); + return poly; +} + +void bezier_add_to_polygon(const struct bezier *bez, + struct polygon *poly) +{ + struct bezier beziers[32]; + struct bezier *b; + + beziers[0] = *bez; + b = beziers; + + while (b >= beziers) { + double y4y1 = b->y4 - b->y1; + double x4x1 = b->x4 - b->x1; + double l = ABS(x4x1) + ABS(y4y1); + double d; + if (l > 1.f) { + d = ABS((x4x1)*(b->y1 - b->y2) - (y4y1)*(b->x1 - b->x2)) + + ABS((x4x1)*(b->y1 - b->y3) - (y4y1)*(b->x1 - b->x3)); + } else { + d = ABS(b->x1 - b->x2) + ABS(b->y1 - b->y2) + + ABS(b->x1 - b->x3) + ABS(b->y1 - b->y3); + l = 1.; + } + if (d < flatness*l || b == beziers + 31) { + /* good enough, we pop it off and add the endpoint */ + polygon_vertex_append(poly, b->x4, b->y4); + --b; + } else { + /* split, second half of the bezier goes lower into the stack */ + split(b, b+1, b); + ++b; + } + } +} + +static void add_if_close(struct bezier *bez, VGfloat *length, VGfloat error) +{ + struct bezier left, right; /* bez poly splits */ + VGfloat len = 0.0; /* arc length */ + VGfloat chord; /* chord length */ + + len = len + line_length(bez->x1, bez->y1, bez->x2, bez->y2); + len = len + line_length(bez->x2, bez->y2, bez->x3, bez->y3); + len = len + line_length(bez->x3, bez->y3, bez->x4, bez->y4); + + chord = line_length(bez->x1, bez->y1, bez->x4, bez->y4); + + if ((len-chord) > error) { + split(bez, &left, &right); /* split in two */ + add_if_close(&left, length, error); /* try left side */ + add_if_close(&right, length, error); /* try right side */ + return; + } + + *length = *length + len; + + return; +} + +float bezier_length(struct bezier *bez, float error) +{ + VGfloat length = 0.f; + + add_if_close(bez, &length, error); + return length; +} + +void bezier_init(struct bezier *bez, + float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) +{ + bez->x1 = x1; + bez->y1 = y1; + bez->x2 = x2; + bez->y2 = y2; + bez->x3 = x3; + bez->y3 = y3; + bez->x4 = x4; + bez->y4 = y4; +#if 0 + debug_printf("bezier in [%f, %f, %f, %f, %f, %f]\n", + x1, y1, x2, y2, x3, y3, x4, y4); +#endif +} + + +static INLINE void bezier_init2v(struct bezier *bez, + float *pt1, + float *pt2, + float *pt3, + float *pt4) +{ + bez->x1 = pt1[0]; + bez->y1 = pt1[1]; + + bez->x2 = pt2[0]; + bez->y2 = pt2[1]; + + bez->x3 = pt3[0]; + bez->y3 = pt3[1]; + + bez->x4 = pt4[0]; + bez->y4 = pt4[1]; +} + + +void bezier_transform(struct bezier *bez, + struct matrix *matrix) +{ + assert(matrix_is_affine(matrix)); + matrix_map_point(matrix, bez->x1, bez->y1, &bez->x1, &bez->y1); + matrix_map_point(matrix, bez->x2, bez->y2, &bez->x2, &bez->y2); + matrix_map_point(matrix, bez->x3, bez->y3, &bez->x3, &bez->y3); + matrix_map_point(matrix, bez->x4, bez->y4, &bez->x4, &bez->y4); +} + +static INLINE void bezier_point_at(const struct bezier *bez, float t, float *pt) +{ + float a, b, c, d; + float m_t; + m_t = 1. - t; + b = m_t * m_t; + c = t * t; + d = c * t; + a = b * m_t; + b *= 3. * t; + c *= 3. * m_t; + pt[0] = a*bez->x1 + b*bez->x2 + c*bez->x3 + d*bez->x4; + pt[1] = a*bez->y1 + b*bez->y2 + c*bez->y3 + d*bez->y4; +} + +static INLINE void bezier_normal_at(const struct bezier *bez, float t, float *norm) +{ + float m_t = 1. - t; + float a = m_t * m_t; + float b = t * m_t; + float c = t * t; + + norm[0] = (bez->y2-bez->y1) * a + (bez->y3-bez->y2) * b + (bez->y4-bez->y3) * c; + norm[1] = -(bez->x2-bez->x1) * a - (bez->x3-bez->x2) * b - (bez->x4-bez->x3) * c; +} + +enum shift_result { + Ok, + Discard, + Split, + Circle +}; + +static enum shift_result good_offset(const struct bezier *b1, + const struct bezier *b2, + float offset, float threshold) +{ + const float o2 = offset*offset; + const float max_dist_line = threshold*offset*offset; + const float max_dist_normal = threshold*offset; + const float spacing = 0.25; + for (float i = spacing; i < 0.99; i += spacing) { + float p1[2],p2[2], d, l; + float normal[2]; + bezier_point_at(b1, i, p1); + bezier_point_at(b2, i, p2); + d = (p1[0] - p2[0])*(p1[0] - p2[0]) + (p1[1] - p2[1])*(p1[1] - p2[1]); + if (ABS(d - o2) > max_dist_line) + return Split; + + bezier_normal_at(b1, i, normal); + l = ABS(normal[0]) + ABS(normal[1]); + if (l != 0.) { + d = ABS(normal[0]*(p1[1] - p2[1]) - normal[1]*(p1[0] - p2[0]) ) / l; + if (d > max_dist_normal) + return Split; + } + } + return Ok; +} + +static INLINE void shift_line_by_normal(float *l, float offset) +{ + float norm[4]; + float tx, ty; + + line_normal(l, norm); + line_normalize(norm); + + tx = (norm[2] - norm[0]) * offset; + ty = (norm[3] - norm[1]) * offset; + l[0] += tx; l[1] += ty; + l[2] += tx; l[3] += ty; +} + +static INLINE VGboolean is_bezier_line(float (*points)[2], int count) +{ + float dx13 = points[2][0] - points[0][0]; + float dy13 = points[2][1] - points[0][1]; + + float dx12 = points[1][0] - points[0][0]; + float dy12 = points[1][1] - points[0][1]; + + debug_assert(count > 2); + + if (count == 3) { + return floatsEqual(dx12 * dy13, dx13 * dy12); + } else if (count == 4) { + float dx14 = points[3][0] - points[0][0]; + float dy14 = points[3][1] - points[0][1]; + + return (floatsEqual(dx12 * dy13, dx13 * dy12) && + floatsEqual(dx12 * dy14, dx14 * dy12)); + } + + return VG_FALSE; +} + +static INLINE void compute_pt_normal(float *pt1, float *pt2, float *res) +{ + float line[4]; + float normal[4]; + line[0] = 0.f; line[1] = 0.f; + line[2] = pt2[0] - pt1[0]; + line[3] = pt2[1] - pt1[1]; + line_normal(line, normal); + line_normalize(normal); + + res[0] = normal[2]; + res[1] = normal[3]; +} + +static enum shift_result shift(const struct bezier *orig, + struct bezier *shifted, + float offset, float threshold) +{ + int map[4]; + VGboolean p1_p2_equal = (orig->x1 == orig->x2 && orig->y1 == orig->y2); + VGboolean p2_p3_equal = (orig->x2 == orig->x3 && orig->y2 == orig->y3); + VGboolean p3_p4_equal = (orig->x3 == orig->x4 && orig->y3 == orig->y4); + + float points[4][2]; + int np = 0; + float bounds[4]; + float points_shifted[4][2]; + float prev_normal[2]; + + points[np][0] = orig->x1; + points[np][1] = orig->y1; + map[0] = 0; + ++np; + if (!p1_p2_equal) { + points[np][0] = orig->x2; + points[np][1] = orig->y2; + ++np; + } + map[1] = np - 1; + if (!p2_p3_equal) { + points[np][0] = orig->x3; + points[np][1] = orig->y3; + ++np; + } + map[2] = np - 1; + if (!p3_p4_equal) { + points[np][0] = orig->x4; + points[np][1] = orig->y4; + ++np; + } + map[3] = np - 1; + if (np == 1) + return Discard; + + /* We need to specialcase lines of 3 or 4 points due to numerical + instability in intersection code below */ + if (np > 2 && is_bezier_line(points, np)) { + float l[4] = { points[0][0], points[0][1], + points[np-1][0], points[np-1][1] }; + float ctrl1[2], ctrl2[2]; + if (floatsEqual(points[0][0], points[np-1][0]) && + floatsEqual(points[0][1], points[np-1][1])) + return Discard; + + shift_line_by_normal(l, offset); + line_point_at(l, 0.33, ctrl1); + line_point_at(l, 0.66, ctrl2); + bezier_init(shifted, l[0], l[1], + ctrl1[0], ctrl1[1], ctrl2[0], ctrl2[1], + l[2], l[3]); + return Ok; + } + + bezier_bounds(orig, bounds); + if (np == 4 && bounds[2] < .1*offset && bounds[3] < .1*offset) { + float l = (orig->x1 - orig->x2)*(orig->x1 - orig->x2) + + (orig->y1 - orig->y2)*(orig->y1 - orig->y1) * + (orig->x3 - orig->x4)*(orig->x3 - orig->x4) + + (orig->y3 - orig->y4)*(orig->y3 - orig->y4); + float dot = (orig->x1 - orig->x2)*(orig->x3 - orig->x4) + + (orig->y1 - orig->y2)*(orig->y3 - orig->y4); + if (dot < 0 && dot*dot < 0.8*l) + /* the points are close and reverse dirction. Approximate the whole + thing by a semi circle */ + return Circle; + } + + compute_pt_normal(points[0], points[1], prev_normal); + + points_shifted[0][0] = points[0][0] + offset * prev_normal[0]; + points_shifted[0][1] = points[0][1] + offset * prev_normal[1]; + + for (int i = 1; i < np - 1; ++i) { + float normal_sum[2], r; + float next_normal[2]; + compute_pt_normal(points[i], points[i + 1], next_normal); + + normal_sum[0] = prev_normal[0] + next_normal[0]; + normal_sum[1] = prev_normal[1] + next_normal[1]; + + r = 1.0 + prev_normal[0] * next_normal[0] + + prev_normal[1] * next_normal[1]; + + if (floatsEqual(r + 1, 1)) { + points_shifted[i][0] = points[i][0] + offset * prev_normal[0]; + points_shifted[i][1] = points[i][1] + offset * prev_normal[1]; + } else { + float k = offset / r; + points_shifted[i][0] = points[i][0] + k * normal_sum[0]; + points_shifted[i][1] = points[i][1] + k * normal_sum[1]; + } + + prev_normal[0] = next_normal[0]; + prev_normal[1] = next_normal[1]; + } + + points_shifted[np - 1][0] = points[np - 1][0] + offset * prev_normal[0]; + points_shifted[np - 1][1] = points[np - 1][1] + offset * prev_normal[1]; + + bezier_init2v(shifted, + points_shifted[map[0]], points_shifted[map[1]], + points_shifted[map[2]], points_shifted[map[3]]); + + return good_offset(orig, shifted, offset, threshold); +} + +static VGboolean make_circle(const struct bezier *b, float offset, struct bezier *o) +{ + float normals[3][2]; + float dist; + float angles[2]; + float sign = 1.f; + int i; + float circle[3][2]; + + normals[0][0] = b->y2 - b->y1; + normals[0][1] = b->x1 - b->x2; + dist = sqrt(normals[0][0]*normals[0][0] + normals[0][1]*normals[0][1]); + if (floatsEqual(dist + 1, 1.f)) + return VG_FALSE; + normals[0][0] /= dist; + normals[0][1] /= dist; + + normals[2][0] = b->y4 - b->y3; + normals[2][1] = b->x3 - b->x4; + dist = sqrt(normals[2][0]*normals[2][0] + normals[2][1]*normals[2][1]); + if (floatsEqual(dist + 1, 1.f)) + return VG_FALSE; + normals[2][0] /= dist; + normals[2][1] /= dist; + + normals[1][0] = b->x1 - b->x2 - b->x3 + b->x4; + normals[1][1] = b->y1 - b->y2 - b->y3 + b->y4; + dist = -1*sqrt(normals[1][0]*normals[1][0] + normals[1][1]*normals[1][1]); + normals[1][0] /= dist; + normals[1][1] /= dist; + + for (i = 0; i < 2; ++i) { + float cos_a = normals[i][0]*normals[i+1][0] + normals[i][1]*normals[i+1][1]; + if (cos_a > 1.) + cos_a = 1.; + if (cos_a < -1.) + cos_a = -1; + angles[i] = acos(cos_a)/M_PI; + } + + if (angles[0] + angles[1] > 1.) { + /* more than 180 degrees */ + normals[1][0] = -normals[1][0]; + normals[1][1] = -normals[1][1]; + angles[0] = 1. - angles[0]; + angles[1] = 1. - angles[1]; + sign = -1.; + } + + circle[0][0] = b->x1 + normals[0][0]*offset; + circle[0][1] = b->y1 + normals[0][1]*offset; + + circle[1][0] = 0.5*(b->x1 + b->x4) + normals[1][0]*offset; + circle[1][1] = 0.5*(b->y1 + b->y4) + normals[1][1]*offset; + + circle[2][0] = b->x4 + normals[2][0]*offset; + circle[2][1] = b->y4 + normals[2][1]*offset; + + for (i = 0; i < 2; ++i) { + float kappa = 2.*KAPPA * sign * offset * angles[i]; + + o->x1 = circle[i][0]; + o->y1 = circle[i][1]; + o->x2 = circle[i][0] - normals[i][1]*kappa; + o->y2 = circle[i][1] + normals[i][0]*kappa; + o->x3 = circle[i+1][0] + normals[i+1][1]*kappa; + o->y3 = circle[i+1][1] - normals[i+1][0]*kappa; + o->x4 = circle[i+1][0]; + o->y4 = circle[i+1][1]; + + ++o; + } + return VG_TRUE; +} + +int bezier_translate_by_normal(struct bezier *bez, + struct bezier *curves, + int max_curves, + float normal_len, + float threshold) +{ + struct bezier beziers[10]; + struct bezier *b, *o; + + /* fixme: this should really be floatsEqual */ + if (bez->x1 == bez->x2 && bez->x1 == bez->x3 && bez->x1 == bez->x4 && + bez->y1 == bez->y2 && bez->y1 == bez->y3 && bez->y1 == bez->y4) + return 0; + + --max_curves; +redo: + beziers[0] = *bez; + b = beziers; + o = curves; + + while (b >= beziers) { + int stack_segments = b - beziers + 1; + enum shift_result res; + if ((stack_segments == 10) || (o - curves == max_curves - stack_segments)) { + threshold *= 1.5; + if (threshold > 2.) + goto give_up; + goto redo; + } + res = shift(b, o, normal_len, threshold); + if (res == Discard) { + --b; + } else if (res == Ok) { + ++o; + --b; + continue; + } else if (res == Circle && max_curves - (o - curves) >= 2) { + /* add semi circle */ + if (make_circle(b, normal_len, o)) + o += 2; + --b; + } else { + split(b, b+1, b); + ++b; + } + } + +give_up: + while (b >= beziers) { + enum shift_result res = shift(b, o, normal_len, threshold); + + /* if res isn't Ok or Split then *o is undefined */ + if (res == Ok || res == Split) + ++o; + + --b; + } + + debug_assert(o - curves <= max_curves); + return o - curves; +} + +void bezier_bounds(const struct bezier *bez, + float *bounds/*x/y/width/height*/) +{ + float xmin = bez->x1; + float xmax = bez->x1; + float ymin = bez->y1; + float ymax = bez->y1; + + if (bez->x2 < xmin) + xmin = bez->x2; + else if (bez->x2 > xmax) + xmax = bez->x2; + if (bez->x3 < xmin) + xmin = bez->x3; + else if (bez->x3 > xmax) + xmax = bez->x3; + if (bez->x4 < xmin) + xmin = bez->x4; + else if (bez->x4 > xmax) + xmax = bez->x4; + + if (bez->y2 < ymin) + ymin = bez->y2; + else if (bez->y2 > ymax) + ymax = bez->y2; + if (bez->y3 < ymin) + ymin = bez->y3; + else if (bez->y3 > ymax) + ymax = bez->y3; + if (bez->y4 < ymin) + ymin = bez->y4; + else if (bez->y4 > ymax) + ymax = bez->y4; + + bounds[0] = xmin; /* x */ + bounds[1] = ymin; /* y */ + bounds[2] = xmax - xmin; /* width */ + bounds[3] = ymax - ymin; /* height */ +} + +void bezier_start_tangent(const struct bezier *bez, + float *tangent) +{ + tangent[0] = bez->x1; + tangent[1] = bez->y1; + tangent[2] = bez->x2; + tangent[3] = bez->y2; + + if (null_line(tangent)) { + tangent[0] = bez->x1; + tangent[1] = bez->y1; + tangent[2] = bez->x3; + tangent[3] = bez->y3; + } + if (null_line(tangent)) { + tangent[0] = bez->x1; + tangent[1] = bez->y1; + tangent[2] = bez->x4; + tangent[3] = bez->y4; + } +} + + +static INLINE VGfloat bezier_t_at_length(struct bezier *bez, + VGfloat at_length, + VGfloat error) +{ + VGfloat len = bezier_length(bez, error); + VGfloat t = 1.0; + VGfloat last_bigger = 1.; + + if (at_length > len || floatsEqual(at_length, len)) + return t; + + if (floatIsZero(at_length)) + return 0.f; + + t *= 0.5; + while (1) { + struct bezier right = *bez; + struct bezier left; + VGfloat tmp_len; + split_left(&right, t, &left); + tmp_len = bezier_length(&left, error); + if (ABS(tmp_len - at_length) < error) + break; + + if (tmp_len < at_length) { + t += (last_bigger - t)*.5; + } else { + last_bigger = t; + t -= t*.5; + } + } + return t; +} + +void bezier_point_at_length(struct bezier *bez, + float length, + float *point, + float *normal) +{ + /* ~0.000001 seems to be required to pass G2080x tests */ + VGfloat t = bezier_t_at_length(bez, length, 0.000001); + bezier_point_at(bez, t, point); + bezier_normal_at(bez, t, normal); + vector_unit(normal); +} + +void bezier_point_at_t(struct bezier *bez, float t, + float *point, float *normal) +{ + bezier_point_at(bez, t, point); + bezier_normal_at(bez, t, normal); + vector_unit(normal); +} + +void bezier_exact_bounds(const struct bezier *bez, + float *bounds/*x/y/width/height*/) +{ + struct polygon *poly = polygon_create(64); + polygon_vertex_append(poly, bez->x1, bez->y1); + bezier_add_to_polygon(bez, poly); + polygon_bounding_rect(poly, bounds); + polygon_destroy(poly); +} + diff --git a/src/gallium/state_trackers/vega/bezier.h b/src/gallium/state_trackers/vega/bezier.h new file mode 100644 index 00000000000..e06666051ca --- /dev/null +++ b/src/gallium/state_trackers/vega/bezier.h @@ -0,0 +1,81 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 BEZIER_H +#define BEZIER_H + +struct polygon; +struct matrix; + +struct bezier { + float x1, y1; + float x2, y2; + float x3, y3; + float x4, y4; +}; + + +#define BEZIER_DEFAULT_ERROR 0.01 + +/* kappa as being l of a circle with r = 1, we can emulate any + * circle of radius r by using the formula + * l = r . kappa + * More at: + * http://www.whizkidtech.redprince.net/bezier/circle/ */ +#define KAPPA 0.5522847498 + +void bezier_init(struct bezier *bez, + float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4); + +struct polygon *bezier_to_polygon(struct bezier *bez); +void bezier_add_to_polygon(const struct bezier *bez, + struct polygon *poly); +float bezier_length(struct bezier *bez, float error); +void bezier_transform(struct bezier *bez, + struct matrix *mat); + +int bezier_translate_by_normal(struct bezier *b, + struct bezier *curves, + int max_curves, + float normal_len, + float threshold); +void bezier_bounds(const struct bezier *bez, + float *bounds/*x/y/width/height*/); +void bezier_exact_bounds(const struct bezier *bez, + float *bounds/*x/y/width/height*/); + +void bezier_start_tangent(const struct bezier *bez, + float *tangent); + +void bezier_point_at_length(struct bezier *bez, float length, + float *point, float *normal); +void bezier_point_at_t(struct bezier *bez, float t, + float *point, float *normal); + +#endif diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c new file mode 100644 index 00000000000..9a722980d52 --- /dev/null +++ b/src/gallium/state_trackers/vega/image.c @@ -0,0 +1,654 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "image.h" + +#include "vg_translate.h" +#include "vg_context.h" +#include "matrix.h" +#include "renderer.h" +#include "util_array.h" +#include "api_consts.h" +#include "shaders_cache.h" +#include "shader.h" + +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "pipe/p_inlines.h" +#include "util/u_blit.h" +#include "util/u_tile.h" +#include "util/u_memory.h" +#include "util/u_math.h" + +static enum pipe_format vg_format_to_pipe(VGImageFormat format) +{ + switch(format) { + case VG_sRGB_565: + return PIPE_FORMAT_R5G6B5_UNORM; + case VG_sRGBA_5551: + return PIPE_FORMAT_A1R5G5B5_UNORM; + case VG_sRGBA_4444: + return PIPE_FORMAT_A4R4G4B4_UNORM; + case VG_sL_8: + case VG_lL_8: + return PIPE_FORMAT_L8_UNORM; + case VG_BW_1: + return PIPE_FORMAT_A8R8G8B8_UNORM; + case VG_A_8: + return PIPE_FORMAT_A8_UNORM; +#ifdef OPENVG_VERSION_1_1 + case VG_A_1: + case VG_A_4: + return PIPE_FORMAT_A8_UNORM; +#endif + default: + return PIPE_FORMAT_A8R8G8B8_UNORM; + } +} + +static INLINE void vg_sync_size(VGfloat *src_loc, VGfloat *dst_loc) +{ + src_loc[2] = MIN2(src_loc[2], dst_loc[2]); + src_loc[3] = MIN2(src_loc[3], dst_loc[3]); + dst_loc[2] = src_loc[2]; + dst_loc[3] = src_loc[3]; +} + + +static void vg_copy_texture(struct vg_context *ctx, + struct pipe_texture *dst, VGint dx, VGint dy, + struct pipe_texture *src, VGint sx, VGint sy, + VGint width, VGint height) +{ + VGfloat dst_loc[4], src_loc[4]; + VGfloat dst_bounds[4], src_bounds[4]; + VGfloat src_shift[4], dst_shift[4], shift[4]; + + dst_loc[0] = dx; + dst_loc[1] = dy; + dst_loc[2] = width; + dst_loc[3] = height; + dst_bounds[0] = 0.f; + dst_bounds[1] = 0.f; + dst_bounds[2] = dst->width[0]; + dst_bounds[3] = dst->height[0]; + + src_loc[0] = sx; + src_loc[1] = sy; + src_loc[2] = width; + src_loc[3] = height; + src_bounds[0] = 0.f; + src_bounds[1] = 0.f; + src_bounds[2] = src->width[0]; + src_bounds[3] = src->height[0]; + + vg_bound_rect(src_loc, src_bounds, src_shift); + vg_bound_rect(dst_loc, dst_bounds, dst_shift); + shift[0] = src_shift[0] - dst_shift[0]; + shift[1] = src_shift[1] - dst_shift[1]; + + if (shift[0] < 0) + vg_shift_rectx(src_loc, src_bounds, -shift[0]); + else + vg_shift_rectx(dst_loc, dst_bounds, shift[0]); + + if (shift[1] < 0) + vg_shift_recty(src_loc, src_bounds, -shift[1]); + else + vg_shift_recty(dst_loc, dst_bounds, shift[1]); + + vg_sync_size(src_loc, dst_loc); + + if (src_loc[2] >= 0 && src_loc[3] >= 0 && + dst_loc[2] >= 0 && dst_loc[3] >= 0) { + renderer_copy_texture(ctx->renderer, + src, + src_loc[0], + src_loc[1] + src_loc[3], + src_loc[0] + src_loc[2], + src_loc[1], + dst, + dst_loc[0], + dst_loc[1] + dst_loc[3], + dst_loc[0] + dst_loc[2], + dst_loc[1]); + } + +} + +void vg_copy_surface(struct vg_context *ctx, + struct pipe_surface *dst, VGint dx, VGint dy, + struct pipe_surface *src, VGint sx, VGint sy, + VGint width, VGint height) +{ + VGfloat dst_loc[4], src_loc[4]; + VGfloat dst_bounds[4], src_bounds[4]; + VGfloat src_shift[4], dst_shift[4], shift[4]; + + dst_loc[0] = dx; + dst_loc[1] = dy; + dst_loc[2] = width; + dst_loc[3] = height; + dst_bounds[0] = 0.f; + dst_bounds[1] = 0.f; + dst_bounds[2] = dst->width; + dst_bounds[3] = dst->height; + + src_loc[0] = sx; + src_loc[1] = sy; + src_loc[2] = width; + src_loc[3] = height; + src_bounds[0] = 0.f; + src_bounds[1] = 0.f; + src_bounds[2] = src->width; + src_bounds[3] = src->height; + + vg_bound_rect(src_loc, src_bounds, src_shift); + vg_bound_rect(dst_loc, dst_bounds, dst_shift); + shift[0] = src_shift[0] - dst_shift[0]; + shift[1] = src_shift[1] - dst_shift[1]; + + if (shift[0] < 0) + vg_shift_rectx(src_loc, src_bounds, -shift[0]); + else + vg_shift_rectx(dst_loc, dst_bounds, shift[0]); + + if (shift[1] < 0) + vg_shift_recty(src_loc, src_bounds, -shift[1]); + else + vg_shift_recty(dst_loc, dst_bounds, shift[1]); + + vg_sync_size(src_loc, dst_loc); + + if (src_loc[2] > 0 && src_loc[3] > 0 && + dst_loc[2] > 0 && dst_loc[3] > 0) { + if (src == dst) + renderer_copy_surface(ctx->renderer, + src, + src_loc[0], + src->height - (src_loc[1] + src_loc[3]), + src_loc[0] + src_loc[2], + src->height - src_loc[1], + dst, + dst_loc[0], + dst->height - (dst_loc[1] + dst_loc[3]), + dst_loc[0] + dst_loc[2], + dst->height - dst_loc[1], + 0, 0); + else + renderer_copy_surface(ctx->renderer, + src, + src_loc[0], + src->height - src_loc[1], + src_loc[0] + src_loc[2], + src->height - (src_loc[1] + src_loc[3]), + dst, + dst_loc[0], + dst->height - (dst_loc[1] + dst_loc[3]), + dst_loc[0] + dst_loc[2], + dst->height - dst_loc[1], + 0, 0); + } + +} + +static struct pipe_texture *image_texture(struct vg_image *img) +{ + struct pipe_texture *tex = img->texture; + return tex; +} + + +static void image_cleari(struct vg_image *img, VGint clear_colori, + VGint x, VGint y, VGint width, VGint height) +{ + VGint *clearbuf; + VGint i; + VGfloat dwidth, dheight; + + clearbuf = malloc(sizeof(VGint)*width*height); + for (i = 0; i < width*height; ++i) + clearbuf[i] = clear_colori; + + dwidth = MIN2(width, img->width); + dheight = MIN2(height, img->height); + + image_sub_data(img, clearbuf, width * sizeof(VGint), + VG_sRGBA_8888, + x, y, dwidth, dheight); + free(clearbuf); +} + +struct vg_image * image_create(VGImageFormat format, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *image = CALLOC_STRUCT(vg_image); + enum pipe_format pformat = vg_format_to_pipe(format); + struct pipe_texture pt, *newtex; + struct pipe_screen *screen = ctx->pipe->screen; + + vg_init_object(&image->base, ctx, VG_OBJECT_IMAGE); + + image->format = format; + image->width = width; + image->height = height; + + image->sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + image->sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + image->sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + image->sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST; + image->sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST; + image->sampler.normalized_coords = 1; + + assert(screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_SAMPLER, 0)); + + memset(&pt, 0, sizeof(pt)); + pt.target = PIPE_TEXTURE_2D; + pt.format = pformat; + pf_get_block(pformat, &pt.block); + pt.last_level = 0; + pt.width[0] = width; + pt.height[0] = height; + pt.depth[0] = 1; + pt.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + + newtex = screen->texture_create(screen, &pt); + + debug_assert(newtex); + + image->texture = newtex; + + vg_context_add_object(ctx, VG_OBJECT_IMAGE, image); + + image_cleari(image, 0, 0, 0, image->width, image->height); + return image; +} + +void image_destroy(struct vg_image *img) +{ + struct vg_context *ctx = vg_current_context(); + vg_context_remove_object(ctx, VG_OBJECT_IMAGE, img); + + + if (img->parent) { + /* remove img from the parent child array */ + int idx; + struct vg_image **array = + (struct vg_image **)img->parent->children_array->data; + + for (idx = 0; idx < img->parent->children_array->num_elements; ++idx) { + struct vg_image *child = array[idx]; + if (child == img) { + break; + } + } + debug_assert(idx < img->parent->children_array->num_elements); + array_remove_element(img->parent->children_array, idx); + } + + if (img->children_array && img->children_array->num_elements) { + /* reparent the children */ + VGint i; + struct vg_image *parent = img->parent; + struct vg_image **children = + (struct vg_image **)img->children_array->data; + if (!parent) { + VGint min_x = children[0]->x; + parent = children[0]; + + for (i = 1; i < img->children_array->num_elements; ++i) { + struct vg_image *child = children[i]; + if (child->x < min_x) { + parent = child; + } + } + } + + for (i = 0; i < img->children_array->num_elements; ++i) { + struct vg_image *child = children[i]; + if (child != parent) { + child->parent = parent; + if (!parent->children_array) { + parent->children_array = array_create( + sizeof(struct vg_image*)); + } + array_append_data(parent->children_array, + &child, 1); + } else + child->parent = NULL; + } + array_destroy(img->children_array); + } + + pipe_texture_reference(&img->texture, NULL); + free(img); +} + +void image_clear(struct vg_image *img, + VGint x, VGint y, VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + VGfloat *clear_colorf = ctx->state.vg.clear_color; + VGubyte r, g, b ,a; + VGint clear_colori; + /* FIXME: this is very nasty */ + r = float_to_ubyte(clear_colorf[0]); + g = float_to_ubyte(clear_colorf[1]); + b = float_to_ubyte(clear_colorf[2]); + a = float_to_ubyte(clear_colorf[3]); + clear_colori = r << 24 | g << 16 | b << 8 | a; + image_cleari(img, clear_colori, x, y, width, height); +} + +void image_sub_data(struct vg_image *image, + const void * data, + VGint dataStride, + VGImageFormat dataFormat, + VGint x, VGint y, + VGint width, VGint height) +{ + const VGint yStep = 1; + VGubyte *src = (VGubyte *)data; + VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4]; + VGfloat *df = (VGfloat*)temp; + VGint i; + struct vg_context *ctx = vg_current_context(); + struct pipe_screen *screen = ctx->pipe->screen; + struct pipe_texture *texture = image_texture(image); + VGint xoffset = 0, yoffset = 0; + + if (x < 0) { + xoffset -= x; + width += x; + x = 0; + } + if (y < 0) { + yoffset -= y; + height += y; + y = 0; + } + + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (x > image->width || y > image->width) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + + if (x + width > image->width) { + width = image->width - x; + } + + if (y + height > image->height) { + height = image->height - y; + } + + { /* upload color_data */ + struct pipe_transfer *transfer = screen->get_tex_transfer( + screen, texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, 0, 0, texture->width[0], texture->height[0]); + src += (dataStride * yoffset); + for (i = 0; i < height; i++) { + _vega_unpack_float_span_rgba(ctx, width, xoffset, src, dataFormat, temp); + pipe_put_tile_rgba(transfer, x+image->x, y+image->y, width, 1, df); + y += yStep; + src += dataStride; + } + screen->tex_transfer_destroy(transfer); + } +} + +void image_get_sub_data(struct vg_image * image, + void * data, + VGint dataStride, + VGImageFormat dataFormat, + VGint sx, VGint sy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_context *pipe = ctx->pipe; + struct pipe_screen *screen = pipe->screen; + VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4]; + VGfloat *df = (VGfloat*)temp; + VGint y = 0, yStep = 1; + VGint i; + VGubyte *dst = (VGubyte *)data; + + { + struct pipe_transfer *transfer = + screen->get_tex_transfer(screen, + image->texture, 0, 0, 0, + PIPE_TRANSFER_READ, + 0, 0, + image->x + image->width, + image->y + image->height); + /* Do a row at a time to flip image data vertically */ + for (i = 0; i < height; i++) { +#if 0 + debug_printf("%d-%d == %d\n", sy, height, y); +#endif + pipe_get_tile_rgba(transfer, sx+image->x, y, width, 1, df); + y += yStep; + _vega_pack_rgba_span_float(ctx, width, temp, dataFormat, dst); + dst += dataStride; + } + + screen->tex_transfer_destroy(transfer); + } +} + +struct vg_image * image_child_image(struct vg_image *parent, + VGint x, VGint y, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_image *image = CALLOC_STRUCT(vg_image); + + vg_init_object(&image->base, ctx, VG_OBJECT_IMAGE); + + image->x = parent->x + x; + image->y = parent->y + y; + image->width = width; + image->height = height; + image->parent = parent; + image->texture = 0; + pipe_texture_reference(&image->texture, + parent->texture); + + image->sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + image->sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + image->sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + image->sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST; + image->sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST; + image->sampler.normalized_coords = 1; + + if (!parent->children_array) + parent->children_array = array_create( + sizeof(struct vg_image*)); + + array_append_data(parent->children_array, + &image, 1); + + vg_context_add_object(ctx, VG_OBJECT_IMAGE, image); + + return image; +} + +void image_copy(struct vg_image *dst, VGint dx, VGint dy, + struct vg_image *src, VGint sx, VGint sy, + VGint width, VGint height, + VGboolean dither) +{ + struct vg_context *ctx = vg_current_context(); + + if (width <= 0 || height <= 0) { + vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR); + return; + } + /* make sure rendering has completed */ + ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + vg_copy_texture(ctx, dst->texture, dst->x + dx, dst->y + dy, + src->texture, src->x + sx, src->y + sy, width, height); +} + +void image_draw(struct vg_image *img) +{ + struct vg_context *ctx = vg_current_context(); + VGfloat x1, y1; + VGfloat x2, y2; + VGfloat x3, y3; + VGfloat x4, y4; + struct matrix *matrix; + + x1 = 0; + y1 = 0; + x2 = img->width; + y2 = 0; + x3 = img->width; + y3 = img->height; + x4 = 0; + y4 = img->height; + + matrix = &ctx->state.vg.image_user_to_surface_matrix; + + matrix_map_point(matrix, x1, y1, &x1, &y1); + matrix_map_point(matrix, x2, y2, &x2, &y2); + matrix_map_point(matrix, x3, y3, &x3, &y3); + matrix_map_point(matrix, x4, y4, &x4, &y4); + + shader_set_drawing_image(ctx->shader, VG_TRUE); + shader_set_paint(ctx->shader, ctx->state.vg.fill_paint); + shader_set_image(ctx->shader, img); + shader_bind(ctx->shader); + + renderer_texture_quad(ctx->renderer, image_texture(img), + img->x, img->y, img->x + img->width, img->y + img->height, + x1, y1, x2, y2, x3, y3, x4, y4); +} + +void image_set_pixels(VGint dx, VGint dy, + struct vg_image *src, VGint sx, VGint sy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_context *pipe = ctx->pipe; + struct pipe_screen *screen = pipe->screen; + struct pipe_surface *surf; + struct st_renderbuffer *strb = ctx->draw_buffer->strb; + + /* make sure rendering has completed */ + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + + surf = screen->get_tex_surface(screen, image_texture(src), 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_READ); + + vg_copy_surface(ctx, strb->surface, dx, dy, + surf, sx+src->x, sy+src->y, width, height); + + screen->tex_surface_destroy(surf); +} + +void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy, + VGint sx, VGint sy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_context *pipe = ctx->pipe; + struct pipe_screen *screen = pipe->screen; + struct pipe_surface *surf; + struct st_renderbuffer *strb = ctx->draw_buffer->strb; + + /* flip the y coordinates */ + /*dy = dst->height - dy - height;*/ + + /* make sure rendering has completed */ + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + + surf = screen->get_tex_surface(screen, image_texture(dst), 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE | + PIPE_BUFFER_USAGE_GPU_READ); + vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy, + strb->surface, sx, sy, width, height); + + pipe_surface_reference(&surf, NULL); +} + + +VGboolean vg_image_overlaps(struct vg_image *dst, + struct vg_image *src) +{ + if (dst == src || dst->parent == src || + dst == src->parent) + return VG_TRUE; + if (dst->parent && dst->parent == src->parent) { + VGfloat left1 = dst->x; + VGfloat left2 = src->x; + VGfloat right1 = dst->x + dst->width; + VGfloat right2 = src->x + src->width; + VGfloat bottom1 = dst->y; + VGfloat bottom2 = src->y; + VGfloat top1 = dst->y + dst->height; + VGfloat top2 = src->y + src->height; + + return !(left2 > right1 || right2 < left1 || + top2 > bottom1 || bottom2 < top1); + } + return VG_FALSE; +} + +VGint image_bind_samplers(struct vg_image *img, struct pipe_sampler_state **samplers, + struct pipe_texture **textures) +{ + img->sampler.min_img_filter = image_sampler_filter(img->base.ctx); + img->sampler.mag_img_filter = image_sampler_filter(img->base.ctx); + samplers[3] = &img->sampler; + textures[3] = img->texture; + return 1; +} + +VGint image_sampler_filter(struct vg_context *ctx) +{ + switch(ctx->state.vg.image_quality) { + case VG_IMAGE_QUALITY_NONANTIALIASED: + return PIPE_TEX_FILTER_NEAREST; + break; + case VG_IMAGE_QUALITY_FASTER: + return PIPE_TEX_FILTER_NEAREST; + break; + case VG_IMAGE_QUALITY_BETTER: + /*return PIPE_TEX_FILTER_ANISO;*/ + return PIPE_TEX_FILTER_LINEAR; + break; + default: + debug_printf("Unknown image quality"); + } + return PIPE_TEX_FILTER_NEAREST; +} diff --git a/src/gallium/state_trackers/vega/image.h b/src/gallium/state_trackers/vega/image.h new file mode 100644 index 00000000000..78e17cffa64 --- /dev/null +++ b/src/gallium/state_trackers/vega/image.h @@ -0,0 +1,104 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 IMAGES_H +#define IMAGES_H + +#include "vg_context.h" +#include "pipe/p_state.h" + +struct pipe_texture; +struct array; +struct vg_context; +struct pipe_surface; + +struct vg_image { + struct vg_object base; + VGImageFormat format; + VGint x, y; + VGint width, height; + + struct vg_image *parent; + + struct pipe_texture *texture; + struct pipe_sampler_state sampler; + + struct array *children_array; +}; + +struct vg_image *image_create(VGImageFormat format, + VGint width, VGint height); +void image_destroy(struct vg_image *img); + +void image_clear(struct vg_image *img, + VGint x, VGint y, VGint width, VGint height); + +void image_sub_data(struct vg_image *image, + const void * data, + VGint dataStride, + VGImageFormat dataFormat, + VGint x, VGint y, + VGint width, VGint height); + +void image_get_sub_data(struct vg_image * image, + void * data, + VGint dataStride, + VGImageFormat dataFormat, + VGint x, VGint y, + VGint width, VGint height); + +struct vg_image *image_child_image(struct vg_image *parent, + VGint x, VGint y, + VGint width, VGint height); + +void image_copy(struct vg_image *dst, VGint dx, VGint dy, + struct vg_image *src, VGint sx, VGint sy, + VGint width, VGint height, + VGboolean dither); + +void image_draw(struct vg_image *img); + +void image_set_pixels(VGint dx, VGint dy, + struct vg_image *src, VGint sx, VGint sy, + VGint width, VGint height); +void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy, + VGint sx, VGint sy, + VGint width, VGint height); + +VGint image_bind_samplers(struct vg_image *dst, struct pipe_sampler_state **samplers, + struct pipe_texture **textures); + +VGboolean vg_image_overlaps(struct vg_image *dst, + struct vg_image *src); + +VGint image_sampler_filter(struct vg_context *ctx); + +void vg_copy_surface(struct vg_context *ctx, + struct pipe_surface *dst, VGint dx, VGint dy, + struct pipe_surface *src, VGint sx, VGint sy, + VGint width, VGint height); + +#endif diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c new file mode 100644 index 00000000000..24650a37d50 --- /dev/null +++ b/src/gallium/state_trackers/vega/mask.c @@ -0,0 +1,690 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "mask.h" + +#include "path.h" +#include "image.h" +#include "shaders_cache.h" +#include "renderer.h" +#include "asm_util.h" +#include "st_inlines.h" + +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "pipe/p_inlines.h" +#include "util/u_memory.h" + +struct vg_mask_layer { + struct vg_object base; + + VGint width; + VGint height; + + struct pipe_texture *texture; +}; + +static INLINE struct pipe_surface * +alpha_mask_surface(struct vg_context *ctx, int usage) +{ + struct pipe_screen *screen = ctx->pipe->screen; + struct st_framebuffer *stfb = ctx->draw_buffer; + return screen->get_tex_surface(screen, + stfb->alpha_mask, + 0, 0, 0, + usage); +} + +static INLINE VGboolean +intersect_rectangles(VGint dwidth, VGint dheight, + VGint swidth, VGint sheight, + VGint tx, VGint ty, + VGint twidth, VGint theight, + VGint *offsets, + VGint *location) +{ + if (tx + twidth <= 0 || tx >= dwidth) + return VG_FALSE; + if (ty + theight <= 0 || ty >= dheight) + return VG_FALSE; + + offsets[0] = 0; + offsets[1] = 0; + location[0] = tx; + location[1] = ty; + + if (tx < 0) { + offsets[0] -= tx; + location[0] = 0; + + location[2] = MIN2(tx + swidth, MIN2(dwidth, tx + twidth)); + offsets[2] = location[2]; + } else { + offsets[2] = MIN2(twidth, MIN2(dwidth - tx, swidth )); + location[2] = offsets[2]; + } + + if (ty < 0) { + offsets[1] -= ty; + location[1] = 0; + + location[3] = MIN2(ty + sheight, MIN2(dheight, ty + theight)); + offsets[3] = location[3]; + } else { + offsets[3] = MIN2(theight, MIN2(dheight - ty, sheight)); + location[3] = offsets[3]; + } + + return VG_TRUE; +} + +#if DEBUG_MASKS +static void read_alpha_mask(void * data, VGint dataStride, + VGImageFormat dataFormat, + VGint sx, VGint sy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_context *pipe = ctx->pipe; + struct pipe_screen *screen = pipe->screen; + + struct st_framebuffer *stfb = ctx->draw_buffer; + struct st_renderbuffer *strb = stfb->alpha_mask; + struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + + VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4]; + VGfloat *df = (VGfloat*)temp; + VGint y = (fb->height - sy) - 1, yStep = -1; + VGint i; + VGubyte *dst = (VGubyte *)data; + VGint xoffset = 0, yoffset = 0; + + /* make sure rendering has completed */ + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + if (sx < 0) { + xoffset = -sx; + xoffset *= _vega_size_for_format(dataFormat); + width += sx; + sx = 0; + } + if (sy < 0) { + yoffset = -sy; + height += sy; + sy = 0; + y = (fb->height - sy) - 1; + yoffset *= dataStride; + } + + { + struct pipe_surface *surf; + + surf = screen->get_tex_surface(screen, strb->texture, 0, 0, 0, + PIPE_BUFFER_USAGE_CPU_READ); + + /* Do a row at a time to flip image data vertically */ + for (i = 0; i < height; i++) { +#if 0 + debug_printf("%d-%d == %d\n", sy, height, y); +#endif + pipe_get_tile_rgba(surf, sx, y, width, 1, df); + y += yStep; + _vega_pack_rgba_span_float(ctx, width, temp, dataFormat, + dst + yoffset + xoffset); + dst += dataStride; + } + + pipe_surface_reference(&surf, NULL); + } +} + +void save_alpha_to_file(const char *filename) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + VGint *data; + int i, j; + + data = malloc(sizeof(int) * fb->width * fb->height); + read_alpha_mask(data, fb->width * sizeof(int), + VG_sRGBA_8888, + 0, 0, fb->width, fb->height); + fprintf(stderr, "/*---------- start */\n"); + fprintf(stderr, "const int image_width = %d;\n", + fb->width); + fprintf(stderr, "const int image_height = %d;\n", + fb->height); + fprintf(stderr, "const int image_data = {\n"); + for (i = 0; i < fb->height; ++i) { + for (j = 0; j < fb->width; ++j) { + int rgba = data[i * fb->height + j]; + int argb = 0; + argb = (rgba >> 8); + argb |= ((rgba & 0xff) << 24); + fprintf(stderr, "0x%x, ", argb); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "};\n"); + fprintf(stderr, "/*---------- end */\n"); +} +#endif + +static void setup_mask_framebuffer(struct pipe_surface *surf, + VGint surf_width, VGint surf_height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_framebuffer_state fb; + + memset(&fb, 0, sizeof(fb)); + fb.width = surf_width; + fb.height = surf_height; + fb.nr_cbufs = 1; + fb.cbufs[0] = surf; + { + VGint i; + for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) + fb.cbufs[i] = 0; + } + cso_set_framebuffer(ctx->cso_context, &fb); +} + + +/* setup shader constants */ +static void setup_mask_operation(VGMaskOperation operation) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_constant_buffer *cbuf = &ctx->mask.cbuf; + const VGint param_bytes = 4 * sizeof(VGfloat); + const VGfloat ones[4] = {1.f, 1.f, 1.f, 1.f}; + void *shader = 0; + + /* We always need to get a new buffer, to keep the drivers simple and + * avoid gratuitous rendering synchronization. + */ + pipe_buffer_reference(&cbuf->buffer, NULL); + + cbuf->buffer = pipe_buffer_create(ctx->pipe->screen, 1, + PIPE_BUFFER_USAGE_CONSTANT, + param_bytes); + if (cbuf->buffer) { + st_no_flush_pipe_buffer_write(ctx, cbuf->buffer, + 0, param_bytes, ones); + } + + ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, cbuf); + switch (operation) { + case VG_UNION_MASK: { + if (!ctx->mask.union_fs) { + ctx->mask.union_fs = shader_create_from_text(ctx->pipe, + union_mask_asm, + 200, + PIPE_SHADER_FRAGMENT); + } + shader = ctx->mask.union_fs->driver; + } + break; + case VG_INTERSECT_MASK: { + if (!ctx->mask.intersect_fs) { + ctx->mask.intersect_fs = shader_create_from_text(ctx->pipe, + intersect_mask_asm, + 200, + PIPE_SHADER_FRAGMENT); + } + shader = ctx->mask.intersect_fs->driver; + } + break; + case VG_SUBTRACT_MASK: { + if (!ctx->mask.subtract_fs) { + ctx->mask.subtract_fs = shader_create_from_text(ctx->pipe, + subtract_mask_asm, + 200, + PIPE_SHADER_FRAGMENT); + } + shader = ctx->mask.subtract_fs->driver; + } + break; + case VG_SET_MASK: { + if (!ctx->mask.set_fs) { + ctx->mask.set_fs = shader_create_from_text(ctx->pipe, + set_mask_asm, + 200, + PIPE_SHADER_FRAGMENT); + } + shader = ctx->mask.set_fs->driver; + } + break; + default: + assert(0); + break; + } + cso_set_fragment_shader_handle(ctx->cso_context, shader); +} + +static void setup_mask_samplers(struct pipe_texture *umask) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; + struct pipe_texture *textures[PIPE_MAX_SAMPLERS]; + struct st_framebuffer *fb_buffers = ctx->draw_buffer; + struct pipe_texture *uprev = NULL; + struct pipe_sampler_state sampler; + + uprev = fb_buffers->blend_texture; + sampler = ctx->mask.sampler; + sampler.normalized_coords = 1; + + samplers[0] = NULL; + samplers[1] = NULL; + samplers[2] = NULL; + textures[0] = NULL; + textures[1] = NULL; + textures[2] = NULL; + + samplers[0] = &sampler; + samplers[1] = &ctx->mask.sampler; + + textures[0] = umask; + textures[1] = uprev; + + cso_set_samplers(ctx->cso_context, 2, + (const struct pipe_sampler_state **)samplers); + cso_set_sampler_textures(ctx->cso_context, 2, textures); +} + + +/* setup shader constants */ +static void setup_mask_fill(const VGfloat color[4]) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_constant_buffer *cbuf = &ctx->mask.cbuf; + const VGint param_bytes = 4 * sizeof(VGfloat); + + /* We always need to get a new buffer, to keep the drivers simple and + * avoid gratuitous rendering synchronization. + */ + pipe_buffer_reference(&cbuf->buffer, NULL); + + cbuf->buffer = pipe_buffer_create(ctx->pipe->screen, 1, + PIPE_BUFFER_USAGE_CONSTANT, + param_bytes); + if (cbuf->buffer) { + st_no_flush_pipe_buffer_write(ctx, cbuf->buffer, 0, param_bytes, color); + } + + ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, cbuf); + cso_set_fragment_shader_handle(ctx->cso_context, + shaders_cache_fill(ctx->sc, + VEGA_SOLID_FILL_SHADER)); +} + +static void setup_mask_viewport() +{ + struct vg_context *ctx = vg_current_context(); + vg_set_viewport(ctx, VEGA_Y0_TOP); +} + +static void setup_mask_blend() +{ + struct vg_context *ctx = vg_current_context(); + + struct pipe_blend_state blend; + + memset(&blend, 0, sizeof(struct pipe_blend_state)); + blend.blend_enable = 1; + blend.colormask |= PIPE_MASK_R; + blend.colormask |= PIPE_MASK_G; + blend.colormask |= PIPE_MASK_B; + blend.colormask |= PIPE_MASK_A; + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; + + cso_set_blend(ctx->cso_context, &blend); +} + + +static void surface_fill(struct pipe_surface *surf, + int surf_width, int surf_height, + int x, int y, int width, int height, + const VGfloat color[4]) +{ + struct vg_context *ctx = vg_current_context(); + + if (x < 0) { + width += x; + x = 0; + } + if (y < 0) { + height += y; + y = 0; + } + + cso_save_framebuffer(ctx->cso_context); + cso_save_blend(ctx->cso_context); + cso_save_fragment_shader(ctx->cso_context); + cso_save_viewport(ctx->cso_context); + + setup_mask_blend(); + setup_mask_fill(color); + setup_mask_framebuffer(surf, surf_width, surf_height); + setup_mask_viewport(); + + renderer_draw_quad(ctx->renderer, x, y, + x + width, y + height, 0.0f/*depth should be disabled*/); + + + /* make sure rendering has completed */ + ctx->pipe->flush(ctx->pipe, + PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, + NULL); + +#if DEBUG_MASKS + save_alpha_to_file(0); +#endif + + cso_restore_blend(ctx->cso_context); + cso_restore_framebuffer(ctx->cso_context); + cso_restore_fragment_shader(ctx->cso_context); + cso_restore_viewport(ctx->cso_context); +} + + +static void mask_using_texture(struct pipe_texture *texture, + VGMaskOperation operation, + VGint x, VGint y, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct pipe_surface *surface = + alpha_mask_surface(ctx, PIPE_BUFFER_USAGE_GPU_WRITE); + VGint offsets[4], loc[4]; + + if (!surface) + return; + if (!intersect_rectangles(surface->width, surface->height, + texture->width[0], texture->height[0], + x, y, width, height, + offsets, loc)) + return; +#if 0 + debug_printf("Offset = [%d, %d, %d, %d]\n", offsets[0], + offsets[1], offsets[2], offsets[3]); + debug_printf("Locati = [%d, %d, %d, %d]\n", loc[0], + loc[1], loc[2], loc[3]); +#endif + + /* prepare our blend surface */ + vg_prepare_blend_surface_from_mask(ctx); + + cso_save_samplers(ctx->cso_context); + cso_save_sampler_textures(ctx->cso_context); + cso_save_framebuffer(ctx->cso_context); + cso_save_blend(ctx->cso_context); + cso_save_fragment_shader(ctx->cso_context); + cso_save_viewport(ctx->cso_context); + + setup_mask_samplers(texture); + setup_mask_blend(); + setup_mask_operation(operation); + setup_mask_framebuffer(surface, surface->width, surface->height); + setup_mask_viewport(); + + /* render the quad to propagate the rendering from stencil */ + renderer_draw_texture(ctx->renderer, texture, + offsets[0], offsets[1], + offsets[0] + offsets[2], offsets[1] + offsets[3], + loc[0], loc[1], loc[0] + loc[2], loc[1] + loc[3]); + + /* make sure rendering has completed */ + ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + cso_restore_blend(ctx->cso_context); + cso_restore_framebuffer(ctx->cso_context); + cso_restore_fragment_shader(ctx->cso_context); + cso_restore_samplers(ctx->cso_context); + cso_restore_sampler_textures(ctx->cso_context); + cso_restore_viewport(ctx->cso_context); + + pipe_surface_reference(&surface, NULL); +} + + +#ifdef OPENVG_VERSION_1_1 + +struct vg_mask_layer * mask_layer_create(VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct vg_mask_layer *mask = 0; + + mask = CALLOC_STRUCT(vg_mask_layer); + vg_init_object(&mask->base, ctx, VG_OBJECT_MASK); + mask->width = width; + mask->height = height; + + { + struct pipe_texture pt; + struct pipe_screen *screen = ctx->pipe->screen; + + memset(&pt, 0, sizeof(pt)); + pt.target = PIPE_TEXTURE_2D; + pt.format = PIPE_FORMAT_A8R8G8B8_UNORM; + pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &pt.block); + pt.last_level = 0; + pt.width[0] = width; + pt.height[0] = height; + pt.depth[0] = 1; + pt.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + pt.compressed = 0; + + mask->texture = screen->texture_create(screen, &pt); + } + + vg_context_add_object(ctx, VG_OBJECT_MASK, mask); + + return mask; +} + +void mask_layer_destroy(struct vg_mask_layer *layer) +{ + struct vg_context *ctx = vg_current_context(); + + vg_context_remove_object(ctx, VG_OBJECT_MASK, layer); + pipe_texture_release(&layer->texture); + free(layer); +} + +void mask_layer_fill(struct vg_mask_layer *layer, + VGint x, VGint y, + VGint width, VGint height, + VGfloat value) +{ + struct vg_context *ctx = vg_current_context(); + VGfloat alpha_color[4] = {0, 0, 0, 0}; + struct pipe_surface *surface; + + alpha_color[3] = value; + + surface = ctx->pipe->screen->get_tex_surface( + ctx->pipe->screen, layer->texture, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + + surface_fill(surface, + layer->width, layer->height, + x, y, width, height, alpha_color); + + ctx->pipe->screen->tex_surface_release(ctx->pipe->screen, &surface); +} + +void mask_copy(struct vg_mask_layer *layer, + VGint sx, VGint sy, + VGint dx, VGint dy, + VGint width, VGint height) +{ + struct vg_context *ctx = vg_current_context(); + struct st_framebuffer *fb_buffers = ctx->draw_buffer; + + renderer_copy_texture(ctx->renderer, + layer->texture, + sx, sy, + sx + width, sy + height, + fb_buffers->alpha_mask, + dx, dy, + dx + width, dy + height); +} + +static void mask_layer_render_to(struct vg_mask_layer *layer, + struct path *path, + VGbitfield paint_modes) +{ + struct vg_context *ctx = vg_current_context(); + const VGfloat fill_color[4] = {1.f, 1.f, 1.f, 1.f}; + struct pipe_screen *screen = ctx->pipe->screen; + struct pipe_surface *surface; + + surface = screen->get_tex_surface(screen, layer->texture, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + + cso_save_framebuffer(ctx->cso_context); + cso_save_fragment_shader(ctx->cso_context); + cso_save_viewport(ctx->cso_context); + + setup_mask_blend(); + setup_mask_fill(fill_color); + setup_mask_framebuffer(surface, layer->width, layer->height); + setup_mask_viewport(); + + if (paint_modes & VG_FILL_PATH) { + struct matrix *mat = &ctx->state.vg.path_user_to_surface_matrix; + path_fill(path, mat); + } + + if (paint_modes & VG_STROKE_PATH){ + path_stroke(path); + } + + + /* make sure rendering has completed */ + ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + + cso_restore_framebuffer(ctx->cso_context); + cso_restore_fragment_shader(ctx->cso_context); + cso_restore_viewport(ctx->cso_context); + ctx->state.dirty |= BLEND_DIRTY; + + screen->tex_surface_release(ctx->pipe->screen, &surface); +} + +void mask_render_to(struct path *path, + VGbitfield paint_modes, + VGMaskOperation operation) +{ + struct vg_context *ctx = vg_current_context(); + struct st_framebuffer *fb_buffers = ctx->draw_buffer; + struct vg_mask_layer *temp_layer; + VGint width, height; + + width = fb_buffers->alpha_mask->width[0]; + height = fb_buffers->alpha_mask->width[0]; + + temp_layer = mask_layer_create(width, height); + + mask_layer_render_to(temp_layer, path, paint_modes); + + mask_using_layer(temp_layer, 0, 0, width, height, + operation); + + mask_layer_destroy(temp_layer); +} + +void mask_using_layer(struct vg_mask_layer *layer, + VGMaskOperation operation, + VGint x, VGint y, + VGint width, VGint height) +{ + mask_using_texture(layer->texture, operation, + x, y, width, height); +} + +VGint mask_layer_width(struct vg_mask_layer *layer) +{ + return layer->width; +} + +VGint mask_layer_height(struct vg_mask_layer *layer) +{ + return layer->height; +} + + +#endif + +void mask_using_image(struct vg_image *image, + VGMaskOperation operation, + VGint x, VGint y, + VGint width, VGint height) +{ + mask_using_texture(image->texture, operation, + x, y, width, height); +} + +void mask_fill(VGint x, VGint y, VGint width, VGint height, + VGfloat value) +{ + struct vg_context *ctx = vg_current_context(); + VGfloat alpha_color[4] = {.0f, .0f, .0f, value}; + struct pipe_surface *surf = alpha_mask_surface( + ctx, PIPE_BUFFER_USAGE_GPU_WRITE); + +#if DEBUG_MASKS + debug_printf("mask_fill(%d, %d, %d, %d) with rgba(%f, %f, %f, %f)\n", + x, y, width, height, + alpha_color[0], alpha_color[1], + alpha_color[2], alpha_color[3]); + debug_printf("XXX %f === %f \n", + alpha_color[3], value); +#endif + + surface_fill(surf, surf->width, surf->height, + x, y, width, height, alpha_color); + + pipe_surface_reference(&surf, NULL); +} + +VGint mask_bind_samplers(struct pipe_sampler_state **samplers, + struct pipe_texture **textures) +{ + struct vg_context *ctx = vg_current_context(); + + if (ctx->state.vg.masking) { + struct st_framebuffer *fb_buffers = ctx->draw_buffer; + + samplers[1] = &ctx->mask.sampler; + textures[1] = fb_buffers->alpha_mask; + return 1; + } else + return 0; +} diff --git a/src/gallium/state_trackers/vega/mask.h b/src/gallium/state_trackers/vega/mask.h new file mode 100644 index 00000000000..5eaaede0e3a --- /dev/null +++ b/src/gallium/state_trackers/vega/mask.h @@ -0,0 +1,68 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 MASK_H +#define MASK_H + +#include "vg_context.h" + +struct path; +struct vg_image; +struct pipe_texture; + +struct vg_mask_layer *mask_layer_create(VGint width, VGint height); +void mask_layer_destroy(struct vg_mask_layer *layer); +void mask_layer_fill(struct vg_mask_layer *layer, + VGint x, VGint y, + VGint width, VGint height, + VGfloat value); +VGint mask_layer_width(struct vg_mask_layer *layer); +VGint mask_layer_height(struct vg_mask_layer *layer); +void mask_copy(struct vg_mask_layer *layer, + VGint sx, VGint sy, + VGint dx, VGint dy, + VGint width, VGint height); + +void mask_render_to(struct path *path, + VGbitfield paint_modes, + VGMaskOperation operation); + +void mask_using_layer(struct vg_mask_layer *layer, + VGMaskOperation operation, + VGint x, VGint y, + VGint width, VGint height); +void mask_using_image(struct vg_image *image, + VGMaskOperation operation, + VGint x, VGint y, + VGint width, VGint height); +void mask_fill(VGint x, VGint y, + VGint width, VGint height, + VGfloat value); + +VGint mask_bind_samplers(struct pipe_sampler_state **samplers, + struct pipe_texture **textures); + +#endif diff --git a/src/gallium/state_trackers/vega/matrix.h b/src/gallium/state_trackers/vega/matrix.h new file mode 100644 index 00000000000..4c207f912a8 --- /dev/null +++ b/src/gallium/state_trackers/vega/matrix.h @@ -0,0 +1,462 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 MATRIX_H +#define MATRIX_H + +#include "VG/openvg.h" + +#include "pipe/p_compiler.h" +#include "util/u_math.h" + +#include <stdio.h> +#include <math.h> + +#define floatsEqual(x, y) (fabs(x - y) <= 0.00001f * MIN2(fabs(x), fabs(y))) +#define floatIsZero(x) (floatsEqual((x) + 1, 1)) +#define ABS(x) (fabsf(x)) + +#define DEGREES_TO_RADIANS(d) (0.0174532925199 * (d)) +#define FLT_TO_INT(flt) float_to_int_floor(((VGuint*)&(flt))[0]) + +static INLINE VGint float_to_int_floor(VGuint bits) +{ + int sign = (bits >> 31) ? -1 : 1; + int exp = ((bits >> 23) & 255) - 127; + int mant = bits & 0x007fffff; + int sh = 23 - exp; + + /* abs(value) >= 2^31 -> clamp. */ + + if (exp >= 31) + return (VGint)((sign < 0) ? 0x80000000u : 0x7fffffffu); + + /* abs(value) < 1 -> return -1 or 0. */ + + if (exp < 0) + return (sign < 0 && (exp > -127 || mant != 0)) ? -1 : 0; + + /* abs(value) >= 2^23 -> shift left. */ + + mant |= 0x00800000; + if (sh <= 0) + return sign * (mant << -sh); + + /* Negative -> add a rounding term. */ + + if (sign < 0) + mant += (1 << sh) - 1; + + /* Shift right to obtain the result. */ + + return sign * (mant >> sh); +} + + +struct matrix { + VGfloat m[9]; +}; + +static INLINE void matrix_init(struct matrix *mat, + const VGfloat *val) +{ + memcpy(mat->m, val, sizeof(VGfloat) * 9); +} + +static INLINE void matrix_inits(struct matrix *mat, + VGfloat m11, VGfloat m12, VGfloat m13, + VGfloat m21, VGfloat m22, VGfloat m23, + VGfloat m31, VGfloat m32, VGfloat m33) +{ + mat->m[0] = m11; mat->m[1] = m12; mat->m[2] = m13; + mat->m[3] = m21; mat->m[4] = m22; mat->m[5] = m23; + mat->m[6] = m31; mat->m[7] = m32; mat->m[8] = m33; +} + +static INLINE void matrix_load_identity(struct matrix *matrix) +{ + static const VGfloat identity[9] = {1.f, 0.f, 0.f, + 0.f, 1.f, 0.f, + 0.f, 0.f, 1.f}; + memcpy(matrix->m, identity, sizeof(identity)); +} + +static INLINE VGboolean matrix_is_identity(struct matrix *matrix) +{ + return floatsEqual(matrix->m[0], 1) && floatIsZero(matrix->m[1]) && + floatIsZero(matrix->m[2]) && + floatIsZero(matrix->m[3]) && floatsEqual(matrix->m[4], 1) && + floatIsZero(matrix->m[5]) && + floatIsZero(matrix->m[6]) && floatIsZero(matrix->m[7]) && + floatIsZero(matrix->m[8]); +} + +static INLINE VGboolean matrix_is_affine(struct matrix *matrix) +{ + return floatIsZero(matrix->m[2]) && floatIsZero(matrix->m[5]) + && floatsEqual(matrix->m[8], 1); +} + + +static INLINE void matrix_make_affine(struct matrix *matrix) +{ + matrix->m[2] = 0.f; + matrix->m[5] = 0.f; + matrix->m[8] = 1.f; +} + +static INLINE void matrix_mult(struct matrix *dst, + struct matrix *src) +{ + VGfloat m11 = dst->m[0]*src->m[0] + dst->m[3]*src->m[1] + dst->m[6]*src->m[2]; + VGfloat m12 = dst->m[0]*src->m[3] + dst->m[3]*src->m[4] + dst->m[6]*src->m[5]; + VGfloat m13 = dst->m[0]*src->m[6] + dst->m[3]*src->m[7] + dst->m[6]*src->m[8]; + + VGfloat m21 = dst->m[1]*src->m[0] + dst->m[4]*src->m[1] + dst->m[7]*src->m[2]; + VGfloat m22 = dst->m[1]*src->m[3] + dst->m[4]*src->m[4] + dst->m[7]*src->m[5]; + VGfloat m23 = dst->m[1]*src->m[6] + dst->m[4]*src->m[7] + dst->m[7]*src->m[8]; + + VGfloat m31 = dst->m[2]*src->m[0] + dst->m[5]*src->m[1] + dst->m[8]*src->m[2]; + VGfloat m32 = dst->m[2]*src->m[3] + dst->m[5]*src->m[4] + dst->m[8]*src->m[5]; + VGfloat m33 = dst->m[2]*src->m[6] + dst->m[5]*src->m[7] + dst->m[8]*src->m[8]; + + dst->m[0] = m11; dst->m[1] = m21; dst->m[2] = m31; + dst->m[3] = m12; dst->m[4] = m22; dst->m[5] = m32; + dst->m[6] = m13; dst->m[7] = m23; dst->m[8] = m33; +} + + +static INLINE void matrix_map_point(struct matrix *mat, + VGfloat x, VGfloat y, + VGfloat *out_x, VGfloat *out_y) +{ + /* to be able to do matrix_map_point(m, x, y, &x, &y) use + * temporaries */ + VGfloat tmp_x = x, tmp_y = y; + + *out_x = mat->m[0]*tmp_x + mat->m[3]*tmp_y + mat->m[6]; + *out_y = mat->m[1]*tmp_x + mat->m[4]*tmp_y + mat->m[7]; + if (!matrix_is_affine(mat)) { + VGfloat w = 1/(mat->m[2]*tmp_x + mat->m[5]*tmp_y + mat->m[8]); + *out_x *= w; + *out_y *= w; + } +} + +static INLINE void matrix_translate(struct matrix *dst, + VGfloat tx, VGfloat ty) +{ + if (!matrix_is_affine(dst)) { + struct matrix trans_matrix; + matrix_load_identity(&trans_matrix); + trans_matrix.m[6] = tx; + trans_matrix.m[7] = ty; + matrix_mult(dst, &trans_matrix); + } else { + dst->m[6] += tx*dst->m[0] + ty*dst->m[3]; + dst->m[7] += ty*dst->m[4] + tx*dst->m[1]; + } +} + +static INLINE void matrix_scale(struct matrix *dst, + VGfloat sx, VGfloat sy) +{ + if (!matrix_is_affine(dst)) { + struct matrix scale_matrix; + matrix_load_identity(&scale_matrix); + scale_matrix.m[0] = sx; + scale_matrix.m[4] = sy; + matrix_mult(dst, &scale_matrix); + } else { + dst->m[0] *= sx; dst->m[1] *= sx; + dst->m[3] *= sy; dst->m[4] *= sy; + } +} + +static INLINE void matrix_shear(struct matrix *dst, + VGfloat shx, VGfloat shy) +{ + struct matrix shear_matrix; + matrix_load_identity(&shear_matrix); + shear_matrix.m[1] = shy; + shear_matrix.m[3] = shx; + matrix_mult(dst, &shear_matrix); +} + +static INLINE void matrix_rotate(struct matrix *dst, + VGfloat angle) +{ + struct matrix mat; + float sin_val = 0; + float cos_val = 0; + + + if (floatsEqual(angle, 90) || floatsEqual(angle, -270)) + sin_val = 1.f; + else if (floatsEqual(angle, 270) || floatsEqual(angle, -90)) + sin_val = -1.f; + else if (floatsEqual(angle, 180)) + cos_val = -1.f; + else { + float radians = DEGREES_TO_RADIANS(angle); + sin_val = sin(radians); + cos_val = cos(radians); + } + + if (!matrix_is_affine(dst)) { + matrix_load_identity(&mat); + mat.m[0] = cos_val; mat.m[1] = sin_val; + mat.m[3] = -sin_val; mat.m[4] = cos_val; + + matrix_mult(dst, &mat); + } else { + VGfloat m11 = cos_val*dst->m[0] + sin_val*dst->m[3]; + VGfloat m12 = cos_val*dst->m[1] + sin_val*dst->m[4]; + VGfloat m21 = -sin_val*dst->m[0] + cos_val*dst->m[3]; + VGfloat m22 = -sin_val*dst->m[1] + cos_val*dst->m[4]; + dst->m[0] = m11; dst->m[1] = m12; + dst->m[3] = m21; dst->m[4] = m22; + } +} + + +static INLINE VGfloat matrix_determinant(struct matrix *mat) +{ + return mat->m[0]*(mat->m[8]*mat->m[4]-mat->m[7]*mat->m[5]) - + mat->m[3]*(mat->m[8]*mat->m[1]-mat->m[7]*mat->m[2])+ + mat->m[6]*(mat->m[5]*mat->m[1]-mat->m[4]*mat->m[2]); +} + + +static INLINE void matrix_adjoint(struct matrix *mat) +{ + VGfloat h[9]; + h[0] = mat->m[4]*mat->m[8] - mat->m[5]*mat->m[7]; + h[3] = mat->m[5]*mat->m[6] - mat->m[3]*mat->m[8]; + h[6] = mat->m[3]*mat->m[7] - mat->m[4]*mat->m[6]; + h[1] = mat->m[2]*mat->m[7] - mat->m[1]*mat->m[8]; + h[4] = mat->m[0]*mat->m[8] - mat->m[2]*mat->m[6]; + h[7] = mat->m[1]*mat->m[6] - mat->m[0]*mat->m[7]; + h[2] = mat->m[1]*mat->m[5] - mat->m[2]*mat->m[4]; + h[5] = mat->m[2]*mat->m[3] - mat->m[0]*mat->m[5]; + h[8] = mat->m[0]*mat->m[4] - mat->m[1]*mat->m[3]; + + + memcpy(mat->m, h, sizeof(VGfloat) * 9); +} + +static INLINE void matrix_divs(struct matrix *mat, + VGfloat s) +{ + mat->m[0] /= s; + mat->m[1] /= s; + mat->m[2] /= s; + mat->m[3] /= s; + mat->m[4] /= s; + mat->m[5] /= s; + mat->m[6] /= s; + mat->m[7] /= s; + mat->m[8] /= s; +} + +static INLINE VGboolean matrix_invert(struct matrix *mat) +{ + VGfloat det = matrix_determinant(mat); + + if (floatIsZero(det)) + return VG_FALSE; + + matrix_adjoint(mat); + matrix_divs(mat, det); + return VG_TRUE; +} + +static INLINE VGboolean matrix_is_invertible(struct matrix *mat) +{ + return !floatIsZero(matrix_determinant(mat)); +} + + +static INLINE VGboolean matrix_square_to_quad(VGfloat dx0, VGfloat dy0, + VGfloat dx1, VGfloat dy1, + VGfloat dx3, VGfloat dy3, + VGfloat dx2, VGfloat dy2, + struct matrix *mat) +{ + VGfloat ax = dx0 - dx1 + dx2 - dx3; + VGfloat ay = dy0 - dy1 + dy2 - dy3; + + if (floatIsZero(ax) && floatIsZero(ay)) { + /* affine case */ + matrix_inits(mat, + dx1 - dx0, dy1 - dy0, 0, + dx2 - dx1, dy2 - dy1, 0, + dx0, dy0, 1); + } else { + VGfloat a, b, c, d, e, f, g, h; + VGfloat ax1 = dx1 - dx2; + VGfloat ax2 = dx3 - dx2; + VGfloat ay1 = dy1 - dy2; + VGfloat ay2 = dy3 - dy2; + + /* determinants */ + VGfloat gtop = ax * ay2 - ax2 * ay; + VGfloat htop = ax1 * ay - ax * ay1; + VGfloat bottom = ax1 * ay2 - ax2 * ay1; + + if (!bottom) + return VG_FALSE; + + g = gtop / bottom; + h = htop / bottom; + + a = dx1 - dx0 + g * dx1; + b = dx3 - dx0 + h * dx3; + c = dx0; + d = dy1 - dy0 + g * dy1; + e = dy3 - dy0 + h * dy3; + f = dy0; + + matrix_inits(mat, + a, d, g, + b, e, h, + c, f, 1.f); + } + + return VG_TRUE; +} + +static INLINE VGboolean matrix_quad_to_square(VGfloat sx0, VGfloat sy0, + VGfloat sx1, VGfloat sy1, + VGfloat sx2, VGfloat sy2, + VGfloat sx3, VGfloat sy3, + struct matrix *mat) +{ + if (!matrix_square_to_quad(sx0, sy0, sx1, sy1, + sx2, sy2, sx3, sy3, + mat)) + return VG_FALSE; + + return matrix_invert(mat); +} + + +static INLINE VGboolean matrix_quad_to_quad(VGfloat dx0, VGfloat dy0, + VGfloat dx1, VGfloat dy1, + VGfloat dx2, VGfloat dy2, + VGfloat dx3, VGfloat dy3, + VGfloat sx0, VGfloat sy0, + VGfloat sx1, VGfloat sy1, + VGfloat sx2, VGfloat sy2, + VGfloat sx3, VGfloat sy3, + struct matrix *mat) +{ + struct matrix sqr_to_qd; + + if (!matrix_square_to_quad(dx0, dy0, dx1, dy1, + dx2, dy2, dx3, dy3, + mat)) + return VG_FALSE; + + if (!matrix_quad_to_square(sx0, sy0, sx1, sy1, + sx2, sy2, sx3, sy3, + &sqr_to_qd)) + return VG_FALSE; + + matrix_mult(mat, &sqr_to_qd); + + return VG_TRUE; +} + + +static INLINE VGboolean null_line(const VGfloat *l) +{ + return floatsEqual(l[0], l[2]) && floatsEqual(l[1], l[3]); +} + +static INLINE void line_normal(float *l, float *norm) +{ + norm[0] = l[0]; + norm[1] = l[1]; + + norm[2] = l[0] + (l[3] - l[1]); + norm[3] = l[1] - (l[2] - l[0]); +} + +static INLINE void line_normalize(float *l) +{ + float x = l[2] - l[0]; + float y = l[3] - l[1]; + float len = sqrt(x*x + y*y); + l[2] = l[0] + x/len; + l[3] = l[1] + y/len; +} + +static INLINE VGfloat line_length(VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2) +{ + VGfloat x = x2 - x1; + VGfloat y = y2 - y1; + return sqrt(x*x + y*y); +} + +static INLINE VGfloat line_lengthv(const VGfloat *l) +{ + VGfloat x = l[2] - l[0]; + VGfloat y = l[3] - l[1]; + return sqrt(x*x + y*y); +} + + +static INLINE void line_point_at(float *l, float t, float *pt) +{ + float dx = l[2] - l[0]; + float dy = l[3] - l[1]; + + pt[0] = l[0] + dx * t; + pt[1] = l[1] + dy * t; +} + +static INLINE void vector_unit(float *vec) +{ + float len = sqrt(vec[0] * vec[0] + vec[1] * vec[1]); + vec[0] /= len; + vec[1] /= len; +} + +static INLINE void line_normal_vector(float *line, float *vec) +{ + VGfloat normal[4]; + + line_normal(line, normal); + + vec[0] = normal[2] - normal[0]; + vec[1] = normal[3] - normal[1]; + + vector_unit(vec); +} + +#endif diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c new file mode 100644 index 00000000000..04a6ba9cdcd --- /dev/null +++ b/src/gallium/state_trackers/vega/paint.c @@ -0,0 +1,699 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "paint.h" + +#include "shaders_cache.h" +#include "matrix.h" +#include "image.h" +#include "st_inlines.h" + +#include "pipe/p_compiler.h" +#include "pipe/p_inlines.h" + +#include "util/u_memory.h" +#include "util/u_math.h" + +#include "cso_cache/cso_context.h" + +struct vg_paint { + struct vg_object base; + + VGPaintType type; + + struct { + VGfloat color[4]; + VGint colori[4]; + } solid; + + struct { + VGColorRampSpreadMode spread; + VGuint color_data[1024]; + struct { + VGfloat coords[4]; + VGint coordsi[4]; + } linear; + struct { + VGfloat vals[5]; + VGint valsi[5]; + } radial; + struct pipe_texture *texture; + struct pipe_sampler_state sampler; + + VGfloat *ramp_stops; + VGint *ramp_stopsi; + VGint num_stops; + + VGboolean color_ramps_premultiplied; + } gradient; + + struct { + struct pipe_texture *texture; + VGTilingMode tiling_mode; + struct pipe_sampler_state sampler; + } pattern; + + struct pipe_constant_buffer cbuf; + struct pipe_shader_state fs_state; + void *fs; +}; + +static INLINE VGuint mix_pixels(VGuint p1, VGuint a, VGuint p2, VGuint b) +{ + VGuint t = (p1 & 0xff00ff) * a + (p2 & 0xff00ff) * b; + t >>= 8; t &= 0xff00ff; + + p1 = ((p1 >> 8) & 0xff00ff) * a + ((p2 >> 8) & 0xff00ff) * b; + p1 &= 0xff00ff00; p1 |= t; + + return p1; +} + +static INLINE VGuint float4_to_argb(const VGfloat *clr) +{ + return float_to_ubyte(clr[3]) << 24 | + float_to_ubyte(clr[0]) << 16 | + float_to_ubyte(clr[1]) << 8 | + float_to_ubyte(clr[2]) << 0; +} + +static INLINE void create_gradient_data(const VGfloat *ramp_stops, + VGint num, + VGuint *data, + VGint size) +{ + VGint i; + VGint pos = 0; + VGfloat fpos = 0, incr = 1.f / size; + VGuint last_color; + + while (fpos < ramp_stops[0]) { + data[pos] = float4_to_argb(ramp_stops + 1); + fpos += incr; + ++pos; + } + + for (i = 0; i < num - 1; ++i) { + VGint rcur = 5 * i; + VGint rnext = 5 * (i + 1); + VGfloat delta = 1.f/(ramp_stops[rnext] - ramp_stops[rcur]); + while (fpos < ramp_stops[rnext] && pos < size) { + VGint dist = 256 * ((fpos - ramp_stops[rcur]) * delta); + VGint idist = 256 - dist; + VGuint current_color = float4_to_argb(ramp_stops + rcur + 1); + VGuint next_color = float4_to_argb(ramp_stops + rnext + 1); + data[pos] = mix_pixels(current_color, idist, + next_color, dist); + fpos += incr; + ++pos; + } + } + + last_color = float4_to_argb(ramp_stops + ((num - 1) * 5 + 1)); + while (pos < size) { + data[pos] = last_color; + ++pos; + } + data[size-1] = last_color; +} + +static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p) +{ + struct pipe_context *pipe = p->base.ctx->pipe; + struct pipe_screen *screen = pipe->screen; + struct pipe_texture *tex = 0; + struct pipe_texture templ; + + memset(&templ, 0, sizeof(templ)); + templ.target = PIPE_TEXTURE_1D; + templ.format = PIPE_FORMAT_A8R8G8B8_UNORM; + templ.last_level = 0; + templ.width[0] = 1024; + templ.height[0] = 1; + templ.depth[0] = 1; + pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block); + templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + + tex = screen->texture_create(screen, &templ); + + { /* upload color_data */ + struct pipe_transfer *transfer = + st_no_flush_get_tex_transfer(p->base.ctx, tex, 0, 0, 0, + PIPE_TRANSFER_WRITE, 0, 0, 1024, 1); + void *map = screen->transfer_map(screen, transfer); + memcpy(map, p->gradient.color_data, sizeof(VGint)*1024); + screen->transfer_unmap(screen, transfer); + screen->tex_transfer_destroy(transfer); + } + + return tex; +} + +struct vg_paint * paint_create(struct vg_context *ctx) +{ + struct vg_paint *paint = CALLOC_STRUCT(vg_paint); + const VGfloat default_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; + const VGfloat def_ling[] = {0.0f, 0.0f, 1.0f, 0.0f}; + const VGfloat def_radg[] = {0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; + vg_init_object(&paint->base, ctx, VG_OBJECT_PAINT); + vg_context_add_object(ctx, VG_OBJECT_PAINT, paint); + + paint->type = VG_PAINT_TYPE_COLOR; + memcpy(paint->solid.color, default_color, + 4 * sizeof(VGfloat)); + paint->gradient.spread = VG_COLOR_RAMP_SPREAD_PAD; + memcpy(paint->gradient.linear.coords, def_ling, + 4 * sizeof(VGfloat)); + memcpy(paint->gradient.radial.vals, def_radg, + 5 * sizeof(VGfloat)); + + paint->gradient.sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + paint->gradient.sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + paint->gradient.sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST; + paint->gradient.sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST; + paint->gradient.sampler.normalized_coords = 1; + + memcpy(&paint->pattern.sampler, + &paint->gradient.sampler, + sizeof(struct pipe_sampler_state)); + + return paint; +} + +void paint_destroy(struct vg_paint *paint) +{ + struct vg_context *ctx = paint->base.ctx; + if (paint->pattern.texture) + pipe_texture_reference(&paint->pattern.texture, NULL); + if (ctx) + vg_context_remove_object(ctx, VG_OBJECT_PAINT, paint); + + free(paint->gradient.ramp_stopsi); + free(paint->gradient.ramp_stops); + free(paint); +} + +void paint_set_color(struct vg_paint *paint, + const VGfloat *color) +{ + paint->solid.color[0] = color[0]; + paint->solid.color[1] = color[1]; + paint->solid.color[2] = color[2]; + paint->solid.color[3] = color[3]; + + paint->solid.colori[0] = FLT_TO_INT(color[0]); + paint->solid.colori[1] = FLT_TO_INT(color[1]); + paint->solid.colori[2] = FLT_TO_INT(color[2]); + paint->solid.colori[3] = FLT_TO_INT(color[3]); +} + +static INLINE void paint_color_buffer(struct vg_paint *paint, void *buffer) +{ + VGfloat *map = (VGfloat*)buffer; + memcpy(buffer, paint->solid.color, 4 * sizeof(VGfloat)); + map[4] = 0.f; + map[5] = 1.f; + map[6] = 2.f; + map[7] = 4.f; +} + +static INLINE void paint_linear_gradient_buffer(struct vg_paint *paint, void *buffer) +{ + struct vg_context *ctx = paint->base.ctx; + VGfloat *map = (VGfloat*)buffer; + + map[0] = paint->gradient.linear.coords[2] - paint->gradient.linear.coords[0]; + map[1] = paint->gradient.linear.coords[3] - paint->gradient.linear.coords[1]; + map[2] = 1.f / (map[0] * map[0] + map[1] * map[1]); + map[3] = 1.f; + + map[4] = 0.f; + map[5] = 1.f; + map[6] = 2.f; + map[7] = 4.f; + { + struct matrix mat; + struct matrix inv; + matrix_load_identity(&mat); + matrix_translate(&mat, -paint->gradient.linear.coords[0], -paint->gradient.linear.coords[1]); + memcpy(&inv, &ctx->state.vg.fill_paint_to_user_matrix, + sizeof(struct matrix)); + matrix_invert(&inv); + matrix_mult(&inv, &mat); + memcpy(&mat, &inv, + sizeof(struct matrix)); + + map[8] = mat.m[0]; map[9] = mat.m[3]; map[10] = mat.m[6]; map[11] = 0.f; + map[12] = mat.m[1]; map[13] = mat.m[4]; map[14] = mat.m[7]; map[15] = 0.f; + map[16] = mat.m[2]; map[17] = mat.m[5]; map[18] = mat.m[8]; map[19] = 0.f; + } +#if 0 + debug_printf("Coords (%f, %f, %f, %f)\n", + map[0], map[1], map[2], map[3]); +#endif +} + + +static INLINE void paint_radial_gradient_buffer(struct vg_paint *paint, void *buffer) +{ + VGfloat *radialCoords = paint->gradient.radial.vals; + struct vg_context *ctx = paint->base.ctx; + + VGfloat *map = (VGfloat*)buffer; + + map[0] = radialCoords[0] - radialCoords[2]; + map[1] = radialCoords[1] - radialCoords[3]; + map[2] = -map[0] * map[0] - map[1] * map[1] + + radialCoords[4] * radialCoords[4]; + map[3] = 1.f; + + map[4] = 0.f; + map[5] = 1.f; + map[6] = 2.f; + map[7] = 4.f; + + { + struct matrix mat; + struct matrix inv; + matrix_load_identity(&mat); + matrix_translate(&mat, -radialCoords[2], -radialCoords[3]); + memcpy(&inv, &ctx->state.vg.fill_paint_to_user_matrix, + sizeof(struct matrix)); + matrix_invert(&inv); + matrix_mult(&inv, &mat); + memcpy(&mat, &inv, + sizeof(struct matrix)); + + map[8] = mat.m[0]; map[9] = mat.m[3]; map[10] = mat.m[6]; map[11] = 0.f; + map[12] = mat.m[1]; map[13] = mat.m[4]; map[14] = mat.m[7]; map[15] = 0.f; + map[16] = mat.m[2]; map[17] = mat.m[5]; map[18] = mat.m[8]; map[19] = 0.f; + } + +#if 0 + debug_printf("Coords (%f, %f, %f, %f)\n", + map[0], map[1], map[2], map[3]); +#endif +} + + +static INLINE void paint_pattern_buffer(struct vg_paint *paint, void *buffer) +{ + struct vg_context *ctx = paint->base.ctx; + + VGfloat *map = (VGfloat *)buffer; + memcpy(map, paint->solid.color, 4 * sizeof(VGfloat)); + + map[4] = 0.f; + map[5] = 1.f; + map[6] = paint->pattern.texture->width[0]; + map[7] = paint->pattern.texture->height[0]; + { + struct matrix mat; + memcpy(&mat, &ctx->state.vg.fill_paint_to_user_matrix, + sizeof(struct matrix)); + matrix_invert(&mat); + { + struct matrix pm; + memcpy(&pm, &ctx->state.vg.path_user_to_surface_matrix, + sizeof(struct matrix)); + matrix_invert(&pm); + matrix_mult(&pm, &mat); + memcpy(&mat, &pm, sizeof(struct matrix)); + } + + map[8] = mat.m[0]; map[9] = mat.m[3]; map[10] = mat.m[6]; map[11] = 0.f; + map[12] = mat.m[1]; map[13] = mat.m[4]; map[14] = mat.m[7]; map[15] = 0.f; + map[16] = mat.m[2]; map[17] = mat.m[5]; map[18] = mat.m[8]; map[19] = 0.f; + } +} + +void paint_set_type(struct vg_paint *paint, VGPaintType type) +{ + paint->type = type; +} + +void paint_set_ramp_stops(struct vg_paint *paint, const VGfloat *stops, + int num) +{ + const VGfloat default_stops[] = {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, + 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}; + VGint i; + const VGint num_stops = num / 5; + VGfloat last_coord; + + paint->gradient.num_stops = num; + if (num) { + free(paint->gradient.ramp_stops); + paint->gradient.ramp_stops = malloc(sizeof(VGfloat)*num); + memcpy(paint->gradient.ramp_stops, stops, sizeof(VGfloat)*num); + } else + return; + + /* stops must be in increasing order. the last stop is 1.0. if the + * first one is bigger than 1 then the whole sequence is invalid*/ + if (stops[0] > 1) { + stops = default_stops; + num = 10; + } + last_coord = stops[0]; + for (i = 1; i < num_stops; ++i) { + VGint idx = 5 * i; + VGfloat coord = stops[idx]; + if (!floatsEqual(last_coord, coord) && coord < last_coord) { + stops = default_stops; + num = 10; + break; + } + last_coord = coord; + } + + create_gradient_data(stops, num / 5, paint->gradient.color_data, + 1024); + + if (paint->gradient.texture) { + pipe_texture_reference(&paint->gradient.texture, NULL); + paint->gradient.texture = 0; + } + + paint->gradient.texture = create_gradient_texture(paint); +} + +void paint_set_colori(struct vg_paint *p, + VGuint rgba) +{ + p->solid.color[0] = ((rgba >> 24) & 0xff) / 255.f; + p->solid.color[1] = ((rgba >> 16) & 0xff) / 255.f; + p->solid.color[2] = ((rgba >> 8) & 0xff) / 255.f; + p->solid.color[3] = ((rgba >> 0) & 0xff) / 255.f; +} + +VGuint paint_colori(struct vg_paint *p) +{ +#define F2B(f) (float_to_ubyte(f)) + + return ((F2B(p->solid.color[0]) << 24) | + (F2B(p->solid.color[1]) << 16) | + (F2B(p->solid.color[2]) << 8) | + (F2B(p->solid.color[3]) << 0)); +#undef F2B +} + +void paint_set_linear_gradient(struct vg_paint *paint, + const VGfloat *coords) +{ + memcpy(paint->gradient.linear.coords, coords, sizeof(VGfloat) * 4); +} + +void paint_set_spread_mode(struct vg_paint *paint, + VGint mode) +{ + paint->gradient.spread = mode; + switch(mode) { + case VG_COLOR_RAMP_SPREAD_PAD: + paint->gradient.sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + break; + case VG_COLOR_RAMP_SPREAD_REPEAT: + paint->gradient.sampler.wrap_s = PIPE_TEX_WRAP_REPEAT; + break; + case VG_COLOR_RAMP_SPREAD_REFLECT: + paint->gradient.sampler.wrap_s = PIPE_TEX_WRAP_MIRROR_REPEAT; + break; + } +} + +VGColorRampSpreadMode paint_spread_mode(struct vg_paint *paint) +{ + return paint->gradient.spread; +} + +void paint_set_radial_gradient(struct vg_paint *paint, + const VGfloat *values) +{ + memcpy(paint->gradient.radial.vals, values, sizeof(VGfloat) * 5); +} + +void paint_set_pattern(struct vg_paint *paint, + struct vg_image *img) +{ + if (paint->pattern.texture) + pipe_texture_reference(&paint->pattern.texture, NULL); + + paint->pattern.texture = 0; + pipe_texture_reference(&paint->pattern.texture, + img->texture); +} + +void paint_set_pattern_tiling(struct vg_paint *paint, + VGTilingMode mode) +{ + paint->pattern.tiling_mode = mode; + + switch(mode) { + case VG_TILE_FILL: + paint->pattern.sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_BORDER; + paint->pattern.sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_BORDER; + break; + case VG_TILE_PAD: + paint->pattern.sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + paint->pattern.sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + break; + case VG_TILE_REPEAT: + paint->pattern.sampler.wrap_s = PIPE_TEX_WRAP_REPEAT; + paint->pattern.sampler.wrap_t = PIPE_TEX_WRAP_REPEAT; + break; + case VG_TILE_REFLECT: + paint->pattern.sampler.wrap_s = PIPE_TEX_WRAP_MIRROR_REPEAT; + paint->pattern.sampler.wrap_t = PIPE_TEX_WRAP_MIRROR_REPEAT; + break; + default: + debug_assert("!Unknown tiling mode"); + } +} + +void paint_get_color(struct vg_paint *paint, + VGfloat *color) +{ + color[0] = paint->solid.color[0]; + color[1] = paint->solid.color[1]; + color[2] = paint->solid.color[2]; + color[3] = paint->solid.color[3]; +} + +void paint_ramp_stops(struct vg_paint *paint, VGfloat *stops, + int num) +{ + memcpy(stops, paint->gradient.ramp_stops, sizeof(VGfloat)*num); +} + +void paint_linear_gradient(struct vg_paint *paint, + VGfloat *coords) +{ + memcpy(coords, paint->gradient.linear.coords, sizeof(VGfloat)*4); +} + +void paint_radial_gradient(struct vg_paint *paint, + VGfloat *coords) +{ + memcpy(coords, paint->gradient.radial.vals, sizeof(VGfloat)*5); +} + +int paint_num_ramp_stops(struct vg_paint *paint) +{ + return paint->gradient.num_stops; +} + +VGPaintType paint_type(struct vg_paint *paint) +{ + return paint->type; +} + +void paint_set_coloriv(struct vg_paint *paint, + const VGint *color) +{ + paint->solid.color[0] = color[0]; + paint->solid.color[1] = color[1]; + paint->solid.color[2] = color[2]; + paint->solid.color[3] = color[3]; + + paint->solid.colori[0] = color[0]; + paint->solid.colori[1] = color[1]; + paint->solid.colori[2] = color[2]; + paint->solid.colori[3] = color[3]; +} + +void paint_get_coloriv(struct vg_paint *paint, + VGint *color) +{ + color[0] = paint->solid.colori[0]; + color[1] = paint->solid.colori[1]; + color[2] = paint->solid.colori[2]; + color[3] = paint->solid.colori[3]; +} + +void paint_set_color_ramp_premultiplied(struct vg_paint *paint, + VGboolean set) +{ + paint->gradient.color_ramps_premultiplied = set; +} + +VGboolean paint_color_ramp_premultiplied(struct vg_paint *paint) +{ + return paint->gradient.color_ramps_premultiplied; +} + +void paint_set_ramp_stopsi(struct vg_paint *paint, const VGint *stops, + int num) +{ + if (num) { + free(paint->gradient.ramp_stopsi); + paint->gradient.ramp_stopsi = malloc(sizeof(VGint)*num); + memcpy(paint->gradient.ramp_stopsi, stops, sizeof(VGint)*num); + } +} + +void paint_ramp_stopsi(struct vg_paint *paint, VGint *stops, + int num) +{ + memcpy(stops, paint->gradient.ramp_stopsi, sizeof(VGint)*num); +} + +void paint_set_linear_gradienti(struct vg_paint *paint, + const VGint *coords) +{ + memcpy(paint->gradient.linear.coordsi, coords, sizeof(VGint) * 4); +} + +void paint_linear_gradienti(struct vg_paint *paint, + VGint *coords) +{ + memcpy(coords, paint->gradient.linear.coordsi, sizeof(VGint)*4); +} + +void paint_set_radial_gradienti(struct vg_paint *paint, + const VGint *values) +{ + memcpy(paint->gradient.radial.valsi, values, sizeof(VGint) * 5); +} + +void paint_radial_gradienti(struct vg_paint *paint, + VGint *coords) +{ + memcpy(coords, paint->gradient.radial.valsi, sizeof(VGint)*5); +} + +VGTilingMode paint_pattern_tiling(struct vg_paint *paint) +{ + return paint->pattern.tiling_mode; +} + +VGint paint_bind_samplers(struct vg_paint *paint, struct pipe_sampler_state **samplers, + struct pipe_texture **textures) +{ + struct vg_context *ctx = vg_current_context(); + + switch(paint->type) { + case VG_PAINT_TYPE_LINEAR_GRADIENT: + case VG_PAINT_TYPE_RADIAL_GRADIENT: { + if (paint->gradient.texture) { + paint->gradient.sampler.min_img_filter = image_sampler_filter(ctx); + paint->gradient.sampler.mag_img_filter = image_sampler_filter(ctx); + samplers[0] = &paint->gradient.sampler; + textures[0] = paint->gradient.texture; + return 1; + } + } + break; + case VG_PAINT_TYPE_PATTERN: { + memcpy(paint->pattern.sampler.border_color, + ctx->state.vg.tile_fill_color, + sizeof(VGfloat) * 4); + paint->pattern.sampler.min_img_filter = image_sampler_filter(ctx); + paint->pattern.sampler.mag_img_filter = image_sampler_filter(ctx); + samplers[0] = &paint->pattern.sampler; + textures[0] = paint->pattern.texture; + return 1; + } + break; + default: + samplers[0] = &paint->pattern.sampler; /* dummy */ + textures[0] = 0; + return 0; + break; + } + return 0; +} + +void paint_resolve_type(struct vg_paint *paint) +{ + if (paint->type == VG_PAINT_TYPE_PATTERN && + !paint->pattern.texture) { + paint->type = VG_PAINT_TYPE_COLOR; + } +} + +VGint paint_constant_buffer_size(struct vg_paint *paint) +{ + switch(paint->type) { + case VG_PAINT_TYPE_COLOR: + return 8 * sizeof(VGfloat);/*4 color + 4 constants (0.f,1.f,2.f,4.f)*/ + break; + case VG_PAINT_TYPE_LINEAR_GRADIENT: + return 20 * sizeof(VGfloat); + break; + case VG_PAINT_TYPE_RADIAL_GRADIENT: + return 20 * sizeof(VGfloat); + break; + case VG_PAINT_TYPE_PATTERN: + return 20 * sizeof(VGfloat); + break; + default: + debug_printf("Uknown paint type: %d\n", paint->type); + } + + return 0; +} + +void paint_fill_constant_buffer(struct vg_paint *paint, + void *buffer) +{ + switch(paint->type) { + case VG_PAINT_TYPE_COLOR: + paint_color_buffer(paint, buffer); + break; + case VG_PAINT_TYPE_LINEAR_GRADIENT: + paint_linear_gradient_buffer(paint, buffer); + break; + case VG_PAINT_TYPE_RADIAL_GRADIENT: + paint_radial_gradient_buffer(paint, buffer); + break; + case VG_PAINT_TYPE_PATTERN: + paint_pattern_buffer(paint, buffer); + break; + + default: + abort(); + } +} diff --git a/src/gallium/state_trackers/vega/paint.h b/src/gallium/state_trackers/vega/paint.h new file mode 100644 index 00000000000..999b5c167ca --- /dev/null +++ b/src/gallium/state_trackers/vega/paint.h @@ -0,0 +1,118 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 PAINT_H +#define PAINT_H + +#include "vg_context.h" + +#include "VG/openvg.h" +#include "pipe/p_state.h" + +struct vg_paint; +struct vg_image; +struct pipe_sampler_state; +struct pipe_texture; + +struct vg_paint *paint_create(struct vg_context *ctx); +void paint_destroy(struct vg_paint *paint); + +void paint_set_color(struct vg_paint *paint, + const VGfloat *color); +void paint_get_color(struct vg_paint *paint, + VGfloat *color); + +void paint_set_coloriv(struct vg_paint *paint, + const VGint *color); +void paint_get_coloriv(struct vg_paint *paint, + VGint *color); + +void paint_set_colori(struct vg_paint *paint, + VGuint rgba); + +VGuint paint_colori(struct vg_paint *paint); + +void paint_set_type(struct vg_paint *paint, VGPaintType type); +VGPaintType paint_type(struct vg_paint *paint); +void paint_resolve_type(struct vg_paint *paint); + +void paint_set_linear_gradient(struct vg_paint *paint, + const VGfloat *coords); +void paint_linear_gradient(struct vg_paint *paint, + VGfloat *coords); +void paint_set_linear_gradienti(struct vg_paint *paint, + const VGint *coords); +void paint_linear_gradienti(struct vg_paint *paint, + VGint *coords); + + +void paint_set_radial_gradient(struct vg_paint *paint, + const VGfloat *values); +void paint_radial_gradient(struct vg_paint *paint, + VGfloat *coords); +void paint_set_radial_gradienti(struct vg_paint *paint, + const VGint *values); +void paint_radial_gradienti(struct vg_paint *paint, + VGint *coords); + + +void paint_set_ramp_stops(struct vg_paint *paint, const VGfloat *stops, + int num); +void paint_ramp_stops(struct vg_paint *paint, VGfloat *stops, + int num); + +void paint_set_ramp_stopsi(struct vg_paint *paint, const VGint *stops, + int num); +void paint_ramp_stopsi(struct vg_paint *paint, VGint *stops, + int num); + +int paint_num_ramp_stops(struct vg_paint *paint); + +void paint_set_spread_mode(struct vg_paint *paint, + VGint mode); +VGColorRampSpreadMode paint_spread_mode(struct vg_paint *paint); + + +void paint_set_pattern(struct vg_paint *paint, + struct vg_image *img); +void paint_set_pattern_tiling(struct vg_paint *paint, + VGTilingMode mode); +VGTilingMode paint_pattern_tiling(struct vg_paint *paint); + +void paint_set_color_ramp_premultiplied(struct vg_paint *paint, + VGboolean set); +VGboolean paint_color_ramp_premultiplied(struct vg_paint *paint); + + +VGint paint_bind_samplers(struct vg_paint *paint, struct pipe_sampler_state **samplers, + struct pipe_texture **textures); + +VGint paint_constant_buffer_size(struct vg_paint *paint); +void paint_fill_constant_buffer(struct vg_paint *paint, + void *buffer); + + +#endif diff --git a/src/gallium/state_trackers/vega/path.c b/src/gallium/state_trackers/vega/path.c new file mode 100644 index 00000000000..d04f9d9ae64 --- /dev/null +++ b/src/gallium/state_trackers/vega/path.c @@ -0,0 +1,2034 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "path.h" + +#include "stroker.h" +#include "polygon.h" +#include "bezier.h" +#include "matrix.h" +#include "vg_context.h" +#include "util_array.h" +#include "arc.h" +#include "path_utils.h" +#include "paint.h" +#include "shader.h" + +#include "util/u_memory.h" + +#include <assert.h> + +#define DEBUG_PATH 0 + +struct path { + struct vg_object base; + VGbitfield caps; + VGboolean dirty; + VGboolean dirty_stroke; + + VGPathDatatype datatype; + + VGfloat scale; + VGfloat bias; + + VGint num_segments; + + struct array * segments; + struct array * control_points; + + struct { + struct polygon_array polygon_array; + struct matrix matrix; + } fill_polys; + + struct { + struct path *path; + struct matrix matrix; + VGfloat stroke_width; + VGfloat miter_limit; + VGCapStyle cap_style; + VGJoinStyle join_style; + } stroked; +}; + + +static INLINE void data_at(void **data, + struct path *p, + VGint start, VGint count, + VGfloat *out) +{ + VGPathDatatype dt = p->datatype; + VGint i; + VGint end = start + count; + VGfloat *itr = out; + + switch(dt) { + case VG_PATH_DATATYPE_S_8: { + VGbyte **bdata = (VGbyte **)data; + for (i = start; i < end; ++i) { + *itr = (*bdata)[i]; + ++itr; + } + *bdata += count; + } + break; + case VG_PATH_DATATYPE_S_16: { + VGshort **bdata = (VGshort **)data; + for (i = start; i < end; ++i) { + *itr = (*bdata)[i]; + ++itr; + } + *bdata += count; + } + break; + case VG_PATH_DATATYPE_S_32: { + VGint **bdata = (VGint **)data; + for (i = start; i < end; ++i) { + *itr = (*bdata)[i]; + ++itr; + } + *bdata += count; + } + break; + case VG_PATH_DATATYPE_F: { + VGfloat **fdata = (VGfloat **)data; + for (i = start; i < end; ++i) { + *itr = (*fdata)[i]; + ++itr; + } + *fdata += count; + } + break; + default: + debug_assert(!"Unknown path datatype!"); + } +} + + +void vg_float_to_datatype(VGPathDatatype datatype, + VGubyte *common_data, + const VGfloat *data, + VGint num_coords) +{ + VGint i; + switch(datatype) { + case VG_PATH_DATATYPE_S_8: { + for (i = 0; i < num_coords; ++i) { + common_data[i] = (VGubyte)data[i]; + } + } + break; + case VG_PATH_DATATYPE_S_16: { + VGshort *buf = (VGshort*)common_data; + for (i = 0; i < num_coords; ++i) { + buf[i] = (VGshort)data[i]; + } + } + break; + case VG_PATH_DATATYPE_S_32: { + VGint *buf = (VGint*)common_data; + for (i = 0; i < num_coords; ++i) { + buf[i] = (VGint)data[i]; + } + } + break; + case VG_PATH_DATATYPE_F: { + memcpy(common_data, data, sizeof(VGfloat) * num_coords); + } + break; + default: + debug_assert(!"Unknown path datatype!"); + } +} + +static void coords_adjust_by_scale_bias(struct path *p, + void *pdata, VGint num_coords, + VGfloat scale, VGfloat bias, + VGPathDatatype datatype) +{ + VGfloat data[8]; + void *coords = (VGfloat *)pdata; + VGubyte *common_data = (VGubyte *)pdata; + VGint size_dst = size_for_datatype(datatype); + VGint i; + + for (i = 0; i < num_coords; ++i) { + data_at(&coords, p, 0, 1, data); + data[0] = data[0] * scale + bias; + vg_float_to_datatype(datatype, common_data, data, 1); + common_data += size_dst; + } +} + +struct path * path_create(VGPathDatatype dt, VGfloat scale, VGfloat bias, + VGint segmentCapacityHint, + VGint coordCapacityHint, + VGbitfield capabilities) +{ + struct path *path = CALLOC_STRUCT(path); + + vg_init_object(&path->base, vg_current_context(), VG_OBJECT_PATH); + path->caps = capabilities & VG_PATH_CAPABILITY_ALL; + vg_context_add_object(vg_current_context(), VG_OBJECT_PATH, path); + + path->datatype = dt; + path->scale = scale; + path->bias = bias; + + path->segments = array_create(size_for_datatype(VG_PATH_DATATYPE_S_8)); + path->control_points = array_create(size_for_datatype(dt)); + + path->dirty = VG_TRUE; + path->dirty_stroke = VG_TRUE; + + return path; +} + +void path_destroy(struct path *p) +{ + vg_context_remove_object(vg_current_context(), VG_OBJECT_PATH, p); + + array_destroy(p->segments); + array_destroy(p->control_points); + array_destroy(p->fill_polys.polygon_array.array); + + if (p->stroked.path) + path_destroy(p->stroked.path); + + free(p); +} + +VGbitfield path_capabilities(struct path *p) +{ + return p->caps; +} + +void path_set_capabilities(struct path *p, VGbitfield bf) +{ + p->caps = (bf & VG_PATH_CAPABILITY_ALL); +} + +void path_append_data(struct path *p, + VGint numSegments, + const VGubyte * pathSegments, + const void * pathData) +{ + VGint old_segments = p->num_segments; + VGint num_new_coords = num_elements_for_segments(pathSegments, numSegments); + array_append_data(p->segments, pathSegments, numSegments); + array_append_data(p->control_points, pathData, num_new_coords); + + p->num_segments += numSegments; + if (!floatsEqual(p->scale, 1.f) || !floatsEqual(p->bias, 0.f)) { + VGubyte *coords = (VGubyte*)p->control_points->data; + coords_adjust_by_scale_bias(p, + coords + old_segments * p->control_points->datatype_size, + num_new_coords, + p->scale, p->bias, p->datatype); + } + p->dirty = VG_TRUE; + p->dirty_stroke = VG_TRUE; +} + +VGint path_num_segments(struct path *p) +{ + return p->num_segments; +} + +static INLINE void map_if_relative(VGfloat ox, VGfloat oy, + VGboolean relative, + VGfloat *x, VGfloat *y) +{ + if (relative) { + if (x) + *x += ox; + if (y) + *y += oy; + } +} + +static INLINE void close_polygon(struct polygon *current, + VGfloat sx, VGfloat sy, + VGfloat ox, VGfloat oy, + struct matrix *matrix) +{ + if (!floatsEqual(sx, ox) || + !floatsEqual(sy, oy)) { + VGfloat x0 = sx; + VGfloat y0 = sy; + matrix_map_point(matrix, x0, y0, &x0, &y0); + polygon_vertex_append(current, x0, y0); + } +} + +static void convert_path(struct path *p, + VGPathDatatype to, + void *dst, + VGint num_coords) +{ + VGfloat data[8]; + void *coords = (VGfloat *)p->control_points->data; + VGubyte *common_data = (VGubyte *)dst; + VGint size_dst = size_for_datatype(to); + VGint i; + + for (i = 0; i < num_coords; ++i) { + data_at(&coords, p, 0, 1, data); + vg_float_to_datatype(to, common_data, data, 1); + common_data += size_dst; + } +} + + +static void polygon_array_calculate_bounds( struct polygon_array *polyarray ) +{ + struct array *polys = polyarray->array; + VGfloat min_x, max_x; + VGfloat min_y, max_y; + VGfloat bounds[4]; + unsigned i; + + assert(polys); + assert(polys->num_elements); + polygon_bounding_rect((((struct polygon**)polys->data)[0]), bounds); + min_x = bounds[0]; + min_y = bounds[1]; + max_x = bounds[0] + bounds[2]; + max_y = bounds[1] + bounds[3]; + for (i = 1; i < polys->num_elements; ++i) { + struct polygon *p = (((struct polygon**)polys->data)[i]); + polygon_bounding_rect(p, bounds); + min_x = MIN2(min_x, bounds[0]); + min_y = MIN2(min_y, bounds[1]); + max_x = MAX2(max_x, bounds[0] + bounds[2]); + max_y = MAX2(max_y, bounds[1] + bounds[3]); + } + + polyarray->min_x = min_x; + polyarray->min_y = min_y; + polyarray->max_x = max_x; + polyarray->max_y = max_y; +} + + +static struct polygon_array * path_get_fill_polygons(struct path *p, struct matrix *matrix) +{ + VGint i; + struct polygon *current = 0; + VGfloat sx, sy, px, py, ox, oy; + VGfloat x0, y0, x1, y1, x2, y2, x3, y3; + VGfloat data[8]; + void *coords = (VGfloat *)p->control_points->data; + struct array *array; + + if (p->fill_polys.polygon_array.array) + { + if (memcmp( &p->fill_polys.matrix, + matrix, + sizeof *matrix ) == 0 && p->dirty == VG_FALSE) + { + return &p->fill_polys.polygon_array; + } + else { + array_destroy( p->fill_polys.polygon_array.array ); + p->fill_polys.polygon_array.array = NULL; + } + } + + array = array_create(sizeof(struct array*)); + + sx = sy = px = py = ox = oy = 0.f; + + current = polygon_create(32); + + for (i = 0; i < p->num_segments; ++i) { + VGubyte segment = ((VGubyte*)(p->segments->data))[i]; + VGint command = SEGMENT_COMMAND(segment); + VGboolean relative = SEGMENT_ABS_REL(segment); + + switch(command) { + case VG_CLOSE_PATH: + close_polygon(current, sx, sy, ox, oy, matrix); + ox = sx; + oy = sy; + break; + case VG_MOVE_TO: + if (current && polygon_vertex_count(current) > 0) { + /* add polygon */ + close_polygon(current, sx, sy, ox, oy, matrix); + array_append_data(array, ¤t, 1); + current = polygon_create(32); + } + data_at(&coords, p, 0, 2, data); + x0 = data[0]; + y0 = data[1]; + map_if_relative(ox, oy, relative, &x0, &y0); + sx = x0; + sy = y0; + ox = x0; + oy = y0; + px = x0; + py = y0; + matrix_map_point(matrix, x0, y0, &x0, &y0); + polygon_vertex_append(current, x0, y0); + break; + case VG_LINE_TO: + data_at(&coords, p, 0, 2, data); + x0 = data[0]; + y0 = data[1]; + map_if_relative(ox, oy, relative, &x0, &y0); + ox = x0; + oy = y0; + px = x0; + py = y0; + matrix_map_point(matrix, x0, y0, &x0, &y0); + polygon_vertex_append(current, x0, y0); + break; + case VG_HLINE_TO: + data_at(&coords, p, 0, 1, data); + x0 = data[0]; + y0 = oy; + map_if_relative(ox, oy, relative, &x0, 0); + ox = x0; + px = x0; + py = y0; + matrix_map_point(matrix, x0, y0, &x0, &y0); + polygon_vertex_append(current, x0, y0); + break; + case VG_VLINE_TO: + data_at(&coords, p, 0, 1, data); + x0 = ox; + y0 = data[0]; + map_if_relative(ox, oy, relative, 0, &y0); + oy = y0; + px = x0; + py = y0; + matrix_map_point(matrix, x0, y0, &x0, &y0); + polygon_vertex_append(current, x0, y0); + break; + case VG_CUBIC_TO: { + struct bezier bezier; + data_at(&coords, p, 0, 6, data); + x0 = ox; + y0 = oy; + x1 = data[0]; + y1 = data[1]; + x2 = data[2]; + y2 = data[3]; + x3 = data[4]; + y3 = data[5]; + map_if_relative(ox, oy, relative, &x1, &y1); + map_if_relative(ox, oy, relative, &x2, &y2); + map_if_relative(ox, oy, relative, &x3, &y3); + ox = x3; + oy = y3; + px = x2; + py = y2; + assert(matrix_is_affine(matrix)); + matrix_map_point(matrix, x0, y0, &x0, &y0); + matrix_map_point(matrix, x1, y1, &x1, &y1); + matrix_map_point(matrix, x2, y2, &x2, &y2); + matrix_map_point(matrix, x3, y3, &x3, &y3); + bezier_init(&bezier, x0, y0, x1, y1, + x2, y2, x3, y3); + bezier_add_to_polygon(&bezier, current); + } + break; + case VG_QUAD_TO: { + struct bezier bezier; + data_at(&coords, p, 0, 4, data); + x0 = ox; + y0 = oy; + x1 = data[0]; + y1 = data[1]; + x3 = data[2]; + y3 = data[3]; + map_if_relative(ox, oy, relative, &x1, &y1); + map_if_relative(ox, oy, relative, &x3, &y3); + px = x1; + py = y1; + { /* form a cubic out of it */ + x2 = (x3 + 2*x1) / 3.f; + y2 = (y3 + 2*y1) / 3.f; + x1 = (x0 + 2*x1) / 3.f; + y1 = (y0 + 2*y1) / 3.f; + } + ox = x3; + oy = y3; + assert(matrix_is_affine(matrix)); + matrix_map_point(matrix, x0, y0, &x0, &y0); + matrix_map_point(matrix, x1, y1, &x1, &y1); + matrix_map_point(matrix, x2, y2, &x2, &y2); + matrix_map_point(matrix, x3, y3, &x3, &y3); + bezier_init(&bezier, x0, y0, x1, y1, + x2, y2, x3, y3); + bezier_add_to_polygon(&bezier, current); + } + break; + case VG_SQUAD_TO: { + struct bezier bezier; + data_at(&coords, p, 0, 2, data); + x0 = ox; + y0 = oy; + x1 = 2*ox-px; + y1 = 2*oy-py; + x3 = data[0]; + y3 = data[1]; + map_if_relative(ox, oy, relative, &x3, &y3); + px = x1; + py = y1; + { /* form a cubic out of it */ + x2 = (x3 + 2*x1) / 3.f; + y2 = (y3 + 2*y1) / 3.f; + x1 = (x0 + 2*x1) / 3.f; + y1 = (y0 + 2*y1) / 3.f; + } + ox = x3; + oy = y3; + assert(matrix_is_affine(matrix)); + matrix_map_point(matrix, x0, y0, &x0, &y0); + matrix_map_point(matrix, x1, y1, &x1, &y1); + matrix_map_point(matrix, x2, y2, &x2, &y2); + matrix_map_point(matrix, x3, y3, &x3, &y3); + bezier_init(&bezier, x0, y0, x1, y1, + x2, y2, x3, y3); + bezier_add_to_polygon(&bezier, current); + } + break; + case VG_SCUBIC_TO: { + struct bezier bezier; + data_at(&coords, p, 0, 4, data); + x0 = ox; + y0 = oy; + x1 = 2*ox-px; + y1 = 2*oy-py; + x2 = data[0]; + y2 = data[1]; + x3 = data[2]; + y3 = data[3]; + map_if_relative(ox, oy, relative, &x2, &y2); + map_if_relative(ox, oy, relative, &x3, &y3); + ox = x3; + oy = y3; + px = x2; + py = y2; + assert(matrix_is_affine(matrix)); + matrix_map_point(matrix, x0, y0, &x0, &y0); + matrix_map_point(matrix, x1, y1, &x1, &y1); + matrix_map_point(matrix, x2, y2, &x2, &y2); + matrix_map_point(matrix, x3, y3, &x3, &y3); + bezier_init(&bezier, x0, y0, x1, y1, + x2, y2, x3, y3); + bezier_add_to_polygon(&bezier, current); + } + break; + case VG_SCCWARC_TO: + case VG_SCWARC_TO: + case VG_LCCWARC_TO: + case VG_LCWARC_TO: { + VGfloat rh, rv, rot; + struct arc arc; + + data_at(&coords, p, 0, 5, data); + x0 = ox; + y0 = oy; + rh = data[0]; + rv = data[1]; + rot = data[2]; + x1 = data[3]; + y1 = data[4]; + map_if_relative(ox, oy, relative, &x1, &y1); +#if 0 + debug_printf("------- ARC (%f, %f), (%f, %f) %f, %f, %f\n", + x0, y0, x1, y1, rh, rv, rot); +#endif + arc_init(&arc, command, x0, y0, x1, y1, + rh, rv, rot); + arc_add_to_polygon(&arc, current, + matrix); + ox = x1; + oy = y1; + px = x1; + py = y1; + } + break; + default: + abort(); + assert(!"Unknown segment!"); + } + } + if (current) { + if (polygon_vertex_count(current) > 0) { + close_polygon(current, sx, sy, ox, oy, matrix); + array_append_data(array, ¤t, 1); + } else + polygon_destroy(current); + } + + p->fill_polys.polygon_array.array = array; + p->fill_polys.matrix = *matrix; + + polygon_array_calculate_bounds( &p->fill_polys.polygon_array ); + + p->dirty = VG_FALSE; + + return &p->fill_polys.polygon_array; +} + +VGbyte path_datatype_size(struct path *p) +{ + return size_for_datatype(p->datatype); +} + +VGPathDatatype path_datatype(struct path *p) +{ + return p->datatype; +} + +VGfloat path_scale(struct path *p) +{ + return p->scale; +} + +VGfloat path_bias(struct path *p) +{ + return p->bias; +} + +VGint path_num_coords(struct path *p) +{ + return num_elements_for_segments((VGubyte*)p->segments->data, + p->num_segments); +} + +void path_modify_coords(struct path *p, + VGint startIndex, + VGint numSegments, + const void * pathData) +{ + VGubyte *segments = (VGubyte*)(p->segments->data); + VGint count = num_elements_for_segments(&segments[startIndex], numSegments); + VGint start_cp = num_elements_for_segments(segments, startIndex); + + array_change_data(p->control_points, pathData, start_cp, count); + coords_adjust_by_scale_bias(p, + ((VGubyte*)p->control_points->data) + + (startIndex * p->control_points->datatype_size), + path_num_coords(p), + p->scale, p->bias, p->datatype); + p->dirty = VG_TRUE; + p->dirty_stroke = VG_TRUE; +} + +void path_for_each_segment(struct path *path, + path_for_each_cb cb, + void *user_data) +{ + VGint i; + struct path_for_each_data p; + VGfloat data[8]; + void *coords = (VGfloat *)path->control_points->data; + + p.coords = data; + p.sx = p.sy = p.px = p.py = p.ox = p.oy = 0.f; + p.user_data = user_data; + + for (i = 0; i < path->num_segments; ++i) { + VGint command; + VGboolean relative; + + p.segment = ((VGubyte*)(path->segments->data))[i]; + command = SEGMENT_COMMAND(p.segment); + relative = SEGMENT_ABS_REL(p.segment); + + switch(command) { + case VG_CLOSE_PATH: + cb(path, &p); + break; + case VG_MOVE_TO: + data_at(&coords, path, 0, 2, data); + map_if_relative(p.ox, p.oy, relative, &data[0], &data[1]); + cb(path, &p); + p.sx = data[0]; + p.sy = data[1]; + p.ox = data[0]; + p.oy = data[1]; + p.px = data[0]; + p.py = data[1]; + break; + case VG_LINE_TO: + data_at(&coords, path, 0, 2, data); + map_if_relative(p.ox, p.oy, relative, &data[0], &data[1]); + cb(path, &p); + p.ox = data[0]; + p.oy = data[1]; + p.px = data[0]; + p.py = data[1]; + break; + case VG_HLINE_TO: + data_at(&coords, path, 0, 1, data); + map_if_relative(p.ox, p.oy, relative, &data[0], 0); + p.segment = VG_LINE_TO; + data[1] = p.oy; + cb(path, &p); + p.ox = data[0]; + p.oy = data[1]; + p.px = data[0]; + p.py = data[1]; + break; + case VG_VLINE_TO: + data_at(&coords, path, 0, 1, data); + map_if_relative(p.ox, p.oy, relative, 0, &data[0]); + p.segment = VG_LINE_TO; + data[1] = data[0]; + data[0] = p.ox; + cb(path, &p); + p.ox = data[0]; + p.oy = data[1]; + p.px = data[0]; + p.py = data[1]; + break; + case VG_CUBIC_TO: { + data_at(&coords, path, 0, 6, data); + map_if_relative(p.ox, p.oy, relative, &data[0], &data[1]); + map_if_relative(p.ox, p.oy, relative, &data[2], &data[3]); + map_if_relative(p.ox, p.oy, relative, &data[4], &data[5]); + cb(path, &p); + p.px = data[2]; + p.py = data[3]; + p.ox = data[4]; + p.oy = data[5]; + } + break; + case VG_QUAD_TO: { + data_at(&coords, path, 0, 4, data); + map_if_relative(p.ox, p.oy, relative, &data[0], &data[1]); + map_if_relative(p.ox, p.oy, relative, &data[2], &data[3]); + cb(path, &p); + p.px = data[0]; + p.py = data[1]; + p.ox = data[2]; + p.oy = data[3]; + } + break; + case VG_SQUAD_TO: { + data_at(&coords, path, 0, 2, data); + map_if_relative(p.ox, p.oy, relative, &data[0], &data[1]); + cb(path, &p); + p.px = 2*p.ox-p.px; + p.py = 2*p.oy-p.py; + p.ox = data[2]; + p.oy = data[3]; + } + break; + case VG_SCUBIC_TO: { + data_at(&coords, path, 0, 4, data); + map_if_relative(p.ox, p.oy, relative, &data[0], &data[1]); + map_if_relative(p.ox, p.oy, relative, &data[2], &data[3]); + cb(path, &p); + p.px = data[0]; + p.py = data[1]; + p.ox = data[2]; + p.oy = data[3]; + } + break; + case VG_SCCWARC_TO: + case VG_SCWARC_TO: + case VG_LCCWARC_TO: + case VG_LCWARC_TO: { + data_at(&coords, path, 0, 5, data); + map_if_relative(p.ox, p.oy, relative, &data[3], &data[4]); +#if 0 + debug_printf("------- ARC (%f, %f), (%f, %f) %f, %f, %f\n", + p.ox, p.oy, data[3], data[4], data[0], data[1], data[2]); +#endif + cb(path, &p); + p.ox = data[3]; + p.oy = data[4]; + p.px = data[3]; + p.py = data[4]; + } + break; + default: + abort(); + assert(!"Unknown segment!"); + } + } +} + +struct transform_data { + struct array *segments; + struct array *coords; + + struct matrix *matrix; + + VGPathDatatype datatype; +}; + +static VGboolean transform_cb(struct path *p, + struct path_for_each_data *pd) +{ + struct transform_data *td = (struct transform_data *)pd->user_data; + VGint num_coords = num_elements_for_segments(&pd->segment, 1); + VGubyte segment = SEGMENT_COMMAND(pd->segment);/* abs bit is 0 */ + VGfloat data[8]; + VGubyte common_data[sizeof(VGfloat)*8]; + + memcpy(data, pd->coords, sizeof(VGfloat) * num_coords); + + switch(segment) { + case VG_CLOSE_PATH: + break; + case VG_MOVE_TO: + matrix_map_point(td->matrix, + data[0], data[1], &data[0], &data[1]); + break; + case VG_LINE_TO: + matrix_map_point(td->matrix, + data[0], data[1], &data[0], &data[1]); + break; + case VG_HLINE_TO: + case VG_VLINE_TO: + assert(0); + break; + case VG_QUAD_TO: + matrix_map_point(td->matrix, + data[0], data[1], &data[0], &data[1]); + matrix_map_point(td->matrix, + data[2], data[3], &data[2], &data[3]); + break; + case VG_CUBIC_TO: + matrix_map_point(td->matrix, + data[0], data[1], &data[0], &data[1]); + matrix_map_point(td->matrix, + data[2], data[3], &data[2], &data[3]); + matrix_map_point(td->matrix, + data[4], data[5], &data[4], &data[5]); + break; + case VG_SQUAD_TO: + matrix_map_point(td->matrix, + data[0], data[1], &data[0], &data[1]); + break; + case VG_SCUBIC_TO: + matrix_map_point(td->matrix, + data[0], data[1], &data[0], &data[1]); + matrix_map_point(td->matrix, + data[2], data[3], &data[2], &data[3]); + break; + case VG_SCCWARC_TO: + case VG_SCWARC_TO: + case VG_LCCWARC_TO: + case VG_LCWARC_TO: { + struct arc arc; + struct path *path = path_create(td->datatype, + 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL); + arc_init(&arc, segment, + pd->ox, pd->oy, data[3], data[4], + data[0], data[1], data[2]); + + arc_to_path(&arc, path, td->matrix); + + num_coords = path_num_coords(path); + + array_append_data(td->segments, path->segments->data, + path->num_segments); + array_append_data(td->coords, path->control_points->data, + num_coords); + path_destroy(path); + + return VG_TRUE; + } + break; + default: + break; + } + + vg_float_to_datatype(td->datatype, common_data, data, num_coords); + + array_append_data(td->segments, &segment, 1); + array_append_data(td->coords, common_data, num_coords); + return VG_TRUE; +} + +void path_transform(struct path *dst, struct path *src) +{ + struct transform_data data; + struct vg_context *ctx = dst->base.ctx; + + data.segments = dst->segments; + data.coords = dst->control_points; + data.matrix = &ctx->state.vg.path_user_to_surface_matrix; + data.datatype = dst->datatype; + + path_for_each_segment(src, transform_cb, (void*)&data); + + dst->num_segments = dst->segments->num_elements; + dst->dirty = VG_TRUE; + dst->dirty_stroke = VG_TRUE; +} + +void path_append_path(struct path *dst, + struct path *src) +{ + VGint num_coords = path_num_coords(src); + void *dst_data = malloc(size_for_datatype(dst->datatype) * num_coords); + array_append_data(dst->segments, + src->segments->data, + src->num_segments); + convert_path(src, dst->datatype, + dst_data, num_coords); + array_append_data(dst->control_points, + dst_data, + num_coords); + free(dst_data); + + dst->num_segments += src->num_segments; + dst->dirty = VG_TRUE; + dst->dirty_stroke = VG_TRUE; +} + +static INLINE VGboolean is_segment_arc(VGubyte segment) +{ + VGubyte scommand = SEGMENT_COMMAND(segment); + return (scommand == VG_SCCWARC_TO || + scommand == VG_SCWARC_TO || + scommand == VG_LCCWARC_TO || + scommand == VG_LCWARC_TO); +} + +struct path_iter_data { + struct path *path; + VGubyte segment; + void *coords; + VGfloat px, py, ox, oy, sx, sy; +}; +static INLINE VGubyte normalize_coords(struct path_iter_data *pd, + VGint *num_coords, + VGfloat *data) +{ + VGint command = SEGMENT_COMMAND(pd->segment); + VGboolean relative = SEGMENT_ABS_REL(pd->segment); + + switch(command) { + case VG_CLOSE_PATH: + *num_coords = 0; + pd->ox = pd->sx; + pd->oy = pd->sy; + return VG_CLOSE_PATH; + break; + case VG_MOVE_TO: + data_at(&pd->coords, pd->path, 0, 2, data); + map_if_relative(pd->ox, pd->oy, relative, &data[0], &data[1]); + pd->sx = data[0]; + pd->sy = data[1]; + pd->ox = data[0]; + pd->oy = data[1]; + pd->px = data[0]; + pd->py = data[1]; + *num_coords = 2; + return VG_MOVE_TO_ABS; + break; + case VG_LINE_TO: + data_at(&pd->coords, pd->path, 0, 2, data); + map_if_relative(pd->ox, pd->oy, relative, &data[0], &data[1]); + pd->ox = data[0]; + pd->oy = data[1]; + pd->px = data[0]; + pd->py = data[1]; + *num_coords = 2; + return VG_LINE_TO_ABS; + break; + case VG_HLINE_TO: + data_at(&pd->coords, pd->path, 0, 1, data); + map_if_relative(pd->ox, pd->oy, relative, &data[0], 0); + data[1] = pd->oy; + pd->ox = data[0]; + pd->oy = data[1]; + pd->px = data[0]; + pd->py = data[1]; + *num_coords = 2; + return VG_LINE_TO_ABS; + break; + case VG_VLINE_TO: + data_at(&pd->coords, pd->path, 0, 1, data); + map_if_relative(pd->ox, pd->oy, relative, 0, &data[0]); + data[1] = data[0]; + data[0] = pd->ox; + pd->ox = data[0]; + pd->oy = data[1]; + pd->px = data[0]; + pd->py = data[1]; + *num_coords = 2; + return VG_LINE_TO_ABS; + break; + case VG_CUBIC_TO: { + data_at(&pd->coords, pd->path, 0, 6, data); + map_if_relative(pd->ox, pd->oy, relative, &data[0], &data[1]); + map_if_relative(pd->ox, pd->oy, relative, &data[2], &data[3]); + map_if_relative(pd->ox, pd->oy, relative, &data[4], &data[5]); + pd->px = data[2]; + pd->py = data[3]; + pd->ox = data[4]; + pd->oy = data[5]; + *num_coords = 6; + return VG_CUBIC_TO_ABS; + } + break; + case VG_QUAD_TO: { + VGfloat x0, y0, x1, y1, x2, y2, x3, y3; + data_at(&pd->coords, pd->path, 0, 4, data); + x0 = pd->ox; + y0 = pd->oy; + x1 = data[0]; + y1 = data[1]; + x3 = data[2]; + y3 = data[3]; + map_if_relative(pd->ox, pd->oy, relative, &x1, &y1); + map_if_relative(pd->ox, pd->oy, relative, &x3, &y3); + pd->px = x1; + pd->py = y1; + { /* form a cubic out of it */ + x2 = (x3 + 2*x1) / 3.f; + y2 = (y3 + 2*y1) / 3.f; + x1 = (x0 + 2*x1) / 3.f; + y1 = (y0 + 2*y1) / 3.f; + } + pd->ox = x3; + pd->oy = y3; + data[0] = x1; + data[1] = y1; + data[2] = x2; + data[3] = y2; + data[4] = x3; + data[5] = y3; + *num_coords = 6; + return VG_CUBIC_TO_ABS; + } + break; + case VG_SQUAD_TO: { + VGfloat x0, y0, x1, y1, x2, y2, x3, y3; + data_at(&pd->coords, pd->path, 0, 2, data); + x0 = pd->ox; + y0 = pd->oy; + x1 = 2 * pd->ox - pd->px; + y1 = 2 * pd->oy - pd->py; + x3 = data[0]; + y3 = data[1]; + map_if_relative(pd->ox, pd->oy, relative, &x3, &y3); + pd->px = x1; + pd->py = y1; + { /* form a cubic out of it */ + x2 = (x3 + 2*x1) / 3.f; + y2 = (y3 + 2*y1) / 3.f; + x1 = (x0 + 2*x1) / 3.f; + y1 = (y0 + 2*y1) / 3.f; + } + pd->ox = x3; + pd->oy = y3; + data[0] = x1; + data[1] = y1; + data[2] = x2; + data[3] = y2; + data[4] = x3; + data[5] = y3; + *num_coords = 6; + return VG_CUBIC_TO_ABS; + } + break; + case VG_SCUBIC_TO: { + VGfloat x0, y0, x1, y1, x2, y2, x3, y3; + data_at(&pd->coords, pd->path, 0, 4, data); + x0 = pd->ox; + y0 = pd->oy; + x1 = 2*pd->ox-pd->px; + y1 = 2*pd->oy-pd->py; + x2 = data[0]; + y2 = data[1]; + x3 = data[2]; + y3 = data[3]; + map_if_relative(pd->ox, pd->oy, relative, &x2, &y2); + map_if_relative(pd->ox, pd->oy, relative, &x3, &y3); + pd->ox = x3; + pd->oy = y3; + pd->px = x2; + pd->py = y2; + data[0] = x1; + data[1] = y1; + data[2] = x2; + data[3] = y2; + data[4] = x3; + data[5] = y3; + *num_coords = 6; + return VG_CUBIC_TO_ABS; + } + break; + case VG_SCCWARC_TO: + case VG_SCWARC_TO: + case VG_LCCWARC_TO: + case VG_LCWARC_TO: { + data_at(&pd->coords, pd->path, 0, 5, data); + map_if_relative(pd->ox, pd->oy, relative, &data[3], &data[4]); + pd->ox = data[3]; + pd->oy = data[4]; + pd->px = data[3]; + pd->py = data[4]; + *num_coords = 5; + return command | VG_ABSOLUTE; + } + break; + default: + abort(); + assert(!"Unknown segment!"); + } +} + +static void linearly_interpolate(VGfloat *result, + const VGfloat *start, + const VGfloat *end, + VGfloat amount, + VGint number) +{ + VGint i; + for (i = 0; i < number; ++i) { + result[i] = start[i] + (end[i] - start[i]) * amount; + } +} + +VGboolean path_interpolate(struct path *dst, + struct path *start, struct path *end, + VGfloat amount) +{ + /* temporary path that we can discard if it will turn + * out that start is not compatible with end */ + struct path *res_path = path_create(dst->datatype, + 1.0, 0.0, + 0, 0, dst->caps); + VGint i; + VGfloat start_coords[8]; + VGfloat end_coords[8]; + VGfloat results[8]; + VGubyte common_data[sizeof(VGfloat)*8]; + struct path_iter_data start_iter, end_iter; + + memset(&start_iter, 0, sizeof(struct path_iter_data)); + memset(&end_iter, 0, sizeof(struct path_iter_data)); + + start_iter.path = start; + start_iter.coords = start->control_points->data; + end_iter.path = end; + end_iter.coords = end->control_points->data; + + for (i = 0; i < start->num_segments; ++i) { + VGubyte segment; + VGubyte ssegment, esegment; + VGint snum_coords, enum_coords; + start_iter.segment = ((VGubyte*)(start->segments->data))[i]; + end_iter.segment = ((VGubyte*)(end->segments->data))[i]; + + ssegment = normalize_coords(&start_iter, &snum_coords, + start_coords); + esegment = normalize_coords(&end_iter, &enum_coords, + end_coords); + + if (is_segment_arc(ssegment)) { + if (!is_segment_arc(esegment)) { + path_destroy(res_path); + return VG_FALSE; + } + if (amount > 0.5) + segment = esegment; + else + segment = ssegment; + } else if (is_segment_arc(esegment)) { + path_destroy(res_path); + return VG_FALSE; + } + else if (ssegment != esegment) { + path_destroy(res_path); + return VG_FALSE; + } + else + segment = ssegment; + + linearly_interpolate(results, start_coords, end_coords, + amount, snum_coords); + vg_float_to_datatype(dst->datatype, common_data, results, snum_coords); + path_append_data(res_path, 1, &segment, common_data); + } + + path_append_path(dst, res_path); + path_destroy(res_path); + + dst->dirty = VG_TRUE; + dst->dirty_stroke = VG_TRUE; + + return VG_TRUE; +} + +void path_clear(struct path *p, VGbitfield capabilities) +{ + path_set_capabilities(p, capabilities); + array_destroy(p->segments); + array_destroy(p->control_points); + p->segments = array_create(size_for_datatype(VG_PATH_DATATYPE_S_8)); + p->control_points = array_create(size_for_datatype(p->datatype)); + p->num_segments = 0; + p->dirty = VG_TRUE; + p->dirty_stroke = VG_TRUE; +} + +struct path * path_create_stroke(struct path *p, + struct matrix *matrix) +{ + VGint i; + VGfloat sx, sy, px, py, ox, oy; + VGfloat x0, y0, x1, y1, x2, y2, x3, y3; + VGfloat data[8]; + void *coords = (VGfloat *)p->control_points->data; + int dashed = (p->base.ctx->state.vg.stroke.dash_pattern_num ? 1 : 0); + struct dash_stroker stroker; + struct vg_state *vg_state = &p->base.ctx->state.vg; + + if (p->stroked.path) + { + /* ### compare the dash patterns to see if we can cache them. + * for now we simply always bail out if the path is dashed. + */ + if (memcmp( &p->stroked.matrix, + matrix, + sizeof *matrix ) == 0 && + !dashed && !p->dirty_stroke && + floatsEqual(p->stroked.stroke_width, vg_state->stroke.line_width.f) && + floatsEqual(p->stroked.miter_limit, vg_state->stroke.miter_limit.f) && + p->stroked.cap_style == vg_state->stroke.cap_style && + p->stroked.join_style == vg_state->stroke.join_style) + { + return p->stroked.path; + } + else { + path_destroy( p->stroked.path ); + p->stroked.path = NULL; + } + } + + + sx = sy = px = py = ox = oy = 0.f; + + if (dashed) + dash_stroker_init((struct stroker *)&stroker, vg_state); + else + stroker_init((struct stroker *)&stroker, vg_state); + + stroker_begin((struct stroker *)&stroker); + + for (i = 0; i < p->num_segments; ++i) { + VGubyte segment = ((VGubyte*)(p->segments->data))[i]; + VGint command = SEGMENT_COMMAND(segment); + VGboolean relative = SEGMENT_ABS_REL(segment); + + switch(command) { + case VG_CLOSE_PATH: { + VGfloat x0 = sx; + VGfloat y0 = sy; + matrix_map_point(matrix, x0, y0, &x0, &y0); + stroker_line_to((struct stroker *)&stroker, x0, y0); + } + break; + case VG_MOVE_TO: + data_at(&coords, p, 0, 2, data); + x0 = data[0]; + y0 = data[1]; + map_if_relative(ox, oy, relative, &x0, &y0); + sx = x0; + sy = y0; + ox = x0; + oy = y0; + px = x0; + py = y0; + matrix_map_point(matrix, x0, y0, &x0, &y0); + stroker_move_to((struct stroker *)&stroker, x0, y0); + break; + case VG_LINE_TO: + data_at(&coords, p, 0, 2, data); + x0 = data[0]; + y0 = data[1]; + map_if_relative(ox, oy, relative, &x0, &y0); + ox = x0; + oy = y0; + px = x0; + py = y0; + matrix_map_point(matrix, x0, y0, &x0, &y0); + stroker_line_to((struct stroker *)&stroker, x0, y0); + break; + case VG_HLINE_TO: + data_at(&coords, p, 0, 1, data); + x0 = data[0]; + y0 = oy; + map_if_relative(ox, oy, relative, &x0, 0); + ox = x0; + px = x0; + py = y0; + matrix_map_point(matrix, x0, y0, &x0, &y0); + stroker_line_to((struct stroker *)&stroker, x0, y0); + break; + case VG_VLINE_TO: + data_at(&coords, p, 0, 1, data); + x0 = ox; + y0 = data[0]; + map_if_relative(ox, oy, relative, 0, &y0); + oy = y0; + px = x0; + py = y0; + matrix_map_point(matrix, x0, y0, &x0, &y0); + stroker_line_to((struct stroker *)&stroker, x0, y0); + break; + case VG_CUBIC_TO: { + data_at(&coords, p, 0, 6, data); + x0 = ox; + y0 = oy; + x1 = data[0]; + y1 = data[1]; + x2 = data[2]; + y2 = data[3]; + x3 = data[4]; + y3 = data[5]; + map_if_relative(ox, oy, relative, &x1, &y1); + map_if_relative(ox, oy, relative, &x2, &y2); + map_if_relative(ox, oy, relative, &x3, &y3); + if (floatsEqual(x1, ox) && floatsEqual(y1, oy) && + floatsEqual(x1, x2) && floatsEqual(y1, y2) && + floatsEqual(x2, x3) && floatsEqual(y2, y3)) { + /*ignore the empty segment */ + continue; + } else if (floatsEqual(x3, ox) && floatsEqual(y3, oy)) { + /* if dup vertex, emit a line */ + ox = x3; + oy = y3; + matrix_map_point(matrix, x3, y3, &x3, &y3); + stroker_line_to((struct stroker *)&stroker, x3, y3); + continue; + } + ox = x3; + oy = y3; + px = x2; + py = y2; + assert(matrix_is_affine(matrix)); + matrix_map_point(matrix, x0, y0, &x0, &y0); + matrix_map_point(matrix, x1, y1, &x1, &y1); + matrix_map_point(matrix, x2, y2, &x2, &y2); + matrix_map_point(matrix, x3, y3, &x3, &y3); + stroker_curve_to((struct stroker *)&stroker, x1, y1, x2, y2, x3, y3); + } + break; + case VG_QUAD_TO: { + data_at(&coords, p, 0, 4, data); + x0 = ox; + y0 = oy; + x1 = data[0]; + y1 = data[1]; + x3 = data[2]; + y3 = data[3]; + map_if_relative(ox, oy, relative, &x1, &y1); + map_if_relative(ox, oy, relative, &x3, &y3); + px = x1; + py = y1; + { /* form a cubic out of it */ + x2 = (x3 + 2*x1) / 3.f; + y2 = (y3 + 2*y1) / 3.f; + x1 = (x0 + 2*x1) / 3.f; + y1 = (y0 + 2*y1) / 3.f; + } + if (floatsEqual(x1, ox) && floatsEqual(y1, oy) && + floatsEqual(x1, x2) && floatsEqual(y1, y2) && + floatsEqual(x2, x3) && floatsEqual(y2, y3)) { + /*ignore the empty segment */ + continue; + } else if (floatsEqual(x3, ox) && floatsEqual(y3, oy)) { + /* if dup vertex, emit a line */ + ox = x3; + oy = y3; + matrix_map_point(matrix, x3, y3, &x3, &y3); + stroker_line_to((struct stroker *)&stroker, x3, y3); + continue; + } + ox = x3; + oy = y3; + assert(matrix_is_affine(matrix)); + matrix_map_point(matrix, x0, y0, &x0, &y0); + matrix_map_point(matrix, x1, y1, &x1, &y1); + matrix_map_point(matrix, x2, y2, &x2, &y2); + matrix_map_point(matrix, x3, y3, &x3, &y3); + stroker_curve_to((struct stroker *)&stroker, x1, y1, x2, y2, x3, y3); + } + break; + case VG_SQUAD_TO: { + data_at(&coords, p, 0, 2, data); + x0 = ox; + y0 = oy; + x1 = 2*ox-px; + y1 = 2*oy-py; + x3 = data[0]; + y3 = data[1]; + map_if_relative(ox, oy, relative, &x3, &y3); + px = x1; + py = y1; + { /* form a cubic out of it */ + x2 = (x3 + 2*x1) / 3.f; + y2 = (y3 + 2*y1) / 3.f; + x1 = (x0 + 2*x1) / 3.f; + y1 = (y0 + 2*y1) / 3.f; + } + if (floatsEqual(x1, ox) && floatsEqual(y1, oy) && + floatsEqual(x1, x2) && floatsEqual(y1, y2) && + floatsEqual(x2, x3) && floatsEqual(y2, y3)) { + /*ignore the empty segment */ + continue; + } else if (floatsEqual(x3, ox) && floatsEqual(y3, oy)) { + /* if dup vertex, emit a line */ + ox = x3; + oy = y3; + matrix_map_point(matrix, x3, y3, &x3, &y3); + stroker_line_to((struct stroker *)&stroker, x3, y3); + continue; + } + ox = x3; + oy = y3; + assert(matrix_is_affine(matrix)); + matrix_map_point(matrix, x0, y0, &x0, &y0); + matrix_map_point(matrix, x1, y1, &x1, &y1); + matrix_map_point(matrix, x2, y2, &x2, &y2); + matrix_map_point(matrix, x3, y3, &x3, &y3); + stroker_curve_to((struct stroker *)&stroker, x1, y1, x2, y2, x3, y3); + } + break; + case VG_SCUBIC_TO: { + data_at(&coords, p, 0, 4, data); + x0 = ox; + y0 = oy; + x1 = 2*ox-px; + y1 = 2*oy-py; + x2 = data[0]; + y2 = data[1]; + x3 = data[2]; + y3 = data[3]; + map_if_relative(ox, oy, relative, &x2, &y2); + map_if_relative(ox, oy, relative, &x3, &y3); + if (floatsEqual(x1, ox) && floatsEqual(y1, oy) && + floatsEqual(x1, x2) && floatsEqual(y1, y2) && + floatsEqual(x2, x3) && floatsEqual(y2, y3)) { + /*ignore the empty segment */ + continue; + } else if (floatsEqual(x3, ox) && floatsEqual(y3, oy)) { + /* if dup vertex, emit a line */ + ox = x3; + oy = y3; + matrix_map_point(matrix, x3, y3, &x3, &y3); + stroker_line_to((struct stroker *)&stroker, x3, y3); + continue; + } + ox = x3; + oy = y3; + px = x2; + py = y2; + assert(matrix_is_affine(matrix)); + matrix_map_point(matrix, x0, y0, &x0, &y0); + matrix_map_point(matrix, x1, y1, &x1, &y1); + matrix_map_point(matrix, x2, y2, &x2, &y2); + matrix_map_point(matrix, x3, y3, &x3, &y3); + stroker_curve_to((struct stroker *)&stroker, x1, y1, x2, y2, x3, y3); + } + break; + case VG_SCCWARC_TO: + case VG_SCWARC_TO: + case VG_LCCWARC_TO: + case VG_LCWARC_TO: { + VGfloat rh, rv, rot; + struct arc arc; + + data_at(&coords, p, 0, 5, data); + x0 = ox; + y0 = oy; + rh = data[0]; + rv = data[1]; + rot = data[2]; + x1 = data[3]; + y1 = data[4]; + map_if_relative(ox, oy, relative, &x1, &y1); + if (floatsEqual(x1, ox) && floatsEqual(y1, oy)) { + /* if dup vertex, emit a line */ + ox = x1; + oy = y1; + matrix_map_point(matrix, x1, y1, &x1, &y1); + stroker_line_to((struct stroker *)&stroker, x1, y1); + continue; + } + arc_init(&arc, command, x0, y0, x1, y1, + rh, rv, rot); + arc_stroke_cb(&arc, (struct stroker *)&stroker, + matrix); + ox = x1; + oy = y1; + px = x1; + py = y1; + } + break; + default: + abort(); + assert(!"Unknown segment!"); + } + } + + stroker_end((struct stroker *)&stroker); + + if (dashed) + dash_stroker_cleanup((struct dash_stroker *)&stroker); + else + stroker_cleanup((struct stroker *)&stroker); + + p->stroked.path = stroker.base.path; + p->stroked.matrix = *matrix; + p->dirty_stroke = VG_FALSE; + p->stroked.stroke_width = vg_state->stroke.line_width.f; + p->stroked.miter_limit = vg_state->stroke.miter_limit.f; + p->stroked.cap_style = vg_state->stroke.cap_style; + p->stroked.join_style = vg_state->stroke.join_style; + + return stroker.base.path; +} + +void path_render(struct path *p, VGbitfield paintModes) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *mat = &ctx->state.vg.path_user_to_surface_matrix; + + vg_validate_state(ctx); + + shader_set_drawing_image(ctx->shader, VG_FALSE); + shader_set_image(ctx->shader, 0); +#if 0 + fprintf(stderr, "Matrix(11=%f 12=%f 13=%f 21=%f 22=%f 23=%f 31=%f 32=%f 33=%f)\n", + mat->m[0], mat->m[1], mat->m[2], + mat->m[3], mat->m[4], mat->m[5], + mat->m[6], mat->m[7], mat->m[8]); +#endif + if (paintModes & VG_FILL_PATH) { + /* First the fill */ + shader_set_paint(ctx->shader, ctx->state.vg.fill_paint); + shader_bind(ctx->shader); + path_fill(p, mat); + } + + if (paintModes & VG_STROKE_PATH){ + /* 8.7.5: "line width less than or equal to 0 prevents stroking from + * taking place."*/ + if (ctx->state.vg.stroke.line_width.f <= 0) + return; + shader_set_paint(ctx->shader, ctx->state.vg.stroke_paint); + shader_bind(ctx->shader); + path_stroke(p); + } +} + +void path_fill(struct path *p, struct matrix *mat) +{ + struct vg_context *ctx = vg_current_context(); + { + struct polygon_array *polygon_array = path_get_fill_polygons(p, mat); + struct array *polys = polygon_array->array; + + if (!polygon_array || !polys || !polys->num_elements) { + return; + } + polygon_array_fill(polygon_array, ctx); + } +} + +void path_stroke(struct path *p) +{ + struct vg_context *ctx = vg_current_context(); + struct matrix *mat = &ctx->state.vg.path_user_to_surface_matrix; + VGFillRule old_fill = ctx->state.vg.fill_rule; + struct matrix identity; + struct path *stroke; + + matrix_load_identity(&identity); + stroke = path_create_stroke(p, &identity); + if (stroke && !path_is_empty(stroke)) { + ctx->state.vg.fill_rule = VG_NON_ZERO; + + path_fill(stroke, mat); + + ctx->state.vg.fill_rule = old_fill; + } +} + +void path_move_to(struct path *p, float x, float y) +{ + VGubyte segment = VG_MOVE_TO_ABS; + VGubyte common_data[sizeof(VGfloat) * 2]; + VGfloat data[2] = {x, y}; + + vg_float_to_datatype(p->datatype, common_data, data, 2); + path_append_data(p, 1, &segment, common_data); +} + +void path_line_to(struct path *p, float x, float y) +{ + VGubyte segment = VG_LINE_TO_ABS; + VGubyte common_data[sizeof(VGfloat) * 2]; + VGfloat data[2] = {x, y}; + + vg_float_to_datatype(p->datatype, common_data, data, 2); + + path_append_data(p, 1, &segment, common_data); +} + +void path_cubic_to(struct path *p, float px1, float py1, + float px2, float py2, + float x, float y) +{ + VGubyte segment = VG_CUBIC_TO_ABS; + VGubyte common_data[sizeof(VGfloat) * 6]; + VGfloat data[6]; + + data[0] = px1; data[1] = py1; + data[2] = px2; data[3] = py2; + data[4] = x; data[5] = y; + + vg_float_to_datatype(p->datatype, common_data, data, 6); + + path_append_data(p, 1, &segment, common_data); +} + +static INLINE void line_bounds(VGfloat *line /*x1,y1,x2,y2*/, + VGfloat *bounds) +{ + bounds[0] = MIN2(line[0], line[2]); + bounds[1] = MIN2(line[1], line[3]); + bounds[2] = MAX2(line[0], line[2]) - bounds[0]; + bounds[3] = MAX2(line[1], line[3]) - bounds[1]; +} + +static INLINE void unite_bounds(VGfloat *bounds, + VGfloat *el) +{ + VGfloat cx1, cy1, cx2, cy2; + VGfloat nx1, ny1, nx2, ny2; + + cx1 = bounds[0]; + cy1 = bounds[1]; + cx2 = bounds[0] + bounds[2]; + cy2 = bounds[1] + bounds[3]; + + nx1 = el[0]; + ny1 = el[1]; + nx2 = el[0] + el[2]; + ny2 = el[1] + el[3]; + + bounds[0] = MIN2(cx1, nx1); + bounds[1] = MIN2(cy1, ny1); + bounds[2] = MAX2(cx2, nx2) - bounds[0]; + bounds[3] = MAX2(cy2, ny2) - bounds[1]; +} + +static INLINE void set_bounds(VGfloat *bounds, + VGfloat *element_bounds, + VGboolean *initialized) +{ + if (!(*initialized)) { + memcpy(bounds, element_bounds, 4 * sizeof(VGfloat)); + *initialized = VG_TRUE; + } else + unite_bounds(bounds, element_bounds); +} + +void path_bounding_rect(struct path *p, float *x, float *y, + float *w, float *h) +{ + VGint i; + VGfloat coords[8]; + struct path_iter_data iter; + VGint num_coords; + VGfloat bounds[4]; + VGfloat element_bounds[4]; + VGfloat ox, oy; + VGboolean bounds_inited = VG_FALSE; + + memset(&iter, 0, sizeof(struct path_iter_data)); + memset(&bounds, 0, sizeof(bounds)); + + if (!p->num_segments) { + bounds[2] = -1; + bounds[3] = -1; + } + + + iter.path = p; + iter.coords = p->control_points->data; + + for (i = 0; i < p->num_segments; ++i) { + VGubyte segment; + iter.segment = ((VGubyte*)(p->segments->data))[i]; + + ox = iter.ox; + oy = iter.oy; + + segment = normalize_coords(&iter, &num_coords, coords); + + switch(segment) { + case VG_CLOSE_PATH: + case VG_MOVE_TO_ABS: + break; + case VG_LINE_TO_ABS: { + VGfloat line[4] = {ox, oy, coords[0], coords[1]}; + line_bounds(line, element_bounds); + set_bounds(bounds, element_bounds, &bounds_inited); + } + break; + case VG_CUBIC_TO_ABS: { + struct bezier bezier; + bezier_init(&bezier, ox, oy, + coords[0], coords[1], + coords[2], coords[3], + coords[4], coords[5]); + bezier_exact_bounds(&bezier, element_bounds); + set_bounds(bounds, element_bounds, &bounds_inited); + } + break; + case VG_SCCWARC_TO: + case VG_SCWARC_TO: + case VG_LCCWARC_TO: + case VG_LCWARC_TO: { + struct arc arc; + struct matrix identity; + struct path *path = path_create(VG_PATH_DATATYPE_F, + 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL); + + matrix_load_identity(&identity); + arc_init(&arc, segment, + ox, oy, coords[3], coords[4], + coords[0], coords[1], coords[2]); + + arc_to_path(&arc, path, &identity); + + path_bounding_rect(path, element_bounds + 0, element_bounds + 1, + element_bounds + 2, element_bounds + 3); + set_bounds(bounds, element_bounds, &bounds_inited); + } + break; + default: + assert(0); + } + } + + *x = bounds[0]; + *y = bounds[1]; + *w = bounds[2]; + *h = bounds[3]; +} + +float path_length(struct path *p, int start_segment, int num_segments) +{ + VGint i; + VGfloat coords[8]; + struct path_iter_data iter; + VGint num_coords; + VGfloat length = 0; + VGfloat ox, oy; + VGboolean in_range = VG_FALSE; + + memset(&iter, 0, sizeof(struct path_iter_data)); + + iter.path = p; + iter.coords = p->control_points->data; + + for (i = 0; i < (start_segment + num_segments); ++i) { + VGubyte segment; + + iter.segment = ((VGubyte*)(p->segments->data))[i]; + + ox = iter.ox; + oy = iter.oy; + + segment = normalize_coords(&iter, &num_coords, coords); + + in_range = (i >= start_segment) && i <= (start_segment + num_segments); + if (!in_range) + continue; + + switch(segment) { + case VG_MOVE_TO_ABS: + break; + case VG_CLOSE_PATH: { + VGfloat line[4] = {ox, oy, iter.sx, iter.sy}; + length += line_lengthv(line); + } + break; + case VG_LINE_TO_ABS: { + VGfloat line[4] = {ox, oy, coords[0], coords[1]}; + length += line_lengthv(line); + } + break; + case VG_CUBIC_TO_ABS: { + struct bezier bezier; + bezier_init(&bezier, ox, oy, + coords[0], coords[1], + coords[2], coords[3], + coords[4], coords[5]); + length += bezier_length(&bezier, BEZIER_DEFAULT_ERROR); + } + break; + case VG_SCCWARC_TO: + case VG_SCWARC_TO: + case VG_LCCWARC_TO: + case VG_LCWARC_TO: { + struct arc arc; + struct matrix identity; + struct path *path = path_create(VG_PATH_DATATYPE_F, + 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL); + + matrix_load_identity(&identity); + arc_init(&arc, segment, + ox, oy, coords[3], coords[4], + coords[0], coords[1], coords[2]); + + arc_to_path(&arc, path, &identity); + + length += path_length(path, 0, path_num_segments(path)); + } + break; + default: + assert(0); + } + } + + return length; +} + +static INLINE VGboolean point_on_current_segment(VGfloat distance, + VGfloat length, + VGfloat segment_length) +{ + return + (((floatIsZero(distance) || distance < 0) && floatIsZero(length)) || + ((distance > length || floatsEqual(distance, length)) && + (floatsEqual(distance, length + segment_length) || + distance < (length + segment_length)))); +} + +static VGboolean path_point_segment(struct path_iter_data iter, + struct path_iter_data prev_iter, + VGfloat coords[8], + VGfloat distance, + VGfloat length, VGfloat *current_length, + VGfloat *point, VGfloat *normal) +{ + switch (iter.segment) { + case VG_MOVE_TO_ABS: + break; + case VG_CLOSE_PATH: { + VGfloat line[4] = {prev_iter.ox, prev_iter.oy, iter.sx, iter.sy}; + VGboolean on_current_segment = VG_FALSE; + *current_length = line_lengthv(line); + on_current_segment = point_on_current_segment(distance, + length, + *current_length); + if (on_current_segment) { + VGfloat at = (distance - length) / line_lengthv(line); + line_normal_vector(line, normal); + line_point_at(line, at, point); + return VG_TRUE; + } + } + break; + case VG_LINE_TO_ABS: { + VGfloat line[4] = {prev_iter.ox, prev_iter.oy, coords[0], coords[1]}; + VGboolean on_current_segment = VG_FALSE; + *current_length = line_lengthv(line); + on_current_segment = point_on_current_segment(distance, + length, + *current_length); + if (on_current_segment) { + VGfloat at = (distance - length) / line_lengthv(line); + line_normal_vector(line, normal); + line_point_at(line, at, point); + return VG_TRUE; + } + } + break; + case VG_CUBIC_TO_ABS: { + struct bezier bezier; + bezier_init(&bezier, prev_iter.ox, prev_iter.oy, + coords[0], coords[1], + coords[2], coords[3], + coords[4], coords[5]); + *current_length = bezier_length(&bezier, BEZIER_DEFAULT_ERROR); + if (point_on_current_segment(distance, length, *current_length)) { + bezier_point_at_length(&bezier, distance - length, + point, normal); + return VG_TRUE; + } + } + break; + case VG_SCCWARC_TO: + case VG_SCWARC_TO: + case VG_LCCWARC_TO: + case VG_LCWARC_TO: { + struct arc arc; + struct matrix identity; + struct path *path = path_create(VG_PATH_DATATYPE_F, + 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL); + + matrix_load_identity(&identity); + arc_init(&arc, iter.segment, + prev_iter.ox, prev_iter.oy, coords[3], coords[4], + coords[0], coords[1], coords[2]); + + arc_to_path(&arc, path, &identity); + + *current_length = path_length(path, 0, path_num_segments(path)); + if (point_on_current_segment(distance, length, *current_length)) { + path_point(path, 0, path_num_segments(path), + distance - length, point, normal); + return VG_TRUE; + } + } + break; + default: + assert(0); + } + return VG_FALSE; +} + +void path_point(struct path *p, VGint start_segment, VGint num_segments, + VGfloat distance, VGfloat *point, VGfloat *normal) +{ + VGint i; + VGfloat coords[8]; + struct path_iter_data iter, prev_iter; + VGint num_coords; + VGfloat length = 0; + VGfloat current_length = 0; + + memset(&iter, 0, sizeof(struct path_iter_data)); + memset(&prev_iter, 0, sizeof(struct path_iter_data)); + + point[0] = 0; + point[1] = 0; + + normal[0] = 0; + normal[1] = -1; + + iter.path = p; + iter.coords = p->control_points->data; + if (distance < 0) + distance = 0; + + for (i = 0; i < (start_segment + num_segments); ++i) { + VGboolean outside_range = (i < start_segment || + i >= (start_segment + num_segments)); + + prev_iter = iter; + + iter.segment = ((VGubyte*)(p->segments->data))[i]; + iter.segment = normalize_coords(&iter, &num_coords, coords); + + if (outside_range) + continue; + + if (path_point_segment(iter, prev_iter, coords, + distance, length, ¤t_length, + point, normal)) + return; + + length += current_length; + } + + /* + *OpenVG 1.0 - 8.6.11 vgPointAlongPath + * + * If distance is greater than or equal to the path length + *(i.e., the value returned by vgPathLength when called with the same + *startSegment and numSegments parameters), the visual ending point of + *the path is used. + */ + { + switch (iter.segment) { + case VG_MOVE_TO_ABS: + break; + case VG_CLOSE_PATH: { + VGfloat line[4] = {prev_iter.ox, prev_iter.oy, iter.sx, iter.sy}; + line_normal_vector(line, normal); + line_point_at(line, 1.f, point); + } + break; + case VG_LINE_TO_ABS: { + VGfloat line[4] = {prev_iter.ox, prev_iter.oy, coords[0], coords[1]}; + line_normal_vector(line, normal); + line_point_at(line, 1.f, point); + } + break; + case VG_CUBIC_TO_ABS: { + struct bezier bezier; + bezier_init(&bezier, prev_iter.ox, prev_iter.oy, + coords[0], coords[1], + coords[2], coords[3], + coords[4], coords[5]); + bezier_point_at_t(&bezier, 1.f, point, normal); + } + break; + case VG_SCCWARC_TO: + case VG_SCWARC_TO: + case VG_LCCWARC_TO: + case VG_LCWARC_TO: { + struct arc arc; + struct matrix identity; + struct path *path = path_create(VG_PATH_DATATYPE_F, + 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL); + + matrix_load_identity(&identity); + arc_init(&arc, iter.segment, + prev_iter.ox, prev_iter.oy, coords[3], coords[4], + coords[0], coords[1], coords[2]); + + arc_to_path(&arc, path, &identity); + + path_point(path, 0, path_num_segments(path), + /* to make sure we're bigger than len * 2 it */ + 2 * path_length(path, 0, path_num_segments(path)), + point, normal); + } + break; + default: + assert(0); + } + } +} + +VGboolean path_is_empty(struct path *p) +{ + return p->segments->num_elements == 0; +} diff --git a/src/gallium/state_trackers/vega/path.h b/src/gallium/state_trackers/vega/path.h new file mode 100644 index 00000000000..e34538b7368 --- /dev/null +++ b/src/gallium/state_trackers/vega/path.h @@ -0,0 +1,126 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 _PATH_H +#define _PATH_H + +#include "VG/openvg.h" + +struct path; +struct polygon; +struct matrix; + +enum fill_rule { + ODD_EVEN_FILL, + WINDING_FILL +}; + + +struct path_for_each_data { + VGubyte segment; + /* all coords are absolute, even if segment is relative */ + const VGfloat *coords; + VGfloat sx, sy, ox, oy, px, py; + void *user_data; +}; + +typedef VGboolean (*path_for_each_cb)(struct path *p, + struct path_for_each_data *data); + + +struct path *path_create(VGPathDatatype dt, VGfloat scale, VGfloat bias, + VGint segmentCapacityHint, + VGint coordCapacityHint, + VGbitfield capabilities); +void path_destroy(struct path *p); + +VGbitfield path_capabilities(struct path *p); +void path_set_capabilities(struct path *p, VGbitfield bf); + +void path_append_data(struct path *p, + VGint numSegments, + const VGubyte * pathSegments, + const void * pathData); + +void path_append_path(struct path *dst, + struct path *src); + +VGint path_num_segments(struct path *p); + +void path_bounding_rect(struct path *p, float *x, float *y, + float *w, float *h); +float path_length(struct path *p, int start_segment, int num_segments); + +void path_set_fill_rule(enum fill_rule fill); +enum fill_rule path_fill_rule(enum fill_rule fill); + +VGboolean path_is_empty(struct path *p); + +VGbyte path_datatype_size(struct path *p); + +VGPathDatatype path_datatype(struct path *p); +VGfloat path_scale(struct path *p); +VGfloat path_bias(struct path *p); +VGint path_num_coords(struct path *p); + +void path_modify_coords(struct path *p, + VGint startIndex, + VGint numSegments, + const void * pathData); + +struct path *path_create_stroke(struct path *p, + struct matrix *m); + +void path_for_each_segment(struct path *path, + path_for_each_cb cb, + void *user_data); + +void path_transform(struct path *dst, struct path *src); +VGboolean path_interpolate(struct path *dst, + struct path *start, struct path *end, + VGfloat amount); + +void path_clear(struct path *p, VGbitfield capabilities); +void path_render(struct path *p, VGbitfield paintModes); +void path_fill(struct path *p, struct matrix *mat); +void path_stroke(struct path *p); + +void path_move_to(struct path *p, float x, float y); +void path_line_to(struct path *p, float x, float y); +void path_cubic_to(struct path *p, float px1, float py1, + float px2, float py2, + float x, float y); + +void path_point(struct path *p, VGint startSegment, VGint numSegments, + VGfloat distance, VGfloat *point, VGfloat *normal); + + + +void vg_float_to_datatype(VGPathDatatype datatype, + VGubyte *common_data, + const VGfloat *data, + VGint num_coords); +#endif diff --git a/src/gallium/state_trackers/vega/path_utils.h b/src/gallium/state_trackers/vega/path_utils.h new file mode 100644 index 00000000000..c2b3221dc53 --- /dev/null +++ b/src/gallium/state_trackers/vega/path_utils.h @@ -0,0 +1,109 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 PATH_UTILS_H +#define PATH_UTILS_H + +#include "VG/openvg.h" + +#define SEGMENT_COMMAND(command) /* Extract segment type */ \ + ((command) & 0x1e) +#define SEGMENT_ABS_REL(command) /* Extract absolute/relative bit */ \ + ((command) & 0x1) + +static INLINE VGint size_for_datatype(VGPathDatatype datatype) +{ + switch(datatype) { + case VG_PATH_DATATYPE_S_8: + return 1; + case VG_PATH_DATATYPE_S_16: + return 2; + case VG_PATH_DATATYPE_S_32: + return 4; + case VG_PATH_DATATYPE_F: + return 4; + default: + assert(!"unknown datatype"); + } + return 0; +} + +static INLINE VGint num_elements_for_segments(const VGubyte *segments, + VGint num_segments) +{ + VGint i; + VGint count = 0; + + for (i = 0; i < num_segments; ++i) { + VGubyte segment = segments[i]; + VGint command = SEGMENT_COMMAND(segment); + switch(command) { + case VG_CLOSE_PATH: + break; + case VG_MOVE_TO: + count += 2; + break; + case VG_LINE_TO: + count += 2; + break; + case VG_HLINE_TO: + count += 1; + break; + case VG_VLINE_TO: + count += 1; + break; + case VG_QUAD_TO: + count += 4; + break; + case VG_CUBIC_TO: + count += 6; + break; + case VG_SQUAD_TO: + count += 2; + break; + case VG_SCUBIC_TO: + count += 4; + break; + case VG_SCCWARC_TO: + count += 5; + break; + case VG_SCWARC_TO: + count += 5; + break; + case VG_LCCWARC_TO: + count += 5; + break; + case VG_LCWARC_TO: + count += 5; + break; + default: + assert(!"Unknown segment!"); + } + } + return count; +} + +#endif diff --git a/src/gallium/state_trackers/vega/polygon.c b/src/gallium/state_trackers/vega/polygon.c new file mode 100644 index 00000000000..b6d282d803b --- /dev/null +++ b/src/gallium/state_trackers/vega/polygon.c @@ -0,0 +1,550 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "polygon.h" + +#include "matrix.h" /*for floatsEqual*/ +#include "vg_context.h" +#include "vg_state.h" +#include "paint.h" +#include "renderer.h" +#include "util_array.h" +#include "VG/openvg.h" + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" +#include "pipe/p_state.h" +#include "pipe/p_inlines.h" +#include "pipe/p_screen.h" + +#include "util/u_draw_quad.h" +#include "util/u_math.h" + +#include <string.h> +#include <stdlib.h> + +#define DEBUG_POLYGON 0 + +#define COMPONENTS 2 + +struct polygon +{ + VGfloat *data; + VGint size; + + VGint num_verts; + + VGboolean dirty; + struct pipe_buffer *vbuf; + struct pipe_screen *screen; +}; + +static float *ptr_to_vertex(float *data, int idx) +{ + return data + (idx * COMPONENTS); +} + +#if 0 +static void polygon_print(struct polygon *poly) +{ + int i; + float *vert; + debug_printf("Polygon %p, size = %d\n", poly, poly->num_verts); + for (i = 0; i < poly->num_verts; ++i) { + vert = ptr_to_vertex(poly->data, i); + debug_printf("%f, %f, ", vert[0], vert[1]); + } + debug_printf("\nend\n"); +} +#endif + + +struct polygon * polygon_create(int size) +{ + struct polygon *poly = (struct polygon*)malloc(sizeof(struct polygon)); + + poly->data = malloc(sizeof(float) * COMPONENTS * size); + poly->size = size; + poly->num_verts = 0; + poly->dirty = VG_TRUE; + poly->vbuf = NULL; + + return poly; +} + +struct polygon * polygon_create_from_data(float *data, int size) +{ + struct polygon *poly = polygon_create(size); + + memcpy(poly->data, data, sizeof(float) * COMPONENTS * size); + poly->num_verts = size; + poly->dirty = VG_TRUE; + poly->vbuf = NULL; + + return poly; +} + +void polygon_destroy(struct polygon *poly) +{ + if (poly->vbuf) + pipe_buffer_reference(&poly->vbuf, NULL); + + free(poly->data); + free(poly); +} + +void polygon_resize(struct polygon *poly, int new_size) +{ + float *data = (float*)malloc(sizeof(float) * COMPONENTS * new_size); + int size = MIN2(sizeof(float) * COMPONENTS * new_size, + sizeof(float) * COMPONENTS * poly->size); + memcpy(data, poly->data, size); + free(poly->data); + poly->data = data; + poly->size = new_size; + poly->dirty = VG_TRUE; +} + +int polygon_size(struct polygon *poly) +{ + return poly->size; +} + +int polygon_vertex_count(struct polygon *poly) +{ + return poly->num_verts; +} + +float * polygon_data(struct polygon *poly) +{ + return poly->data; +} + +void polygon_vertex_append(struct polygon *p, + float x, float y) +{ + float *vert; +#if DEBUG_POLYGON + debug_printf("Append vertex [%f, %f]\n", x, y); +#endif + if (p->num_verts >= p->size) { + polygon_resize(p, p->size * 2); + } + + vert = ptr_to_vertex(p->data, p->num_verts); + vert[0] = x; + vert[1] = y; + ++p->num_verts; + p->dirty = VG_TRUE; +} + +void polygon_set_vertex(struct polygon *p, int idx, + float x, float y) +{ + float *vert; + if (idx >= p->num_verts) { + /*fixme: error reporting*/ + abort(); + return; + } + + vert = ptr_to_vertex(p->data, idx); + vert[0] = x; + vert[1] = y; + p->dirty = VG_TRUE; +} + +void polygon_vertex(struct polygon *p, int idx, + float *vertex) +{ + float *vert; + if (idx >= p->num_verts) { + /*fixme: error reporting*/ + abort(); + return; + } + + vert = ptr_to_vertex(p->data, idx); + vertex[0] = vert[0]; + vertex[1] = vert[1]; +} + +void polygon_bounding_rect(struct polygon *p, + float *rect) +{ + int i; + float minx, miny, maxx, maxy; + float *vert = ptr_to_vertex(p->data, 0); + minx = vert[0]; + maxx = vert[0]; + miny = vert[1]; + maxy = vert[1]; + + for (i = 1; i < p->num_verts; ++i) { + vert = ptr_to_vertex(p->data, i); + minx = MIN2(vert[0], minx); + miny = MIN2(vert[1], miny); + + maxx = MAX2(vert[0], maxx); + maxy = MAX2(vert[1], maxy); + } + + rect[0] = minx; + rect[1] = miny; + rect[2] = maxx - minx; + rect[3] = maxy - miny; +} + +int polygon_contains_point(struct polygon *p, + float x, float y) +{ + return 0; +} + +void polygon_append_polygon(struct polygon *dst, + struct polygon *src) +{ + if (dst->num_verts + src->num_verts >= dst->size) { + polygon_resize(dst, dst->num_verts + src->num_verts * 1.5); + } + memcpy(ptr_to_vertex(dst->data, dst->num_verts), + src->data, src->num_verts * COMPONENTS * sizeof(VGfloat)); + dst->num_verts += src->num_verts; +} + +VGboolean polygon_is_closed(struct polygon *p) +{ + VGfloat start[2], end[2]; + + polygon_vertex(p, 0, start); + polygon_vertex(p, p->num_verts - 1, end); + + return floatsEqual(start[0], end[0]) && floatsEqual(start[1], end[1]); +} + +static void set_blend_for_fill(struct pipe_blend_state *blend) +{ + memset(blend, 0, sizeof(struct pipe_blend_state)); + blend->colormask = 0; /*disable colorwrites*/ + + blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend->rgb_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA; + blend->alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA; +} + +static void draw_polygon(struct vg_context *ctx, + struct polygon *poly) +{ + int vert_size; + struct pipe_context *pipe; + struct pipe_vertex_buffer vbuffer; + struct pipe_vertex_element velement; + + vert_size = poly->num_verts * COMPONENTS * sizeof(float); + + /*polygon_print(poly);*/ + + pipe = ctx->pipe; + + if (poly->vbuf == NULL || poly->dirty) { + if (poly->vbuf) { + pipe_buffer_reference(&poly->vbuf, + NULL); + } + poly->screen = pipe->screen; + poly->vbuf= pipe_user_buffer_create(poly->screen, + poly->data, + vert_size); + poly->dirty = VG_FALSE; + } + + + /* tell pipe about the vertex buffer */ + memset(&vbuffer, 0, sizeof(vbuffer)); + vbuffer.buffer = poly->vbuf; + vbuffer.stride = COMPONENTS * sizeof(float); /* vertex size */ + vbuffer.buffer_offset = 0; + vbuffer.max_index = poly->num_verts - 1; + pipe->set_vertex_buffers(pipe, 1, &vbuffer); + + /* tell pipe about the vertex attributes */ + velement.src_offset = 0; + velement.vertex_buffer_index = 0; + velement.src_format = PIPE_FORMAT_R32G32_FLOAT; + velement.nr_components = COMPONENTS; + pipe->set_vertex_elements(pipe, 1, &velement); + + /* draw */ + pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLE_FAN, + 0, poly->num_verts); +} + +void polygon_fill(struct polygon *poly, struct vg_context *ctx) +{ + struct pipe_depth_stencil_alpha_state dsa; + struct pipe_blend_state blend; + VGfloat bounds[4]; + VGfloat min_x, min_y, max_x, max_y; + assert(poly); + polygon_bounding_rect(poly, bounds); + min_x = bounds[0]; + min_y = bounds[1]; + max_x = bounds[0] + bounds[2]; + max_y = bounds[1] + bounds[3]; + +#if DEBUG_POLYGON + debug_printf("Poly bounds are [%f, %f], [%f, %f]\n", + min_x, min_y, max_x, max_y); +#endif + + set_blend_for_fill(&blend); + + memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state)); + + cso_save_blend(ctx->cso_context); + cso_save_depth_stencil_alpha(ctx->cso_context); + + dsa.stencil[0].enabled = 1; + if (ctx->state.vg.fill_rule == VG_EVEN_ODD) { + dsa.stencil[0].writemask = 1; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INVERT; + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].ref_value = 0; + dsa.stencil[0].valuemask = ~0; + + cso_set_blend(ctx->cso_context, &blend); + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + draw_polygon(ctx, poly); + } else if (ctx->state.vg.fill_rule == VG_NON_ZERO) { + struct pipe_screen *screen = ctx->pipe->screen; + + if (screen->get_param(screen, PIPE_CAP_TWO_SIDED_STENCIL)) { + /* front */ + dsa.stencil[0].writemask = ~0; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP; + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].ref_value = 0; + dsa.stencil[0].valuemask = ~0; + + /* back */ + dsa.stencil[1].enabled = 1; + dsa.stencil[1].writemask = ~0; + dsa.stencil[1].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[1].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[1].zpass_op = PIPE_STENCIL_OP_DECR_WRAP; + dsa.stencil[1].func = PIPE_FUNC_ALWAYS; + dsa.stencil[1].ref_value = 0; + dsa.stencil[1].valuemask = ~0; + + cso_set_blend(ctx->cso_context, &blend); + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + draw_polygon(ctx, poly); + } else { + struct pipe_rasterizer_state raster; + + memcpy(&raster, &ctx->state.g3d.rasterizer, sizeof(struct pipe_rasterizer_state)); + + cso_save_rasterizer(ctx->cso_context); + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].ref_value = 0; + dsa.stencil[0].valuemask = ~0; + + raster.cull_mode = raster.front_winding ^ PIPE_WINDING_BOTH; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP; + + cso_set_blend(ctx->cso_context, &blend); + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + cso_set_rasterizer(ctx->cso_context, &raster); + draw_polygon(ctx, poly); + + raster.cull_mode = raster.front_winding; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_DECR_WRAP; + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + cso_set_rasterizer(ctx->cso_context, &raster); + draw_polygon(ctx, poly); + + cso_restore_rasterizer(ctx->cso_context); + } + } + + /* restore color writes */ + cso_restore_blend(ctx->cso_context); + /* setup stencil ops */ + dsa.stencil[0].func = PIPE_FUNC_NOTEQUAL; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE; + dsa.stencil[0].ref_value = 0; + dsa.stencil[0].valuemask = dsa.stencil[0].writemask; + dsa.stencil[1].enabled = 0; + memcpy(&dsa.depth, &ctx->state.g3d.dsa.depth, + sizeof(struct pipe_depth_state)); + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + + /* render the quad to propagate the rendering from stencil */ + renderer_draw_quad(ctx->renderer, min_x, min_y, + max_x, max_y, 0.0f/*depth should be disabled*/); + + cso_restore_depth_stencil_alpha(ctx->cso_context); +} + +void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx) +{ + struct array *polys = polyarray->array; + struct pipe_depth_stencil_alpha_state dsa; + struct pipe_blend_state blend; + VGfloat min_x = polyarray->min_x; + VGfloat min_y = polyarray->min_y; + VGfloat max_x = polyarray->max_x; + VGfloat max_y = polyarray->max_y; + VGint i; + + +#if DEBUG_POLYGON + debug_printf("%s: Poly bounds are [%f, %f], [%f, %f]\n", + __FUNCTION__, + min_x, min_y, max_x, max_y); +#endif + + set_blend_for_fill(&blend); + + memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state)); + + cso_save_blend(ctx->cso_context); + cso_save_depth_stencil_alpha(ctx->cso_context); + + dsa.stencil[0].enabled = 1; + if (ctx->state.vg.fill_rule == VG_EVEN_ODD) { + dsa.stencil[0].writemask = 1; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INVERT; + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].ref_value = 0; + dsa.stencil[0].valuemask = ~0; + + cso_set_blend(ctx->cso_context, &blend); + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + for (i = 0; i < polys->num_elements; ++i) { + struct polygon *poly = (((struct polygon**)polys->data)[i]); + draw_polygon(ctx, poly); + } + } else if (ctx->state.vg.fill_rule == VG_NON_ZERO) { + struct pipe_screen *screen = ctx->pipe->screen; + + if (screen->get_param(screen, PIPE_CAP_TWO_SIDED_STENCIL)) { + /* front */ + dsa.stencil[0].writemask = ~0; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP; + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].ref_value = 0; + dsa.stencil[0].valuemask = ~0; + + /* back */ + dsa.stencil[1].enabled = 1; + dsa.stencil[1].writemask = ~0; + dsa.stencil[1].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[1].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[1].zpass_op = PIPE_STENCIL_OP_DECR_WRAP; + dsa.stencil[1].func = PIPE_FUNC_ALWAYS; + dsa.stencil[1].ref_value = 0; + dsa.stencil[1].valuemask = ~0; + + cso_set_blend(ctx->cso_context, &blend); + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + for (i = 0; i < polys->num_elements; ++i) { + struct polygon *poly = (((struct polygon**)polys->data)[i]); + draw_polygon(ctx, poly); + } + } else { + struct pipe_rasterizer_state raster; + + memcpy(&raster, &ctx->state.g3d.rasterizer, sizeof(struct pipe_rasterizer_state)); + + cso_save_rasterizer(ctx->cso_context); + dsa.stencil[0].func = PIPE_FUNC_ALWAYS; + dsa.stencil[0].ref_value = 0; + dsa.stencil[0].valuemask = ~0; + + raster.cull_mode = raster.front_winding ^ PIPE_WINDING_BOTH; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP; + + cso_set_blend(ctx->cso_context, &blend); + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + cso_set_rasterizer(ctx->cso_context, &raster); + for (i = 0; i < polys->num_elements; ++i) { + struct polygon *poly = (((struct polygon**)polys->data)[i]); + draw_polygon(ctx, poly); + } + + raster.cull_mode = raster.front_winding; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_DECR_WRAP; + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + cso_set_rasterizer(ctx->cso_context, &raster); + for (i = 0; i < polys->num_elements; ++i) { + struct polygon *poly = (((struct polygon**)polys->data)[i]); + draw_polygon(ctx, poly); + } + + cso_restore_rasterizer(ctx->cso_context); + } + } + + /* restore color writes */ + cso_restore_blend(ctx->cso_context); + /* setup stencil ops */ + dsa.stencil[0].func = PIPE_FUNC_NOTEQUAL; + dsa.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE; + dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE; + dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE; + dsa.stencil[0].ref_value = 0; + dsa.stencil[0].valuemask = dsa.stencil[0].writemask; + dsa.stencil[1].enabled = 0; + memcpy(&dsa.depth, &ctx->state.g3d.dsa.depth, + sizeof(struct pipe_depth_state)); + cso_set_depth_stencil_alpha(ctx->cso_context, &dsa); + + /* render the quad to propagate the rendering from stencil */ + renderer_draw_quad(ctx->renderer, min_x, min_y, + max_x, max_y, 0.0f/*depth should be disabled*/); + + cso_restore_depth_stencil_alpha(ctx->cso_context); +} diff --git a/src/gallium/state_trackers/vega/polygon.h b/src/gallium/state_trackers/vega/polygon.h new file mode 100644 index 00000000000..22672b728ed --- /dev/null +++ b/src/gallium/state_trackers/vega/polygon.h @@ -0,0 +1,75 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 POLYGON_H +#define POLYGON_H + +#include "VG/openvg.h" + +struct polygon; +struct vg_context; +struct vg_paint; +struct array; + +struct polygon *polygon_create(int size); +struct polygon *polygon_create_from_data(float *data, int size); +void polygon_destroy(struct polygon *poly); + +void polygon_resize(struct polygon *poly, int new_size); +int polygon_size(struct polygon *poly); + +int polygon_vertex_count(struct polygon *poly); +float * polygon_data(struct polygon *poly); + +void polygon_vertex_append(struct polygon *p, + float x, float y); +void polygon_append_polygon(struct polygon *dst, + struct polygon *src); +void polygon_set_vertex(struct polygon *p, int idx, + float x, float y); +void polygon_vertex(struct polygon *p, int idx, + float *vertex); + +void polygon_bounding_rect(struct polygon *p, + float *rect); +int polygon_contains_point(struct polygon *p, + float x, float y); + +VGboolean polygon_is_closed(struct polygon *p); + +void polygon_fill(struct polygon *p, struct vg_context *pipe); + +/* TODO: make a file/module around this struct + */ +struct polygon_array { + struct array *array; + VGfloat min_x, max_x; + VGfloat min_y, max_y; +}; + +void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx); + +#endif diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c new file mode 100644 index 00000000000..f7c5f2f0cdf --- /dev/null +++ b/src/gallium/state_trackers/vega/renderer.c @@ -0,0 +1,592 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "renderer.h" + +#include "vg_context.h" + +#include "pipe/p_context.h" +#include "pipe/p_state.h" +#include "pipe/p_inlines.h" +#include "pipe/p_screen.h" +#include "pipe/p_shader_tokens.h" + +#include "util/u_draw_quad.h" +#include "util/u_simple_shaders.h" +#include "util/u_memory.h" + +#include "cso_cache/cso_context.h" + +struct renderer { + struct pipe_context *pipe; + struct vg_context *owner; + + struct cso_context *cso; + + void *fs; + + VGfloat vertices[4][2][4]; +}; + +static void setup_shaders(struct renderer *ctx) +{ + struct pipe_context *pipe = ctx->pipe; + /* fragment shader */ + ctx->fs = util_make_fragment_tex_shader(pipe); +} + +static struct pipe_buffer * +setup_vertex_data(struct renderer *ctx, + float x0, float y0, float x1, float y1, float z) +{ + ctx->vertices[0][0][0] = x0; + ctx->vertices[0][0][1] = y0; + ctx->vertices[0][0][2] = z; + ctx->vertices[0][1][0] = 0.0f; /*s*/ + ctx->vertices[0][1][1] = 0.0f; /*t*/ + + ctx->vertices[1][0][0] = x1; + ctx->vertices[1][0][1] = y0; + ctx->vertices[1][0][2] = z; + ctx->vertices[1][1][0] = 1.0f; /*s*/ + ctx->vertices[1][1][1] = 0.0f; /*t*/ + + ctx->vertices[2][0][0] = x1; + ctx->vertices[2][0][1] = y1; + ctx->vertices[2][0][2] = z; + ctx->vertices[2][1][0] = 1.0f; + ctx->vertices[2][1][1] = 1.0f; + + ctx->vertices[3][0][0] = x0; + ctx->vertices[3][0][1] = y1; + ctx->vertices[3][0][2] = z; + ctx->vertices[3][1][0] = 0.0f; + ctx->vertices[3][1][1] = 1.0f; + + return pipe_user_buffer_create( ctx->pipe->screen, + ctx->vertices, + sizeof(ctx->vertices) ); +} + +static struct pipe_buffer * +setup_vertex_data_tex(struct renderer *ctx, + float x0, float y0, float x1, float y1, + float s0, float t0, float s1, float t1, + float z) +{ + ctx->vertices[0][0][0] = x0; + ctx->vertices[0][0][1] = y0; + ctx->vertices[0][0][2] = z; + ctx->vertices[0][1][0] = s0; /*s*/ + ctx->vertices[0][1][1] = t0; /*t*/ + + ctx->vertices[1][0][0] = x1; + ctx->vertices[1][0][1] = y0; + ctx->vertices[1][0][2] = z; + ctx->vertices[1][1][0] = s1; /*s*/ + ctx->vertices[1][1][1] = t0; /*t*/ + + ctx->vertices[2][0][0] = x1; + ctx->vertices[2][0][1] = y1; + ctx->vertices[2][0][2] = z; + ctx->vertices[2][1][0] = s1; + ctx->vertices[2][1][1] = t1; + + ctx->vertices[3][0][0] = x0; + ctx->vertices[3][0][1] = y1; + ctx->vertices[3][0][2] = z; + ctx->vertices[3][1][0] = s0; + ctx->vertices[3][1][1] = t1; + + return pipe_user_buffer_create( ctx->pipe->screen, + ctx->vertices, + sizeof(ctx->vertices) ); +} + + +static struct pipe_buffer * +setup_vertex_data_qtex(struct renderer *ctx, + float x0, float y0, float x1, float y1, + float x2, float y2, float x3, float y3, + float s0, float t0, float s1, float t1, + float z) +{ + ctx->vertices[0][0][0] = x0; + ctx->vertices[0][0][1] = y0; + ctx->vertices[0][0][2] = z; + ctx->vertices[0][1][0] = s0; /*s*/ + ctx->vertices[0][1][1] = t0; /*t*/ + + ctx->vertices[1][0][0] = x1; + ctx->vertices[1][0][1] = y1; + ctx->vertices[1][0][2] = z; + ctx->vertices[1][1][0] = s1; /*s*/ + ctx->vertices[1][1][1] = t0; /*t*/ + + ctx->vertices[2][0][0] = x2; + ctx->vertices[2][0][1] = y2; + ctx->vertices[2][0][2] = z; + ctx->vertices[2][1][0] = s1; + ctx->vertices[2][1][1] = t1; + + ctx->vertices[3][0][0] = x3; + ctx->vertices[3][0][1] = y3; + ctx->vertices[3][0][2] = z; + ctx->vertices[3][1][0] = s0; + ctx->vertices[3][1][1] = t1; + + return pipe_user_buffer_create( ctx->pipe->screen, + ctx->vertices, + sizeof(ctx->vertices) ); +} + +struct renderer * renderer_create(struct vg_context *owner) +{ + VGint i; + struct renderer *renderer = CALLOC_STRUCT(renderer); + + if (!renderer) + return NULL; + + renderer->owner = owner; + renderer->pipe = owner->pipe; + renderer->cso = owner->cso_context; + + setup_shaders(renderer); + + /* init vertex data that doesn't change */ + for (i = 0; i < 4; i++) { + renderer->vertices[i][0][3] = 1.0f; /* w */ + renderer->vertices[i][1][2] = 0.0f; /* r */ + renderer->vertices[i][1][3] = 1.0f; /* q */ + } + + return renderer; +} + +void renderer_destroy(struct renderer *ctx) +{ +#if 0 + if (ctx->fs) { + cso_delete_fragment_shader(ctx->cso, ctx->fs); + ctx->fs = NULL; + } +#endif + free(ctx); +} + +void renderer_draw_quad(struct renderer *r, + VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2, + VGfloat depth) +{ + struct pipe_buffer *buf; + + buf = setup_vertex_data(r, x1, y1, x2, y2, depth); + + if (buf) { + util_draw_vertex_buffer(r->pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 2); /* attribs/vert */ + + pipe_buffer_reference( &buf, + NULL ); + } +} + +void renderer_draw_texture(struct renderer *r, + struct pipe_texture *tex, + VGfloat x1offset, VGfloat y1offset, + VGfloat x2offset, VGfloat y2offset, + VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2) +{ + struct pipe_context *pipe = r->pipe; + struct pipe_buffer *buf; + VGfloat s0, t0, s1, t1; + + assert(tex->width[0] != 0); + assert(tex->height[0] != 0); + + s0 = x1offset / tex->width[0]; + s1 = x2offset / tex->width[0]; + t0 = y1offset / tex->height[0]; + t1 = y2offset / tex->height[0]; + + cso_save_vertex_shader(r->cso); + /* shaders */ + cso_set_vertex_shader_handle(r->cso, vg_texture_vs(r->owner)); + + /* draw quad */ + buf = setup_vertex_data_tex(r, x1, y1, x2, y2, + s0, t0, s1, t1, 0.0f); + + if (buf) { + util_draw_vertex_buffer(pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 2); /* attribs/vert */ + + pipe_buffer_reference( &buf, + NULL ); + } + + cso_restore_vertex_shader(r->cso); +} + +void renderer_copy_texture(struct renderer *ctx, + struct pipe_texture *src, + VGfloat sx1, VGfloat sy1, + VGfloat sx2, VGfloat sy2, + struct pipe_texture *dst, + VGfloat dx1, VGfloat dy1, + VGfloat dx2, VGfloat dy2) +{ + struct pipe_context *pipe = ctx->pipe; + struct pipe_screen *screen = pipe->screen; + struct pipe_buffer *buf; + struct pipe_surface *dst_surf = screen->get_tex_surface( + screen, dst, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + struct pipe_framebuffer_state fb; + float s0, t0, s1, t1; + + assert(src->width[0] != 0); + assert(src->height[0] != 0); + assert(dst->width[0] != 0); + assert(dst->height[0] != 0); + +#if 0 + debug_printf("copy texture [%f, %f, %f, %f], [%f, %f, %f, %f]\n", + sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2); +#endif + +#if 1 + s0 = sx1 / src->width[0]; + s1 = sx2 / src->width[0]; + t0 = sy1 / src->height[0]; + t1 = sy2 / src->height[0]; +#else + s0 = 0; + s1 = 1; + t0 = 0; + t1 = 1; +#endif + + assert(screen->is_format_supported(screen, dst_surf->format, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)); + + /* save state (restored below) */ + cso_save_blend(ctx->cso); + cso_save_samplers(ctx->cso); + cso_save_sampler_textures(ctx->cso); + cso_save_framebuffer(ctx->cso); + cso_save_fragment_shader(ctx->cso); + cso_save_vertex_shader(ctx->cso); + + cso_save_viewport(ctx->cso); + + + /* set misc state we care about */ + { + struct pipe_blend_state blend; + memset(&blend, 0, sizeof(blend)); + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.colormask = PIPE_MASK_RGBA; + cso_set_blend(ctx->cso, &blend); + } + + /* sampler */ + { + struct pipe_sampler_state sampler; + memset(&sampler, 0, sizeof(sampler)); + sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; + sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; + sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; + sampler.normalized_coords = 1; + cso_single_sampler(ctx->cso, 0, &sampler); + cso_single_sampler_done(ctx->cso); + } + + vg_set_viewport(ctx->owner, VEGA_Y0_TOP); + + /* texture */ + cso_set_sampler_textures(ctx->cso, 1, &src); + + /* shaders */ + cso_set_vertex_shader_handle(ctx->cso, vg_texture_vs(ctx->owner)); + cso_set_fragment_shader_handle(ctx->cso, ctx->fs); + + /* drawing dest */ + memset(&fb, 0, sizeof(fb)); + fb.width = dst_surf->width; + fb.height = dst_surf->height; + fb.nr_cbufs = 1; + fb.cbufs[0] = dst_surf; + { + VGint i; + for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) + fb.cbufs[i] = 0; + } + cso_set_framebuffer(ctx->cso, &fb); + + /* draw quad */ + buf = setup_vertex_data_tex(ctx, + dx1, dy1, + dx2, dy2, + s0, t0, s1, t1, + 0.0f); + + if (buf) { + util_draw_vertex_buffer(ctx->pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 2); /* attribs/vert */ + + pipe_buffer_reference( &buf, + NULL ); + } + + /* restore state we changed */ + cso_restore_blend(ctx->cso); + cso_restore_samplers(ctx->cso); + cso_restore_sampler_textures(ctx->cso); + cso_restore_framebuffer(ctx->cso); + cso_restore_vertex_shader(ctx->cso); + cso_restore_fragment_shader(ctx->cso); + cso_restore_viewport(ctx->cso); + + pipe_surface_reference(&dst_surf, NULL); +} + +void renderer_copy_surface(struct renderer *ctx, + struct pipe_surface *src, + int srcX0, int srcY0, + int srcX1, int srcY1, + struct pipe_surface *dst, + int dstX0, int dstY0, + int dstX1, int dstY1, + float z, unsigned filter) +{ + struct pipe_context *pipe = ctx->pipe; + struct pipe_screen *screen = pipe->screen; + struct pipe_buffer *buf; + struct pipe_texture texTemp, *tex; + struct pipe_surface *texSurf; + struct pipe_framebuffer_state fb; + struct st_framebuffer *stfb = ctx->owner->draw_buffer; + const int srcW = abs(srcX1 - srcX0); + const int srcH = abs(srcY1 - srcY0); + const int srcLeft = MIN2(srcX0, srcX1); + const int srcTop = MIN2(srcY0, srcY1); + + assert(filter == PIPE_TEX_MIPFILTER_NEAREST || + filter == PIPE_TEX_MIPFILTER_LINEAR); + + if (srcLeft != srcX0) { + /* left-right flip */ + int tmp = dstX0; + dstX0 = dstX1; + dstX1 = tmp; + } + + if (srcTop != srcY0) { + /* up-down flip */ + int tmp = dstY0; + dstY0 = dstY1; + dstY1 = tmp; + } + + assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_SAMPLER, 0)); + assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_SAMPLER, 0)); + assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)); + + /* + * XXX for now we're always creating a temporary texture. + * Strictly speaking that's not always needed. + */ + + /* create temp texture */ + memset(&texTemp, 0, sizeof(texTemp)); + texTemp.target = PIPE_TEXTURE_2D; + texTemp.format = src->format; + texTemp.last_level = 0; + texTemp.width[0] = srcW; + texTemp.height[0] = srcH; + texTemp.depth[0] = 1; + pf_get_block(src->format, &texTemp.block); + + tex = screen->texture_create(screen, &texTemp); + if (!tex) + return; + + texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* load temp texture */ + pipe->surface_copy(pipe, + texSurf, 0, 0, /* dest */ + src, srcLeft, srcTop, /* src */ + srcW, srcH); /* size */ + + /* free the surface, update the texture if necessary.*/ + screen->tex_surface_destroy(texSurf); + + /* save state (restored below) */ + cso_save_blend(ctx->cso); + cso_save_samplers(ctx->cso); + cso_save_sampler_textures(ctx->cso); + cso_save_framebuffer(ctx->cso); + cso_save_fragment_shader(ctx->cso); + cso_save_vertex_shader(ctx->cso); + cso_save_viewport(ctx->cso); + + /* set misc state we care about */ + { + struct pipe_blend_state blend; + memset(&blend, 0, sizeof(blend)); + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.colormask = PIPE_MASK_RGBA; + cso_set_blend(ctx->cso, &blend); + } + + vg_set_viewport(ctx->owner, VEGA_Y0_TOP); + + /* sampler */ + { + struct pipe_sampler_state sampler; + memset(&sampler, 0, sizeof(sampler)); + sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; + sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; + sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; + sampler.normalized_coords = 1; + cso_single_sampler(ctx->cso, 0, &sampler); + cso_single_sampler_done(ctx->cso); + } + + /* texture */ + cso_set_sampler_textures(ctx->cso, 1, &tex); + + /* shaders */ + cso_set_fragment_shader_handle(ctx->cso, ctx->fs); + cso_set_vertex_shader_handle(ctx->cso, vg_texture_vs(ctx->owner)); + + /* drawing dest */ + if (stfb->strb->surface != dst) { + memset(&fb, 0, sizeof(fb)); + fb.width = dst->width; + fb.height = dst->height; + fb.nr_cbufs = 1; + fb.cbufs[0] = dst; + fb.zsbuf = stfb->dsrb->surface; + cso_set_framebuffer(ctx->cso, &fb); + } + + /* draw quad */ + buf = setup_vertex_data(ctx, + (float) dstX0, (float) dstY0, + (float) dstX1, (float) dstY1, z); + + if (buf) { + util_draw_vertex_buffer(ctx->pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 2); /* attribs/vert */ + + pipe_buffer_reference( &buf, + NULL ); + } + + + /* restore state we changed */ + cso_restore_blend(ctx->cso); + cso_restore_samplers(ctx->cso); + cso_restore_sampler_textures(ctx->cso); + cso_restore_framebuffer(ctx->cso); + cso_restore_fragment_shader(ctx->cso); + cso_restore_vertex_shader(ctx->cso); + cso_restore_viewport(ctx->cso); + + pipe_texture_reference(&tex, NULL); +} + +void renderer_texture_quad(struct renderer *r, + struct pipe_texture *tex, + VGfloat x1offset, VGfloat y1offset, + VGfloat x2offset, VGfloat y2offset, + VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2, + VGfloat x3, VGfloat y3, + VGfloat x4, VGfloat y4) +{ + struct pipe_context *pipe = r->pipe; + struct pipe_buffer *buf; + VGfloat s0, t0, s1, t1; + + assert(tex->width[0] != 0); + assert(tex->height[0] != 0); + + s0 = x1offset / tex->width[0]; + s1 = x2offset / tex->width[0]; + t0 = y1offset / tex->height[0]; + t1 = y2offset / tex->height[0]; + + cso_save_vertex_shader(r->cso); + /* shaders */ + cso_set_vertex_shader_handle(r->cso, vg_texture_vs(r->owner)); + + /* draw quad */ + buf = setup_vertex_data_qtex(r, x1, y1, x2, y2, x3, y3, x4, y4, + s0, t0, s1, t1, 0.0f); + + if (buf) { + util_draw_vertex_buffer(pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 2); /* attribs/vert */ + + pipe_buffer_reference(&buf, + NULL); + } + + cso_restore_vertex_shader(r->cso); +} diff --git a/src/gallium/state_trackers/vega/renderer.h b/src/gallium/state_trackers/vega/renderer.h new file mode 100644 index 00000000000..990cd32c313 --- /dev/null +++ b/src/gallium/state_trackers/vega/renderer.h @@ -0,0 +1,76 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 RENDERER_H +#define RENDERER_H + +#include "VG/openvg.h" + +struct renderer; + +struct vg_context; +struct pipe_texture; +struct pipe_surface; + +struct renderer *renderer_create(struct vg_context *owner); +void renderer_destroy(struct renderer *); + +void renderer_draw_quad(struct renderer *, + VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2, + VGfloat depth); +void renderer_draw_texture(struct renderer *, + struct pipe_texture *texture, + VGfloat x1offset, VGfloat y1offset, + VGfloat x2offset, VGfloat y2offset, + VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2); +void renderer_texture_quad(struct renderer *, + struct pipe_texture *texture, + VGfloat x1offset, VGfloat y1offset, + VGfloat x2offset, VGfloat y2offset, + VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2, + VGfloat x3, VGfloat y3, + VGfloat x4, VGfloat y4); +void renderer_copy_texture(struct renderer *r, + struct pipe_texture *src, + VGfloat sx1, VGfloat sy1, + VGfloat sx2, VGfloat sy2, + struct pipe_texture *dst, + VGfloat dx1, VGfloat dy1, + VGfloat dx2, VGfloat dy2); +void renderer_copy_surface(struct renderer *r, + struct pipe_surface *src, + int sx1, int sy1, + int sx2, int sy2, + struct pipe_surface *dst, + int dx1, int dy1, + int dx2, int dy2, + float z, unsigned filter); + + +#endif diff --git a/src/gallium/state_trackers/vega/shader.c b/src/gallium/state_trackers/vega/shader.c new file mode 100644 index 00000000000..d9074a377b3 --- /dev/null +++ b/src/gallium/state_trackers/vega/shader.c @@ -0,0 +1,310 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "shader.h" + +#include "vg_context.h" +#include "shaders_cache.h" +#include "paint.h" +#include "mask.h" +#include "image.h" + +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "pipe/p_state.h" +#include "pipe/p_inlines.h" +#include "util/u_memory.h" + +#define MAX_CONSTANTS 20 + +struct shader { + struct vg_context *context; + + VGboolean masking; + struct vg_paint *paint; + struct vg_image *image; + + VGboolean drawing_image; + VGImageMode image_mode; + + float constants[MAX_CONSTANTS]; + struct pipe_constant_buffer cbuf; + struct pipe_shader_state fs_state; + void *fs; +}; + +struct shader * shader_create(struct vg_context *ctx) +{ + struct shader *shader = 0; + + shader = CALLOC_STRUCT(shader); + shader->context = ctx; + + return shader; +} + +void shader_destroy(struct shader *shader) +{ + free(shader); +} + +void shader_set_masking(struct shader *shader, VGboolean set) +{ + shader->masking = set; +} + +VGboolean shader_is_masking(struct shader *shader) +{ + return shader->masking; +} + +void shader_set_paint(struct shader *shader, struct vg_paint *paint) +{ + shader->paint = paint; +} + +struct vg_paint * shader_paint(struct shader *shader) +{ + return shader->paint; +} + + +static void setup_constant_buffer(struct shader *shader) +{ + struct vg_context *ctx = shader->context; + struct pipe_context *pipe = shader->context->pipe; + struct pipe_constant_buffer *cbuf = &shader->cbuf; + VGint param_bytes = paint_constant_buffer_size(shader->paint); + float temp_buf[MAX_CONSTANTS]; + + assert(param_bytes <= sizeof(temp_buf)); + paint_fill_constant_buffer(shader->paint, temp_buf); + + if (cbuf->buffer == NULL || + memcmp(temp_buf, shader->constants, param_bytes) != 0) + { + pipe_buffer_reference(&cbuf->buffer, NULL); + + memcpy(shader->constants, temp_buf, param_bytes); + cbuf->buffer = pipe_user_buffer_create(pipe->screen, + &shader->constants, + sizeof(shader->constants)); + } + + ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, cbuf); +} + +static VGint blend_bind_samplers(struct vg_context *ctx, + struct pipe_sampler_state **samplers, + struct pipe_texture **textures) +{ + VGBlendMode bmode = ctx->state.vg.blend_mode; + + if (bmode == VG_BLEND_MULTIPLY || + bmode == VG_BLEND_SCREEN || + bmode == VG_BLEND_DARKEN || + bmode == VG_BLEND_LIGHTEN) { + struct st_framebuffer *stfb = ctx->draw_buffer; + + vg_prepare_blend_surface(ctx); + + samplers[2] = &ctx->blend_sampler; + textures[2] = stfb->blend_texture; + + if (!samplers[0] || !textures[0]) { + samplers[1] = samplers[2]; + textures[1] = textures[2]; + } + if (!samplers[1] || !textures[1]) { + samplers[1] = samplers[0]; + textures[1] = textures[0]; + } + + return 1; + } + return 0; +} + +static void setup_samplers(struct shader *shader) +{ + struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; + struct pipe_texture *textures[PIPE_MAX_SAMPLERS]; + struct vg_context *ctx = shader->context; + /* a little wonky: we use the num as a boolean that just says + * whether any sampler/textures have been set. the actual numbering + * for samplers is always the same: + * 0 - paint sampler/texture for gradient/pattern + * 1 - mask sampler/texture + * 2 - blend sampler/texture + * 3 - image sampler/texture + * */ + VGint num = 0; + + samplers[0] = NULL; + samplers[1] = NULL; + samplers[2] = NULL; + samplers[3] = NULL; + textures[0] = NULL; + textures[1] = NULL; + textures[2] = NULL; + textures[3] = NULL; + + num += paint_bind_samplers(shader->paint, samplers, textures); + num += mask_bind_samplers(samplers, textures); + num += blend_bind_samplers(ctx, samplers, textures); + if (shader->drawing_image && shader->image) + num += image_bind_samplers(shader->image, samplers, textures); + + if (num) { + cso_set_samplers(ctx->cso_context, 4, (const struct pipe_sampler_state **)samplers); + cso_set_sampler_textures(ctx->cso_context, 4, textures); + } +} + +static INLINE VGboolean is_format_bw(struct shader *shader) +{ +#if 0 + struct vg_context *ctx = shader->context; + struct st_framebuffer *stfb = ctx->draw_buffer; +#endif + + if (shader->drawing_image && shader->image) { + if (shader->image->format == VG_BW_1) + return VG_TRUE; + } + + return VG_FALSE; +} + +static void setup_shader_program(struct shader *shader) +{ + struct vg_context *ctx = shader->context; + VGint shader_id = 0; + VGBlendMode blend_mode = ctx->state.vg.blend_mode; + VGboolean black_white = is_format_bw(shader); + + /* 1st stage: fill */ + if (!shader->drawing_image || + (shader->image_mode == VG_DRAW_IMAGE_MULTIPLY || shader->image_mode == VG_DRAW_IMAGE_STENCIL)) { + switch(paint_type(shader->paint)) { + case VG_PAINT_TYPE_COLOR: + shader_id |= VEGA_SOLID_FILL_SHADER; + break; + case VG_PAINT_TYPE_LINEAR_GRADIENT: + shader_id |= VEGA_LINEAR_GRADIENT_SHADER; + break; + case VG_PAINT_TYPE_RADIAL_GRADIENT: + shader_id |= VEGA_RADIAL_GRADIENT_SHADER; + break; + case VG_PAINT_TYPE_PATTERN: + shader_id |= VEGA_PATTERN_SHADER; + break; + + default: + abort(); + } + } + + /* second stage image */ + if (shader->drawing_image) { + switch(shader->image_mode) { + case VG_DRAW_IMAGE_NORMAL: + shader_id |= VEGA_IMAGE_NORMAL_SHADER; + break; + case VG_DRAW_IMAGE_MULTIPLY: + shader_id |= VEGA_IMAGE_MULTIPLY_SHADER; + break; + case VG_DRAW_IMAGE_STENCIL: + shader_id |= VEGA_IMAGE_STENCIL_SHADER; + break; + default: + debug_printf("Unknown image mode!"); + } + } + + if (shader->masking) + shader_id |= VEGA_MASK_SHADER; + + switch(blend_mode) { + case VG_BLEND_MULTIPLY: + shader_id |= VEGA_BLEND_MULTIPLY_SHADER; + break; + case VG_BLEND_SCREEN: + shader_id |= VEGA_BLEND_SCREEN_SHADER; + break; + case VG_BLEND_DARKEN: + shader_id |= VEGA_BLEND_DARKEN_SHADER; + break; + case VG_BLEND_LIGHTEN: + shader_id |= VEGA_BLEND_LIGHTEN_SHADER; + break; + default: + /* handled by pipe_blend_state */ + break; + } + + if (black_white) + shader_id |= VEGA_BW_SHADER; + + shader->fs = shaders_cache_fill(ctx->sc, shader_id); + cso_set_fragment_shader_handle(ctx->cso_context, shader->fs); +} + + +void shader_bind(struct shader *shader) +{ + /* first resolve the real paint type */ + paint_resolve_type(shader->paint); + + setup_constant_buffer(shader); + setup_samplers(shader); + setup_shader_program(shader); +} + +void shader_set_image_mode(struct shader *shader, VGImageMode image_mode) +{ + shader->image_mode = image_mode; +} + +VGImageMode shader_image_mode(struct shader *shader) +{ + return shader->image_mode; +} + +void shader_set_drawing_image(struct shader *shader, VGboolean drawing_image) +{ + shader->drawing_image = drawing_image; +} + +VGboolean shader_drawing_image(struct shader *shader) +{ + return shader->drawing_image; +} + +void shader_set_image(struct shader *shader, struct vg_image *img) +{ + shader->image = img; +} diff --git a/src/gallium/state_trackers/vega/shader.h b/src/gallium/state_trackers/vega/shader.h new file mode 100644 index 00000000000..847eee6a310 --- /dev/null +++ b/src/gallium/state_trackers/vega/shader.h @@ -0,0 +1,56 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 SHADER_H +#define SHADER_H + +#include "VG/openvg.h" + +struct shader; +struct vg_paint; +struct vg_context; +struct vg_image; + +struct shader *shader_create(struct vg_context *context); +void shader_destroy(struct shader *shader); + +void shader_set_masking(struct shader *shader, VGboolean set); +VGboolean shader_is_masking(struct shader *shader); + +void shader_set_paint(struct shader *shader, struct vg_paint *paint); +struct vg_paint *shader_paint(struct shader *shader); + +void shader_set_image_mode(struct shader *shader, VGImageMode image_mode); +VGImageMode shader_image_mode(struct shader *shader); + +void shader_set_drawing_image(struct shader *shader, VGboolean drawing_image); +VGboolean shader_drawing_image(struct shader *shader); + +void shader_set_image(struct shader *shader, struct vg_image *img); + +void shader_bind(struct shader *shader); + +#endif diff --git a/src/gallium/state_trackers/vega/shaders_cache.c b/src/gallium/state_trackers/vega/shaders_cache.c new file mode 100644 index 00000000000..fd0831fab1f --- /dev/null +++ b/src/gallium/state_trackers/vega/shaders_cache.c @@ -0,0 +1,439 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "shaders_cache.h" + +#include "vg_context.h" + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/p_screen.h" +#include "pipe/p_shader_tokens.h" + +#include "tgsi/tgsi_build.h" +#include "tgsi/tgsi_dump.h" +#include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_util.h" +#include "tgsi/tgsi_text.h" + +#include "util/u_memory.h" +#include "util/u_math.h" +#include "util/u_debug.h" +#include "cso_cache/cso_hash.h" +#include "cso_cache/cso_context.h" + +#include "VG/openvg.h" + +#include "asm_fill.h" + +/* Essentially we construct an ubber-shader based on the state + * of the pipeline. The stages are: + * 1) Fill (mandatory, solid color/gradient/pattern/image draw) + * 2) Image composition (image mode multiply and stencil) + * 3) Mask + * 4) Extended blend (multiply/screen/darken/lighten) + * 5) Premultiply/Unpremultiply + * 6) Color transform (to black and white) + */ +#define SHADER_STAGES 6 + +struct cached_shader { + void *driver_shader; + struct pipe_shader_state state; +}; + +struct shaders_cache { + struct vg_context *pipe; + + struct cso_hash *hash; +}; + + +static INLINE struct tgsi_token *tokens_from_assembly(const char *txt, int num_tokens) +{ + struct tgsi_token *tokens; + + tokens = (struct tgsi_token *) MALLOC(num_tokens * sizeof(tokens[0])); + + tgsi_text_translate(txt, tokens, num_tokens); + +#if DEBUG_SHADERS + tgsi_dump(tokens, 0); +#endif + + return tokens; +} + +#define ALL_FILLS (VEGA_SOLID_FILL_SHADER | \ + VEGA_LINEAR_GRADIENT_SHADER | \ + VEGA_RADIAL_GRADIENT_SHADER | \ + VEGA_PATTERN_SHADER | \ + VEGA_IMAGE_NORMAL_SHADER) + + +/* +static const char max_shader_preamble[] = + "FRAG1.1\n" + "DCL IN[0], POSITION, LINEAR\n" + "DCL IN[1], GENERIC[0], PERSPECTIVE\n" + "DCL OUT[0], COLOR, CONSTANT\n" + "DCL CONST[0..9], CONSTANT\n" + "DCL TEMP[0..9], CONSTANT\n" + "DCL SAMP[0..9], CONSTANT\n"; + + max_shader_preamble strlen == 175 +*/ +#define MAX_PREAMBLE 175 + +static INLINE VGint range_min(VGint min, VGint current) +{ + if (min < 0) + min = current; + else + min = MIN2(min, current); + return min; +} + +static INLINE VGint range_max(VGint max, VGint current) +{ + return MAX2(max, current); +} + +static void +create_preamble(char *txt, + const struct shader_asm_info *shaders[SHADER_STAGES], + int num_shaders) +{ + VGboolean declare_input = VG_FALSE; + VGint start_const = -1, end_const = 0; + VGint start_temp = -1, end_temp = 0; + VGint start_sampler = -1, end_sampler = 0; + VGint i; + VGint num_consts, num_temps, num_samplers; + + for (i = 0; i < num_shaders; ++i) { + if (shaders[i]->num_consts) + start_const = range_min(start_const, shaders[i]->start_const); + if (shaders[i]->num_temps) + start_temp = range_min(start_temp, shaders[i]->start_temp); + if (shaders[i]->num_samplers) + start_sampler = range_min(start_sampler, shaders[i]->start_sampler); + + end_const = range_max(end_const, shaders[i]->start_const + + shaders[i]->num_consts); + end_temp = range_max(end_temp, shaders[i]->start_temp + + shaders[i]->num_temps); + end_sampler = range_max(end_sampler, shaders[i]->start_sampler + + shaders[i]->num_samplers); + if (shaders[i]->needs_position) + declare_input = VG_TRUE; + } + /* if they're still unitialized, initialize them */ + if (start_const < 0) + start_const = 0; + if (start_temp < 0) + start_temp = 0; + if (start_sampler < 0) + start_sampler = 0; + + num_consts = end_const - start_const; + num_temps = end_temp - start_temp; + num_samplers = end_sampler - start_sampler; + /* end exclusive */ + --end_const; + --end_temp; + --end_sampler; + + sprintf(txt, "FRAG1.1\n"); + + if (declare_input) { + sprintf(txt + strlen(txt), "DCL IN[0], POSITION, LINEAR\n"); + sprintf(txt + strlen(txt), "DCL IN[1], GENERIC[0], PERSPECTIVE\n"); + } + + /* we always have a color output */ + sprintf(txt + strlen(txt), "DCL OUT[0], COLOR, CONSTANT\n"); + + if (num_consts > 1) + sprintf(txt + strlen(txt), "DCL CONST[%d..%d], CONSTANT\n", start_const, end_const); + else if (num_consts == 1) + sprintf(txt + strlen(txt), "DCL CONST[%d], CONSTANT\n", start_const); + + if (num_temps > 1) + sprintf(txt + strlen(txt), "DCL TEMP[%d..%d], CONSTANT\n", start_temp, end_temp); + else if (num_temps > 1) + sprintf(txt + strlen(txt), "DCL TEMP[%d], CONSTANT\n", start_temp); + + if (num_samplers > 1) + sprintf(txt + strlen(txt), "DCL SAMP[%d..%d], CONSTANT\n", start_sampler, end_sampler); + else if (num_samplers == 1) + sprintf(txt + strlen(txt), "DCL SAMP[%d], CONSTANT\n", start_sampler); +} + +static void * +combine_shaders(const struct shader_asm_info *shaders[SHADER_STAGES], int num_shaders, + struct pipe_context *pipe, + struct pipe_shader_state *shader) +{ + char *combined_txt; + int combined_len = MAX_PREAMBLE; + int combined_tokens = 0; + int i = 0; + int current_shader = 0; + int current_len; + + for (i = 0; i < num_shaders; ++i) { + combined_len += strlen(shaders[i]->txt); + combined_tokens += shaders[i]->num_tokens; + } + /* add for the %s->TEMP[0] substitutions */ + combined_len += num_shaders * 7 /*TEMP[0]*/ + 4 /*"END\n"*/; + + combined_txt = (char*)malloc(combined_len); + combined_txt[0] = '\0'; + + create_preamble(combined_txt, shaders, num_shaders); + + while (current_shader < num_shaders) { + const char temp[] = "TEMP[0]"; + const char out[] = "OUT[0]"; + const char *subst = temp; + + current_len = strlen(combined_txt); + + /* if the last shader then output */ + if (current_shader + 1 == num_shaders) + subst = out; + + snprintf(combined_txt + current_len, + combined_len - current_len, + shaders[current_shader]->txt, + subst); + ++current_shader; + } + + + current_len = strlen(combined_txt); + snprintf(combined_txt + current_len, + combined_len - current_len, + "END\n"); + + debug_printf("Combined shader is : \n%s\n", + combined_txt); + + shader->tokens = tokens_from_assembly( + combined_txt, combined_tokens); + + free(combined_txt); + + return pipe->create_fs_state(pipe, shader); +} + +static void * +create_shader(struct pipe_context *pipe, + int id, + struct pipe_shader_state *shader) +{ + int idx = 0; + const struct shader_asm_info * shaders[SHADER_STAGES]; + + /* the shader has to have a fill */ + debug_assert(id & ALL_FILLS); + + /* first stage */ + if (id & VEGA_SOLID_FILL_SHADER) { + debug_assert(idx == 0); + shaders[idx] = &shaders_asm[0]; + debug_assert(shaders_asm[0].id == VEGA_SOLID_FILL_SHADER); + ++idx; + } + if ((id & VEGA_LINEAR_GRADIENT_SHADER)) { + debug_assert(idx == 0); + shaders[idx] = &shaders_asm[1]; + debug_assert(shaders_asm[1].id == VEGA_LINEAR_GRADIENT_SHADER); + ++idx; + } + if ((id & VEGA_RADIAL_GRADIENT_SHADER)) { + debug_assert(idx == 0); + shaders[idx] = &shaders_asm[2]; + debug_assert(shaders_asm[2].id == VEGA_RADIAL_GRADIENT_SHADER); + ++idx; + } + if ((id & VEGA_PATTERN_SHADER)) { + debug_assert(idx == 0); + debug_assert(shaders_asm[3].id == VEGA_PATTERN_SHADER); + shaders[idx] = &shaders_asm[3]; + ++idx; + } + if ((id & VEGA_IMAGE_NORMAL_SHADER)) { + debug_assert(idx == 0); + debug_assert(shaders_asm[4].id == VEGA_IMAGE_NORMAL_SHADER); + shaders[idx] = &shaders_asm[4]; + ++idx; + } + + /* second stage */ + if ((id & VEGA_IMAGE_MULTIPLY_SHADER)) { + debug_assert(shaders_asm[5].id == VEGA_IMAGE_MULTIPLY_SHADER); + shaders[idx] = &shaders_asm[5]; + ++idx; + } else if ((id & VEGA_IMAGE_STENCIL_SHADER)) { + debug_assert(shaders_asm[6].id == VEGA_IMAGE_STENCIL_SHADER); + shaders[idx] = &shaders_asm[6]; + ++idx; + } + + /* third stage */ + if ((id & VEGA_MASK_SHADER)) { + debug_assert(idx == 1); + debug_assert(shaders_asm[7].id == VEGA_MASK_SHADER); + shaders[idx] = &shaders_asm[7]; + ++idx; + } + + /* fourth stage */ + if ((id & VEGA_BLEND_MULTIPLY_SHADER)) { + debug_assert(shaders_asm[8].id == VEGA_BLEND_MULTIPLY_SHADER); + shaders[idx] = &shaders_asm[8]; + ++idx; + } else if ((id & VEGA_BLEND_SCREEN_SHADER)) { + debug_assert(shaders_asm[9].id == VEGA_BLEND_SCREEN_SHADER); + shaders[idx] = &shaders_asm[9]; + ++idx; + } else if ((id & VEGA_BLEND_DARKEN_SHADER)) { + debug_assert(shaders_asm[10].id == VEGA_BLEND_DARKEN_SHADER); + shaders[idx] = &shaders_asm[10]; + ++idx; + } else if ((id & VEGA_BLEND_LIGHTEN_SHADER)) { + debug_assert(shaders_asm[11].id == VEGA_BLEND_LIGHTEN_SHADER); + shaders[idx] = &shaders_asm[11]; + ++idx; + } + + /* fifth stage */ + if ((id & VEGA_PREMULTIPLY_SHADER)) { + debug_assert(shaders_asm[12].id == VEGA_PREMULTIPLY_SHADER); + shaders[idx] = &shaders_asm[12]; + ++idx; + } else if ((id & VEGA_UNPREMULTIPLY_SHADER)) { + debug_assert(shaders_asm[13].id == VEGA_UNPREMULTIPLY_SHADER); + shaders[idx] = &shaders_asm[13]; + ++idx; + } + + /* sixth stage */ + if ((id & VEGA_BW_SHADER)) { + debug_assert(shaders_asm[14].id == VEGA_BW_SHADER); + shaders[idx] = &shaders_asm[14]; + ++idx; + } + + return combine_shaders(shaders, idx, pipe, shader); +} + +/*************************************************/ + +struct shaders_cache * shaders_cache_create(struct vg_context *vg) +{ + struct shaders_cache *sc = CALLOC_STRUCT(shaders_cache); + + sc->pipe = vg; + sc->hash = cso_hash_create(); + + return sc; +} + +void shaders_cache_destroy(struct shaders_cache *sc) +{ + struct cso_hash_iter iter = cso_hash_first_node(sc->hash); + + while (!cso_hash_iter_is_null(iter)) { + struct cached_shader *cached = + (struct cached_shader *)cso_hash_iter_data(iter); + cso_delete_fragment_shader(sc->pipe->cso_context, + cached->driver_shader); + iter = cso_hash_erase(sc->hash, iter); + } + + cso_hash_delete(sc->hash); + free(sc); +} + +void * shaders_cache_fill(struct shaders_cache *sc, + int shader_key) +{ + VGint key = shader_key; + struct cached_shader *cached; + struct cso_hash_iter iter = cso_hash_find(sc->hash, key); + + if (cso_hash_iter_is_null(iter)) { + cached = CALLOC_STRUCT(cached_shader); + cached->driver_shader = create_shader(sc->pipe->pipe, key, &cached->state); + + cso_hash_insert(sc->hash, key, cached); + + return cached->driver_shader; + } + + cached = (struct cached_shader *)cso_hash_iter_data(iter); + + assert(cached->driver_shader); + return cached->driver_shader; +} + +struct vg_shader * shader_create_from_text(struct pipe_context *pipe, + const char *txt, int num_tokens, + int type) +{ + struct vg_shader *shader = (struct vg_shader *)malloc( + sizeof(struct vg_shader)); + struct tgsi_token *tokens = tokens_from_assembly(txt, num_tokens); + struct pipe_shader_state state; + + debug_assert(type == PIPE_SHADER_VERTEX || + type == PIPE_SHADER_FRAGMENT); + + state.tokens = tokens; + shader->type = type; + shader->tokens = tokens; + + if (type == PIPE_SHADER_FRAGMENT) + shader->driver = pipe->create_fs_state(pipe, &state); + else + shader->driver = pipe->create_vs_state(pipe, &state); + return shader; +} + +void vg_shader_destroy(struct vg_context *ctx, struct vg_shader *shader) +{ + if (shader->type == PIPE_SHADER_FRAGMENT) + cso_delete_fragment_shader(ctx->cso_context, shader->driver); + else + cso_delete_vertex_shader(ctx->cso_context, shader->driver); + free(shader->tokens); + free(shader); +} diff --git a/src/gallium/state_trackers/vega/shaders_cache.h b/src/gallium/state_trackers/vega/shaders_cache.h new file mode 100644 index 00000000000..feca58b61a9 --- /dev/null +++ b/src/gallium/state_trackers/vega/shaders_cache.h @@ -0,0 +1,77 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 SHADERS_CACHE_H +#define SHADERS_CACHE_H + + +struct vg_context; +struct pipe_context; +struct tgsi_token; +struct shaders_cache; + +enum VegaShaderType { + VEGA_SOLID_FILL_SHADER = 1 << 0, + VEGA_LINEAR_GRADIENT_SHADER = 1 << 1, + VEGA_RADIAL_GRADIENT_SHADER = 1 << 2, + VEGA_PATTERN_SHADER = 1 << 3, + VEGA_IMAGE_NORMAL_SHADER = 1 << 4, + VEGA_IMAGE_MULTIPLY_SHADER = 1 << 5, + VEGA_IMAGE_STENCIL_SHADER = 1 << 6, + + VEGA_MASK_SHADER = 1 << 7, + + VEGA_BLEND_MULTIPLY_SHADER = 1 << 8, + VEGA_BLEND_SCREEN_SHADER = 1 << 9, + VEGA_BLEND_DARKEN_SHADER = 1 << 10, + VEGA_BLEND_LIGHTEN_SHADER = 1 << 11, + + VEGA_PREMULTIPLY_SHADER = 1 << 12, + VEGA_UNPREMULTIPLY_SHADER = 1 << 13, + + VEGA_BW_SHADER = 1 << 14 +}; + +struct vg_shader { + void *driver; + struct tgsi_token *tokens; + int type;/* PIPE_SHADER_VERTEX, PIPE_SHADER_FRAGMENT */ +}; + +struct shaders_cache *shaders_cache_create(struct vg_context *pipe); +void shaders_cache_destroy(struct shaders_cache *sc); +void *shaders_cache_fill(struct shaders_cache *sc, + int shader_key); + +struct vg_shader *shader_create_from_text(struct pipe_context *pipe, + const char *txt, int num_tokens, + int type); + +void vg_shader_destroy(struct vg_context *ctx, struct vg_shader *shader); + + + +#endif diff --git a/src/gallium/state_trackers/vega/st_inlines.h b/src/gallium/state_trackers/vega/st_inlines.h new file mode 100644 index 00000000000..1f331dfcdb7 --- /dev/null +++ b/src/gallium/state_trackers/vega/st_inlines.h @@ -0,0 +1,159 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * 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 VMWARE 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. + * + **************************************************************************/ + +/** + * Functions for checking if buffers/textures are referenced when we need + * to read/write from/to them. Flush when needed. + */ + +#ifndef ST_INLINES_H +#define ST_INLINES_H + +#include "vg_context.h" + +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/p_state.h" + +static INLINE struct pipe_transfer * +st_cond_flush_get_tex_transfer(struct vg_context *st, + struct pipe_texture *pt, + unsigned int face, + unsigned int level, + unsigned int zslice, + enum pipe_transfer_usage usage, + unsigned int x, unsigned int y, + unsigned int w, unsigned int h) +{ + struct pipe_screen *screen = st->pipe->screen; + struct pipe_context *pipe = st->pipe; + unsigned referenced = + pipe->is_texture_referenced(pipe, pt, face, level); + + if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) || + usage == PIPE_TRANSFER_WRITE || + usage == PIPE_TRANSFER_READ_WRITE)) + vgFlush(); + + return screen->get_tex_transfer(screen, pt, face, level, zslice, usage, + x, y, w, h); +} + +static INLINE struct pipe_transfer * +st_no_flush_get_tex_transfer(struct vg_context *st, + struct pipe_texture *pt, + unsigned int face, + unsigned int level, + unsigned int zslice, + enum pipe_transfer_usage usage, + unsigned int x, unsigned int y, + unsigned int w, unsigned int h) +{ + struct pipe_screen *screen = st->pipe->screen; + + return screen->get_tex_transfer(screen, pt, face, level, + zslice, usage, x, y, w, h); +} + +static INLINE void * +st_cond_flush_pipe_buffer_map(struct vg_context *st, + struct pipe_buffer *buf, + unsigned int map_flags) +{ + struct pipe_context *pipe = st->pipe; + unsigned int referenced = pipe->is_buffer_referenced(pipe, buf); + + if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) || + (map_flags & PIPE_BUFFER_USAGE_CPU_WRITE))) + vgFlush(); + + return pipe_buffer_map(pipe->screen, buf, map_flags); +} + +static INLINE void * +st_no_flush_pipe_buffer_map(struct vg_context *st, + struct pipe_buffer *buf, + unsigned int map_flags) +{ + return pipe_buffer_map(st->pipe->screen, buf, map_flags); +} + + +static INLINE void +st_cond_flush_pipe_buffer_write(struct vg_context *st, + struct pipe_buffer *buf, + unsigned int offset, + unsigned int size, + const void * data) +{ + struct pipe_context *pipe = st->pipe; + + if (pipe->is_buffer_referenced(pipe, buf)) + vgFlush(); + + pipe_buffer_write(pipe->screen, buf, offset, size, data); +} + +static INLINE void +st_no_flush_pipe_buffer_write(struct vg_context *st, + struct pipe_buffer *buf, + unsigned int offset, + unsigned int size, + const void * data) +{ + pipe_buffer_write(st->pipe->screen, buf, offset, size, data); +} + +static INLINE void +st_cond_flush_pipe_buffer_read(struct vg_context *st, + struct pipe_buffer *buf, + unsigned int offset, + unsigned int size, + void * data) +{ + struct pipe_context *pipe = st->pipe; + + if (pipe->is_buffer_referenced(pipe, buf) & PIPE_REFERENCED_FOR_WRITE) + vgFlush(); + + pipe_buffer_read(pipe->screen, buf, offset, size, data); +} + +static INLINE void +st_no_flush_pipe_buffer_read(struct vg_context *st, + struct pipe_buffer *buf, + unsigned int offset, + unsigned int size, + void * data) +{ + pipe_buffer_read(st->pipe->screen, buf, offset, size, data); +} + +#endif + diff --git a/src/gallium/state_trackers/vega/stroker.c b/src/gallium/state_trackers/vega/stroker.c new file mode 100644 index 00000000000..1b92d2b5c62 --- /dev/null +++ b/src/gallium/state_trackers/vega/stroker.c @@ -0,0 +1,1349 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "stroker.h" + +#include "path.h" +#include "vg_state.h" +#include "util_array.h" +#include "arc.h" +#include "bezier.h" +#include "matrix.h" +#include "path_utils.h" +#include "polygon.h" + +#include "math.h" + +#ifndef M_2PI +#define M_2PI 6.28318530717958647692528676655900576 +#endif + +#define STROKE_SEGMENTS 0 +#define STROKE_DEBUG 0 +#define DEBUG_EMITS 0 + +static const VGfloat curve_threshold = 0.25f; + +static const VGfloat zero_coords[] = {0.f, 0.f}; + +enum intersection_type { + NoIntersections, + BoundedIntersection, + UnboundedIntersection, +}; + +enum line_join_mode { + FlatJoin, + SquareJoin, + MiterJoin, + RoundJoin, + RoundCap +}; + +struct stroke_iterator { + void (*next)(struct stroke_iterator *); + VGboolean (*has_next)(struct stroke_iterator *); + + VGPathCommand (*current_command)(struct stroke_iterator *it); + void (*current_coords)(struct stroke_iterator *it, VGfloat *coords); + + VGint position; + VGint coord_position; + + const VGubyte *cmds; + const VGfloat *coords; + VGint num_commands; + VGint num_coords; + + struct polygon *curve_poly; + VGint curve_index; +}; + +static VGPathCommand stroke_itr_command(struct stroke_iterator *itr) +{ + return itr->current_command(itr); +} + +static void stroke_itr_coords(struct stroke_iterator *itr, VGfloat *coords) +{ + itr->current_coords(itr, coords); +} + +static void stroke_fw_itr_coords(struct stroke_iterator *itr, VGfloat *coords) +{ + if (itr->position >= itr->num_commands) + return; + switch (stroke_itr_command(itr)) { + case VG_MOVE_TO_ABS: + coords[0] = itr->coords[itr->coord_position]; + coords[1] = itr->coords[itr->coord_position + 1]; + break; + case VG_LINE_TO_ABS: + coords[0] = itr->coords[itr->coord_position]; + coords[1] = itr->coords[itr->coord_position + 1]; + break; + case VG_CUBIC_TO_ABS: + coords[0] = itr->coords[itr->coord_position]; + coords[1] = itr->coords[itr->coord_position + 1]; + coords[2] = itr->coords[itr->coord_position + 2]; + coords[3] = itr->coords[itr->coord_position + 3]; + coords[4] = itr->coords[itr->coord_position + 4]; + coords[5] = itr->coords[itr->coord_position + 5]; + break; + default: + debug_assert(!"invalid command!\n"); + } +} + + +static void stroke_bw_itr_coords(struct stroke_iterator *itr, VGfloat *coords) +{ + if (itr->position >= itr->num_commands) + return; + switch (stroke_itr_command(itr)) { + case VG_MOVE_TO_ABS: + coords[0] = itr->coords[itr->coord_position]; + coords[1] = itr->coords[itr->coord_position + 1]; + break; + case VG_LINE_TO_ABS: + coords[0] = itr->coords[itr->coord_position]; + coords[1] = itr->coords[itr->coord_position + 1]; + break; + case VG_CUBIC_TO_ABS: + coords[0] = itr->coords[itr->coord_position + 4]; + coords[1] = itr->coords[itr->coord_position + 5]; + coords[2] = itr->coords[itr->coord_position + 2]; + coords[3] = itr->coords[itr->coord_position + 3]; + coords[4] = itr->coords[itr->coord_position + 0]; + coords[5] = itr->coords[itr->coord_position + 1]; + break; + default: + debug_assert(!"invalid command!\n"); + } +} + + +static VGPathCommand stroke_fw_current_command(struct stroke_iterator *it) +{ + return it->cmds[it->position]; +} + +static VGPathCommand stroke_bw_current_command(struct stroke_iterator *it) +{ + VGPathCommand prev_cmd; + if (it->position == it->num_commands -1) + return VG_MOVE_TO_ABS; + + prev_cmd = it->cmds[it->position + 1]; + return prev_cmd; +} + +static VGboolean stroke_fw_has_next(struct stroke_iterator *itr) +{ + return itr->position < (itr->num_commands - 1); +} + +static VGboolean stroke_bw_has_next(struct stroke_iterator *itr) +{ + return itr->position > 0; +} + +static void stroke_fw_next(struct stroke_iterator *itr) +{ + VGubyte cmd; + debug_assert(stroke_fw_has_next(itr)); + + cmd = stroke_itr_command(itr); + + itr->coord_position += num_elements_for_segments(&cmd, 1); + ++itr->position; +} + +static void stroke_bw_next(struct stroke_iterator *itr) +{ + VGubyte cmd; + debug_assert(stroke_bw_has_next(itr)); + + --itr->position; + cmd = stroke_itr_command(itr); + + itr->coord_position -= num_elements_for_segments(&cmd, 1); +} + +static void stroke_itr_common_init(struct stroke_iterator *itr, + struct array *cmds, + struct array *coords) +{ + itr->cmds = (VGubyte*)cmds->data; + itr->num_commands = cmds->num_elements; + + itr->coords = (VGfloat*)coords->data; + itr->num_coords = coords->num_elements; +} + +static void stroke_forward_iterator(struct stroke_iterator *itr, + struct array *cmds, + struct array *coords) +{ + stroke_itr_common_init(itr, cmds, coords); + itr->position = 0; + itr->coord_position = 0; + + itr->next = stroke_fw_next; + itr->has_next = stroke_fw_has_next; + itr->current_command = stroke_fw_current_command; + itr->current_coords = stroke_fw_itr_coords; +} + +static void stroke_backward_iterator(struct stroke_iterator *itr, + struct array *cmds, + struct array *coords) +{ + VGubyte cmd; + stroke_itr_common_init(itr, cmds, coords); + itr->position = itr->num_commands - 1; + + cmd = stroke_bw_current_command(itr); + itr->coord_position = itr->num_coords - + num_elements_for_segments(&cmd, 1); + + itr->next = stroke_bw_next; + itr->has_next = stroke_bw_has_next; + itr->current_command = stroke_bw_current_command; + itr->current_coords = stroke_bw_itr_coords; +} + + + +static void stroke_flat_next(struct stroke_iterator *itr) +{ + VGubyte cmd; + + if (itr->curve_index >= 0) { + ++itr->curve_index; + if (itr->curve_index >= polygon_vertex_count(itr->curve_poly)) { + itr->curve_index = -1; + polygon_destroy(itr->curve_poly); + itr->curve_poly = 0; + } else + return; + } + debug_assert(stroke_fw_has_next(itr)); + + cmd = itr->cmds[itr->position]; + itr->coord_position += num_elements_for_segments(&cmd, 1); + ++itr->position; + + cmd = itr->cmds[itr->position]; + + if (cmd == VG_CUBIC_TO_ABS) { + struct bezier bezier; + VGfloat bez[8]; + + bez[0] = itr->coords[itr->coord_position - 2]; + bez[1] = itr->coords[itr->coord_position - 1]; + bez[2] = itr->coords[itr->coord_position]; + bez[3] = itr->coords[itr->coord_position + 1]; + bez[4] = itr->coords[itr->coord_position + 2]; + bez[5] = itr->coords[itr->coord_position + 3]; + bez[6] = itr->coords[itr->coord_position + 4]; + bez[7] = itr->coords[itr->coord_position + 5]; + + bezier_init(&bezier, + bez[0], bez[1], + bez[2], bez[3], + bez[4], bez[5], + bez[6], bez[7]); + /* skip the first one, it's the same as the prev point */ + itr->curve_index = 1; + if (itr->curve_poly) { + polygon_destroy(itr->curve_poly); + itr->curve_poly = 0; + } + itr->curve_poly = bezier_to_polygon(&bezier); + } +} + +static VGboolean stroke_flat_has_next(struct stroke_iterator *itr) +{ + return (itr->curve_index >= 0 && + itr->curve_index < (polygon_vertex_count(itr->curve_poly)-1)) + || itr->position < (itr->num_commands - 1); +} + +static VGPathCommand stroke_flat_current_command(struct stroke_iterator *it) +{ + if (it->cmds[it->position] == VG_CUBIC_TO_ABS) { + return VG_LINE_TO_ABS; + } + return it->cmds[it->position]; +} + +static void stroke_flat_itr_coords(struct stroke_iterator *itr, VGfloat *coords) +{ + if (itr->curve_index <= -1 && itr->position >= itr->num_commands) + return; + + if (itr->curve_index >= 0) { + polygon_vertex(itr->curve_poly, itr->curve_index, + coords); + return; + } + + switch (stroke_itr_command(itr)) { + case VG_MOVE_TO_ABS: + coords[0] = itr->coords[itr->coord_position]; + coords[1] = itr->coords[itr->coord_position + 1]; + break; + case VG_LINE_TO_ABS: + coords[0] = itr->coords[itr->coord_position]; + coords[1] = itr->coords[itr->coord_position + 1]; + break; + case VG_CUBIC_TO_ABS: + default: + debug_assert(!"invalid command!\n"); + } +} + +static void stroke_flat_iterator(struct stroke_iterator *itr, + struct array *cmds, + struct array *coords) +{ + stroke_itr_common_init(itr, cmds, coords); + itr->position = 0; + itr->coord_position = 0; + + itr->next = stroke_flat_next; + itr->has_next = stroke_flat_has_next; + itr->current_command = stroke_flat_current_command; + itr->current_coords = stroke_flat_itr_coords; + itr->curve_index = -1; + itr->curve_poly = 0; +} + + +static INLINE VGboolean finite_coords4(const VGfloat *c) +{ + return + isfinite(c[0]) && isfinite(c[1]) && + isfinite(c[2]) && isfinite(c[3]); +} + +/* from Graphics Gems II */ +#define SAME_SIGNS(a, b) ((a) * (b) >= 0) +static VGboolean do_lines_intersect(VGfloat x1, VGfloat y1, VGfloat x2, VGfloat y2, + VGfloat x3, VGfloat y3, VGfloat x4, VGfloat y4) +{ + VGfloat a1, a2, b1, b2, c1, c2; /* Coefficients of line eqns */ + VGfloat r1, r2, r3, r4; /* 'sign' values */ + + a1 = y2 - y1; + b1 = x1 - x2; + c1 = x2 * y1 - x1 * y2; + + r3 = a1 * x3 + b1 * y3 + c1; + r4 = a1 * x4 + b1 * y4 + c1; + + if (r3 != 0 && r4 != 0 && SAME_SIGNS(r3, r4)) + return VG_FALSE; + + a2 = y4 - y3; + b2 = x3 - x4; + c2 = x4 * y3 - x3 * y4; + + r1 = a2 * x1 + b2 * y1 + c2; + r2 = a2 * x2 + b2 * y2 + c2; + + if (r1 != 0 && r2 != 0 && SAME_SIGNS(r1, r2)) + return VG_FALSE; + + return VG_TRUE; +} + +static INLINE VGfloat line_dx(const VGfloat *l) +{ + return l[2] - l[0]; +} + +static INLINE VGfloat line_dy(const VGfloat *l) +{ + return l[3] - l[1]; +} + +static INLINE VGfloat line_angle(const VGfloat *l) +{ + const VGfloat dx = line_dx(l); + const VGfloat dy = line_dy(l); + + const VGfloat theta = atan2(-dy, dx) * 360.0 / M_2PI; + + const VGfloat theta_normalized = theta < 0 ? theta + 360 : theta; + + if (floatsEqual(theta_normalized, 360.f)) + return 0; + else + return theta_normalized; +} + +static INLINE void line_set_length(VGfloat *l, VGfloat len) +{ + VGfloat uv[] = {l[0], l[1], l[2], l[3]}; + if (null_line(l)) + return; + line_normalize(uv); + l[2] = l[0] + line_dx(uv) * len; + l[3] = l[1] + line_dy(uv) * len; +} + +static INLINE void line_translate(VGfloat *l, VGfloat x, VGfloat y) +{ + l[0] += x; + l[1] += y; + l[2] += x; + l[3] += y; +} + +static INLINE VGfloat line_angle_to(const VGfloat *l1, + const VGfloat *l2) +{ + VGfloat a1, a2, delta, delta_normalized; + if (null_line(l1) || null_line(l1)) + return 0; + + a1 = line_angle(l1); + a2 = line_angle(l2); + + delta = a2 - a1; + delta_normalized = delta < 0 ? delta + 360 : delta; + + if (floatsEqual(delta, 360.f)) + return 0; + else + return delta_normalized; +} + +static INLINE VGfloat line_angles(const VGfloat *l1, + const VGfloat *l2) +{ + VGfloat cos_line, rad = 0; + + if (null_line(l1) || null_line(l2)) + return 0; + + cos_line = (line_dx(l1)*line_dx(l2) + line_dy(l1)*line_dy(l2)) / + (line_lengthv(l1)*line_lengthv(l2)); + rad = 0; + + if (cos_line >= -1.0 && cos_line <= 1.0) + rad = acos(cos_line); + return rad * 360 / M_2PI; +} + + +static INLINE VGfloat adapted_angle_on_x(const VGfloat *line) +{ + const VGfloat identity[] = {0, 0, 1, 0}; + VGfloat angle = line_angles(line, identity); + if (line_dy(line) > 0) + angle = 360 - angle; + return angle; +} + +static enum intersection_type line_intersect(const VGfloat *l1, + const VGfloat *l2, + float *intersection_point) +{ + VGfloat isect[2]; + enum intersection_type type; + VGboolean dx_zero, ldx_zero; + + if (null_line(l1) || null_line(l2) || + !finite_coords4(l1) || !finite_coords4(l2)) + return NoIntersections; + + type = do_lines_intersect(l1[0], l1[1], l1[2], l1[3], l2[0], l2[1], l2[2], l2[3]) + ? BoundedIntersection : UnboundedIntersection; + + dx_zero = floatsEqual(line_dx(l1) + 1, 1); + ldx_zero = floatsEqual(line_dx(l2) + 1, 1); + + /* one of the lines is vertical */ + if (dx_zero && ldx_zero) { + type = NoIntersections; + } else if (dx_zero) { + VGfloat la = line_dy(l2) / line_dx(l2); + isect[0] = l1[0]; + isect[1] = la * l1[0] + l2[1] - la * l2[0]; + } else if (ldx_zero) { + VGfloat ta = line_dy(l1) / line_dx(l1); + isect[0] = l2[0]; + isect[1] = ta * l2[0] + l1[1] - ta*l1[0]; + } else { + VGfloat x; + VGfloat ta = line_dy(l1) / line_dx(l1); + VGfloat la = line_dy(l2) / line_dx(l2); + if (ta == la) + return NoIntersections; + + x = ( - l2[1] + la * l2[0] + l1[1] - ta * l1[0] ) / (la - ta); + isect[0] = x; + isect[1] = ta*(x - l1[0]) + l1[1]; + } + if (intersection_point) { + intersection_point[0] = isect[0]; + intersection_point[1] = isect[1]; + } + return type; +} + +static INLINE enum line_join_mode stroker_join_mode(struct stroker *s) +{ + switch(s->join_style) { + case VG_JOIN_MITER: + return MiterJoin; + case VG_JOIN_ROUND: + return RoundJoin; + case VG_JOIN_BEVEL: + return FlatJoin; + default: + return FlatJoin; + } +} + +static INLINE enum line_join_mode stroker_cap_mode(struct stroker *s) +{ + switch(s->cap_style) { + case VG_CAP_BUTT: + return FlatJoin; + case VG_CAP_ROUND: + return RoundCap; + case VG_CAP_SQUARE: + return SquareJoin; + default: + return FlatJoin; + } +} + +void stroker_emit_move_to(struct stroker *stroker, VGfloat x, VGfloat y) +{ + VGubyte cmds = VG_MOVE_TO_ABS; + VGfloat coords[2] = {x, y}; +#if DEBUG_EMITS + debug_printf("emit move %f, %f\n", x, y); +#endif + stroker->back2_x = stroker->back1_x; + stroker->back2_y = stroker->back1_y; + stroker->back1_x = x; + stroker->back1_y = y; + + path_append_data(stroker->path, + 1, + &cmds, &coords); +} + +void stroker_emit_line_to(struct stroker *stroker, VGfloat x, VGfloat y) +{ + VGubyte cmds = VG_LINE_TO_ABS; + VGfloat coords[2] = {x, y}; +#if DEBUG_EMITS + debug_printf("emit line %f, %f\n", x, y); +#endif + stroker->back2_x = stroker->back1_x; + stroker->back2_y = stroker->back1_y; + stroker->back1_x = x; + stroker->back1_y = y; + path_append_data(stroker->path, + 1, + &cmds, &coords); +} + +void stroker_emit_curve_to(struct stroker *stroker, VGfloat px1, VGfloat py1, + VGfloat px2, VGfloat py2, + VGfloat x, VGfloat y) +{ + VGubyte cmds = VG_CUBIC_TO_ABS; + VGfloat coords[6] = {px1, py1, px2, py2, x, y}; +#if DEBUG_EMITS + debug_printf("emit curve %f, %f, %f, %f, %f, %f\n", px1, py1, + px2, py2, x, y); +#endif + + if (px2 == x && py2 == y) { + if (px1 == x && py1 == y) { + stroker->back2_x = stroker->back1_x; + stroker->back2_y = stroker->back1_y; + } else { + stroker->back2_x = px1; + stroker->back2_y = py1; + } + } else { + stroker->back2_x = px2; + stroker->back2_y = py2; + } + stroker->back1_x = x; + stroker->back1_y = y; + + path_append_data(stroker->path, + 1, + &cmds, &coords); +} + +static INLINE void create_round_join(struct stroker *stroker, + VGfloat x1, VGfloat y1, + VGfloat x2, VGfloat y2, + VGfloat width, VGfloat height) +{ + struct arc arc; + struct matrix matrix; + + matrix_load_identity(&matrix); + + /*stroker_emit_line_to(stroker, nx, ny);*/ + + arc_init(&arc, VG_SCCWARC_TO_ABS, + x1, y1, x2, y2, width/2, height/2, 0); + arc_stroker_emit(&arc, stroker, &matrix); +} + + +static void create_joins(struct stroker *stroker, + VGfloat focal_x, VGfloat focal_y, + const VGfloat *next_line, enum line_join_mode join) +{ +#if DEBUG_EMITS + debug_printf("create_joins: focal=[%f, %f], next_line=[%f, %f,%f, %f]\n", + focal_x, focal_y, + next_line[0], next_line[1], next_line[2], next_line[3]); +#endif + /* if we're alredy connected do nothing */ + if (floatsEqual(stroker->back1_x, next_line[0]) && + floatsEqual(stroker->back1_y, next_line[1])) + return; + + if (join == FlatJoin) { + stroker_emit_line_to(stroker, next_line[0], next_line[1]); + } else { + VGfloat prev_line[] = {stroker->back2_x, stroker->back2_y, + stroker->back1_x, stroker->back1_y}; + + VGfloat isect[2]; + enum intersection_type type = line_intersect(prev_line, next_line, isect); + + if (join == SquareJoin) { + VGfloat offset = stroker->stroke_width / 2; + VGfloat l1[4] = {prev_line[0], + prev_line[1], + prev_line[2], + prev_line[3]}; + VGfloat l2[4] = {next_line[2], + next_line[3], + next_line[0], + next_line[1]}; + + line_translate(l1, line_dx(l1), line_dy(l1)); + line_set_length(l1, offset); + + line_translate(l2, line_dx(l2), line_dy(l2)); + line_set_length(l2, offset); + + stroker_emit_line_to(stroker, l1[2], l1[3]); + stroker_emit_line_to(stroker, l2[2], l2[3]); + stroker_emit_line_to(stroker, l2[0], l2[1]); + } else if (join == RoundJoin) { + VGfloat offset = stroker->stroke_width / 2; + VGfloat short_cut[4] = {prev_line[2], prev_line[3], + next_line[0], next_line[1]}; + VGfloat angle = line_angles(prev_line, short_cut); + + if (type == BoundedIntersection || + (angle > 90 && !floatsEqual(angle, 90.f))) { + stroker_emit_line_to(stroker, next_line[0], next_line[1]); + return; + } + create_round_join(stroker, prev_line[2], prev_line[3], + next_line[0], next_line[1], + offset * 2, offset * 2); + + stroker_emit_line_to(stroker, next_line[0], next_line[1]); + } else if (join == RoundCap) { + VGfloat offset = stroker->stroke_width / 2; + VGfloat l1[4] = { prev_line[0], prev_line[1], + prev_line[2], prev_line[3] }; + VGfloat l2[4] = {focal_x, focal_y, + prev_line[2], prev_line[3]}; + + line_translate(l1, line_dx(l1), line_dy(l1)); + line_set_length(l1, KAPPA * offset); + + /* normal between prev_line and focal */ + line_translate(l2, -line_dy(l2), line_dx(l2)); + line_set_length(l2, KAPPA * offset); + + stroker_emit_curve_to(stroker, l1[2], l1[3], + l2[2], l2[3], + l2[0], l2[1]); + + l2[0] = l2[0]; + l2[1] = l2[1]; + l2[2] = l2[0] - line_dx(l2); + l2[3] = l2[1] - line_dy(l2); + + line_translate(l1, next_line[0] - l1[0], next_line[1] - l1[1]); + + stroker_emit_curve_to(stroker, + l2[2], l2[3], + l1[2], l1[3], + l1[0], l1[1]); + } else if (join == MiterJoin) { + VGfloat miter_line[4] = {stroker->back1_x, stroker->back1_y, + isect[0], isect[1]}; + VGfloat sl = (stroker->stroke_width * stroker->miter_limit); + VGfloat inside_line[4] = {prev_line[2], prev_line[3], + next_line[0], next_line[1]}; + VGfloat angle = line_angle_to(inside_line, prev_line); + + if (type == BoundedIntersection || + (angle > 90 && !floatsEqual(angle, 90.f))) { + /* + debug_printf("f = %f, nl = %f, pl = %f, is = %f\n", + focal_x, next_line[0], + prev_line[2], isect[0]);*/ + stroker_emit_line_to(stroker, next_line[0], next_line[1]); + return; + } + + if (type == NoIntersections || line_lengthv(miter_line) > sl) { + stroker_emit_line_to(stroker, next_line[0], next_line[1]); + } else { + stroker_emit_line_to(stroker, isect[0], isect[1]); + stroker_emit_line_to(stroker, next_line[0], next_line[1]); + } + } else { + debug_assert(!"create_joins bad join style"); + } + } +} + +static void stroker_add_segment(struct stroker *stroker, + VGPathCommand cmd, + const VGfloat *coords, + VGint num_coords) +{ + /* skip duplicated points */ + if (stroker->segments->num_elements && + stroker->last_cmd == cmd) { + VGfloat *data = stroker->control_points->data; + data += stroker->control_points->num_elements; + data -= num_coords; + switch (cmd) { + case VG_MOVE_TO_ABS: + if (floatsEqual(coords[0], data[0]) && + floatsEqual(coords[1], data[1])) + return; + break; + case VG_LINE_TO_ABS: + if (floatsEqual(coords[0], data[0]) && + floatsEqual(coords[1], data[1])) + return; + break; + case VG_CUBIC_TO_ABS: + if (floatsEqual(coords[0], data[0]) && + floatsEqual(coords[1], data[1]) && + floatsEqual(coords[2], data[2]) && + floatsEqual(coords[3], data[3]) && + floatsEqual(coords[4], data[4]) && + floatsEqual(coords[5], data[5])) + return; + break; + default: + debug_assert(!"Invalid stroke segment"); + } + } else if (stroker->last_cmd == VG_CUBIC_TO_ABS && + cmd == VG_LINE_TO_ABS) { + VGfloat *data = stroker->control_points->data; + data += stroker->control_points->num_elements; + data -= 2; + if (floatsEqual(coords[0], data[0]) && + floatsEqual(coords[1], data[1])) + return; + } + stroker->last_cmd = cmd; + array_append_data(stroker->segments, &cmd, 1); + array_append_data(stroker->control_points, coords, num_coords); +} + +void stroker_move_to(struct stroker *stroker, VGfloat x, VGfloat y) +{ + VGfloat coords[2] = {x, y}; +#if STROKE_SEGMENTS + debug_printf("stroker_move_to(%f, %f)\n", x, y); +#endif + + if (stroker->segments->num_elements > 0) + stroker->process_subpath(stroker); + + array_reset(stroker->segments); + array_reset(stroker->control_points); + + stroker_add_segment(stroker, VG_MOVE_TO_ABS, coords, 2); +} + +void stroker_line_to(struct stroker *stroker, VGfloat x, VGfloat y) +{ + VGfloat coords[] = {x, y}; + +#if STROKE_SEGMENTS + debug_printf("stroker_line_to(%f, %f)\n", x, y); +#endif + if (!stroker->segments->num_elements) + stroker_add_segment(stroker, VG_MOVE_TO_ABS, zero_coords, 2); + + stroker_add_segment(stroker, VG_LINE_TO_ABS, coords, 2); +} + +void stroker_curve_to(struct stroker *stroker, VGfloat px1, VGfloat py1, + VGfloat px2, VGfloat py2, + VGfloat x, VGfloat y) +{ + VGfloat coords[] = {px1, py1, + px2, py2, + x, y}; +#if STROKE_SEGMENTS + debug_printf("stroker_curve_to(%f, %f, %f, %f, %f, %f)\n", + px1, py1, px2, py2, x, y); +#endif + if (!stroker->segments->num_elements) + stroker_add_segment(stroker, VG_MOVE_TO_ABS, zero_coords, 2); + + stroker_add_segment(stroker, VG_CUBIC_TO_ABS, coords, 6); +} + +static INLINE VGboolean is_segment_null(VGPathCommand cmd, + VGfloat *coords, + VGfloat *res) +{ + switch(cmd) { + case VG_MOVE_TO_ABS: + case VG_LINE_TO_ABS: + return floatsEqual(coords[0], res[0]) && + floatsEqual(coords[1], res[1]); + break; + case VG_CUBIC_TO_ABS: + return floatsEqual(coords[0], res[0]) && + floatsEqual(coords[1], res[1]) && + floatsEqual(coords[2], res[0]) && + floatsEqual(coords[3], res[1]) && + floatsEqual(coords[4], res[0]) && + floatsEqual(coords[5], res[1]); + break; + default: + assert(0); + } + return VG_FALSE; +} + +static VGboolean vg_stroke_outline(struct stroke_iterator *it, + struct stroker *stroker, + VGboolean cap_first, + VGfloat *start_tangent) +{ + const int MAX_OFFSET = 16; + struct bezier offset_curves[MAX_OFFSET]; + VGPathCommand first_element; + VGfloat start[2], prev[2]; + VGboolean first = VG_TRUE; + VGfloat offset; + + first_element = stroke_itr_command(it); + if (first_element != VG_MOVE_TO_ABS) { + stroker_emit_move_to(stroker, 0.f, 0.f); + prev[0] = 0.f; + prev[1] = 0.f; + } + stroke_itr_coords(it, start); +#if STROKE_DEBUG + debug_printf(" -> (side) [%.2f, %.2f]\n", + start[0], + start[1]); +#endif + + prev[0] = start[0]; + prev[1] = start[1]; + + offset = stroker->stroke_width / 2; + + if (!it->has_next(it)) { + /* single point */ + + return VG_TRUE; + } + + while (it->has_next(it)) { + VGPathCommand cmd; + VGfloat coords[8]; + + it->next(it); + cmd = stroke_itr_command(it); + stroke_itr_coords(it, coords); + + if (cmd == VG_LINE_TO_ABS) { + VGfloat line[4] = {prev[0], prev[1], coords[0], coords[1]}; + VGfloat normal[4]; + line_normal(line, normal); + +#if STROKE_DEBUG + debug_printf("\n ---> (side) lineto [%.2f, %.2f]\n", coords[0], coords[1]); +#endif + line_set_length(normal, offset); + line_translate(line, line_dx(normal), line_dy(normal)); + + /* if we are starting a new subpath, move to correct starting point */ + if (first) { + if (cap_first) + create_joins(stroker, prev[0], prev[1], line, + stroker_cap_mode(stroker)); + else + stroker_emit_move_to(stroker, line[0], line[1]); + memcpy(start_tangent, line, + sizeof(VGfloat) * 4); + first = VG_FALSE; + } else { + create_joins(stroker, prev[0], prev[1], line, + stroker_join_mode(stroker)); + } + + /* add the stroke for this line */ + stroker_emit_line_to(stroker, line[2], line[3]); + prev[0] = coords[0]; + prev[1] = coords[1]; + } else if (cmd == VG_CUBIC_TO_ABS) { +#if STROKE_DEBUG + debug_printf("\n ---> (side) cubicTo [%.2f, %.2f]\n", + coords[4], + coords[5]); +#endif + struct bezier bezier; + int count; + + bezier_init(&bezier, + prev[0], prev[1], coords[0], coords[1], + coords[2], coords[3], coords[4], coords[5]); + + count = bezier_translate_by_normal(&bezier, + offset_curves, + MAX_OFFSET, + offset, + curve_threshold); + + if (count) { + /* if we are starting a new subpath, move to correct starting point */ + VGfloat tangent[4]; + VGint i; + + bezier_start_tangent(&bezier, tangent); + line_translate(tangent, + offset_curves[0].x1 - bezier.x1, + offset_curves[0].y1 - bezier.y1); + if (first) { + VGfloat pt[2] = {offset_curves[0].x1, + offset_curves[0].y1}; + + if (cap_first) { + create_joins(stroker, prev[0], prev[1], tangent, + stroker_cap_mode(stroker)); + } else { + stroker_emit_move_to(stroker, pt[0], pt[1]); + } + start_tangent[0] = tangent[0]; + start_tangent[1] = tangent[1]; + start_tangent[2] = tangent[2]; + start_tangent[3] = tangent[3]; + first = VG_FALSE; + } else { + create_joins(stroker, prev[0], prev[1], tangent, + stroker_join_mode(stroker)); + } + + /* add these beziers */ + for (i = 0; i < count; ++i) { + struct bezier *bez = &offset_curves[i]; + stroker_emit_curve_to(stroker, + bez->x2, bez->y2, + bez->x3, bez->y3, + bez->x4, bez->y4); + } + } + + prev[0] = coords[4]; + prev[1] = coords[5]; + } + } + + if (floatsEqual(start[0], prev[0]) && + floatsEqual(start[1], prev[1])) { + /* closed subpath, join first and last point */ +#if STROKE_DEBUG + debug_printf("\n stroker: closed subpath\n"); +#endif + create_joins(stroker, prev[0], prev[1], start_tangent, + stroker_join_mode(stroker)); + return VG_TRUE; + } else { +#if STROKE_DEBUG + debug_printf("\n stroker: open subpath\n"); +#endif + return VG_FALSE; + } +} + +static void stroker_process_subpath(struct stroker *stroker) +{ + VGboolean fwclosed, bwclosed; + VGfloat fw_start_tangent[4], bw_start_tangent[4]; + struct stroke_iterator fwit; + struct stroke_iterator bwit; + debug_assert(stroker->segments->num_elements > 0); + + memset(fw_start_tangent, 0, + sizeof(VGfloat)*4); + memset(bw_start_tangent, 0, + sizeof(VGfloat)*4); + + stroke_forward_iterator(&fwit, stroker->segments, + stroker->control_points); + stroke_backward_iterator(&bwit, stroker->segments, + stroker->control_points); + + debug_assert(fwit.cmds[0] == VG_MOVE_TO_ABS); + + fwclosed = vg_stroke_outline(&fwit, stroker, VG_FALSE, fw_start_tangent); + bwclosed = vg_stroke_outline(&bwit, stroker, !fwclosed, bw_start_tangent); + + if (!bwclosed) + create_joins(stroker, + fwit.coords[0], fwit.coords[1], fw_start_tangent, + stroker_cap_mode(stroker)); + else { + /* hack to handle the requirement of the VG spec that says that strokes + * of len==0 that have butt cap or round cap still need + * to be rendered. (8.7.4 Stroke Generation) */ + if (stroker->segments->num_elements <= 3) { + VGPathCommand cmd; + VGfloat data[8], coords[8]; + struct stroke_iterator *it = &fwit; + + stroke_forward_iterator(it, stroker->segments, + stroker->control_points); + cmd = stroke_itr_command(it); + stroke_itr_coords(it, coords); + if (cmd != VG_MOVE_TO_ABS) { + memset(data, 0, sizeof(VGfloat) * 8); + if (!is_segment_null(cmd, coords, data)) + return; + } else { + data[0] = coords[0]; + data[1] = coords[1]; + } + while (it->has_next(it)) { + it->next(it); + cmd = stroke_itr_command(it); + stroke_itr_coords(it, coords); + if (!is_segment_null(cmd, coords, data)) + return; + } + /* generate the square/round cap */ + if (stroker->cap_style == VG_CAP_SQUARE) { + VGfloat offset = stroker->stroke_width / 2; + stroker_emit_move_to(stroker, data[0] - offset, + data[1] - offset); + stroker_emit_line_to(stroker, data[0] + offset, + data[1] - offset); + stroker_emit_line_to(stroker, data[0] + offset, + data[1] + offset); + stroker_emit_line_to(stroker, data[0] - offset, + data[1] + offset); + stroker_emit_line_to(stroker, data[0] - offset, + data[1] - offset); + } else if (stroker->cap_style == VG_CAP_ROUND) { + VGfloat offset = stroker->stroke_width / 2; + VGfloat cx = data[0], cy = data[1]; + { /*circle */ + struct arc arc; + struct matrix matrix; + matrix_load_identity(&matrix); + + stroker_emit_move_to(stroker, cx + offset, cy); + arc_init(&arc, VG_SCCWARC_TO_ABS, + cx + offset, cy, + cx - offset, cy, + offset, offset, 0); + arc_stroker_emit(&arc, stroker, &matrix); + arc_init(&arc, VG_SCCWARC_TO_ABS, + cx - offset, cy, + cx + offset, cy, + offset, offset, 0); + arc_stroker_emit(&arc, stroker, &matrix); + } + } + } + } +} + +static INLINE VGfloat dash_pattern(struct dash_stroker *stroker, + VGint idx) +{ + if (stroker->dash_pattern[idx] < 0) + return 0.f; + return stroker->dash_pattern[idx]; +} + +static void dash_stroker_process_subpath(struct stroker *str) +{ + struct dash_stroker *stroker = (struct dash_stroker *)str; + VGfloat sum_length = 0; + VGint i; + VGint idash = 0; + VGfloat pos = 0; + VGfloat elen = 0; + VGfloat doffset = stroker->dash_phase; + VGfloat estart = 0; + VGfloat estop = 0; + VGfloat cline[4]; + struct stroke_iterator it; + VGfloat prev[2]; + VGfloat move_to_pos[2]; + VGfloat line_to_pos[2]; + + VGboolean has_move_to = VG_FALSE; + + stroke_flat_iterator(&it, stroker->base.segments, + stroker->base.control_points); + + stroke_itr_coords(&it, prev); + move_to_pos[0] = prev[0]; + move_to_pos[1] = prev[1]; + + debug_assert(stroker->dash_pattern_num > 0); + + for (i = 0; i < stroker->dash_pattern_num; ++i) { + sum_length += dash_pattern(stroker, i); + } + + if (floatIsZero(sum_length)) { + return; + } + + doffset -= floorf(doffset / sum_length) * sum_length; + + while (!floatIsZero(doffset) && doffset >= dash_pattern(stroker, idash)) { + doffset -= dash_pattern(stroker, idash); + idash = (idash + 1) % stroker->dash_pattern_num; + } + + while (it.has_next(&it)) { + VGPathCommand cmd; + VGfloat coords[8]; + VGboolean done; + + it.next(&it); + cmd = stroke_itr_command(&it); + stroke_itr_coords(&it, coords); + + debug_assert(cmd == VG_LINE_TO_ABS); + cline[0] = prev[0]; + cline[1] = prev[1]; + cline[2] = coords[0]; + cline[3] = coords[1]; + + elen = line_lengthv(cline); + + estop = estart + elen; + + done = pos >= estop; + while (!done) { + VGfloat p2[2]; + + VGint idash_incr = 0; + VGboolean has_offset = doffset > 0; + VGfloat dpos = pos + dash_pattern(stroker, idash) - doffset - estart; + + debug_assert(dpos >= 0); + + if (dpos > elen) { /* dash extends this line */ + doffset = dash_pattern(stroker, idash) - (dpos - elen); + pos = estop; + done = VG_TRUE; + p2[0] = cline[2]; + p2[1] = cline[3]; + } else { /* Dash is on this line */ + line_point_at(cline, dpos/elen, p2); + pos = dpos + estart; + done = pos >= estop; + idash_incr = 1; + doffset = 0; + } + + if (idash % 2 == 0) { + line_to_pos[0] = p2[0]; + line_to_pos[1] = p2[1]; + + if (!has_offset || !has_move_to) { + stroker_move_to(&stroker->stroker, move_to_pos[0], move_to_pos[1]); + has_move_to = VG_TRUE; + } + stroker_line_to(&stroker->stroker, line_to_pos[0], line_to_pos[1]); + } else { + move_to_pos[0] = p2[0]; + move_to_pos[1] = p2[1]; + } + + idash = (idash + idash_incr) % stroker->dash_pattern_num; + } + + estart = estop; + prev[0] = coords[0]; + prev[1] = coords[1]; + } + + if (it.curve_poly) { + polygon_destroy(it.curve_poly); + it.curve_poly = 0; + } + + stroker->base.path = stroker->stroker.path; +} + +static void default_begin(struct stroker *stroker) +{ + array_reset(stroker->segments); + array_reset(stroker->control_points); +} + +static void default_end(struct stroker *stroker) +{ + if (stroker->segments->num_elements > 0) + stroker->process_subpath(stroker); +} + + +static void dash_stroker_begin(struct stroker *stroker) +{ + struct dash_stroker *dasher = + (struct dash_stroker *)stroker; + + default_begin(&dasher->stroker); + default_begin(stroker); +} + +static void dash_stroker_end(struct stroker *stroker) +{ + struct dash_stroker *dasher = + (struct dash_stroker *)stroker; + + default_end(stroker); + default_end(&dasher->stroker); +} + +void stroker_init(struct stroker *stroker, + struct vg_state *state) +{ + stroker->stroke_width = state->stroke.line_width.f; + stroker->miter_limit = state->stroke.miter_limit.f; + stroker->cap_style = state->stroke.cap_style; + stroker->join_style = state->stroke.join_style; + + stroker->begin = default_begin; + stroker->process_subpath = stroker_process_subpath; + stroker->end = default_end; + + stroker->segments = array_create(sizeof(VGubyte)); + stroker->control_points = array_create(sizeof(VGfloat)); + + stroker->back1_x = 0; + stroker->back1_y = 0; + stroker->back2_x = 0; + stroker->back2_y = 0; + + stroker->path = path_create(VG_PATH_DATATYPE_F, 1.0f, 0.0f, + 0, 0, VG_PATH_CAPABILITY_ALL); + + stroker->last_cmd = VG_CLOSE_PATH; +} + +void dash_stroker_init(struct stroker *str, + struct vg_state *state) +{ + struct dash_stroker *stroker = (struct dash_stroker *)str; + int i; + + stroker_init(str, state); + stroker_init(&stroker->stroker, state); + + { + int real_num = state->stroke.dash_pattern_num; + if (real_num % 2)/* if odd, ignore the last one */ + --real_num; + for (i = 0; i < real_num; ++i) + stroker->dash_pattern[i] = state->stroke.dash_pattern[i].f; + stroker->dash_pattern_num = real_num; + } + + stroker->dash_phase = state->stroke.dash_phase.f; + stroker->dash_phase_reset = state->stroke.dash_phase_reset; + + stroker->base.begin = dash_stroker_begin; + stroker->base.process_subpath = dash_stroker_process_subpath; + stroker->base.end = dash_stroker_end; + path_destroy(stroker->base.path); + stroker->base.path = NULL; +} + +void stroker_begin(struct stroker *stroker) +{ + stroker->begin(stroker); +} + +void stroker_end(struct stroker *stroker) +{ + stroker->end(stroker); +} + +void stroker_cleanup(struct stroker *stroker) +{ + array_destroy(stroker->segments); + array_destroy(stroker->control_points); +} + +void dash_stroker_cleanup(struct dash_stroker *stroker) +{ + /* if stroker->base.path is null means we never + * processed a valid path so delete the temp one + * we already created */ + if (!stroker->base.path) + path_destroy(stroker->stroker.path); + stroker_cleanup(&stroker->stroker); + stroker_cleanup((struct stroker*)stroker); +} diff --git a/src/gallium/state_trackers/vega/stroker.h b/src/gallium/state_trackers/vega/stroker.h new file mode 100644 index 00000000000..36543cd9237 --- /dev/null +++ b/src/gallium/state_trackers/vega/stroker.h @@ -0,0 +1,89 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 STROKER_H +#define STROKER_H + +#include "VG/openvg.h" +#include "api_consts.h" + +struct path; +struct vg_state; +struct array; + +struct stroker { + void (*begin)(struct stroker *stroker); + void (*process_subpath)(struct stroker *stroker); + void (*end)(struct stroker *stroker); + + struct array *segments; + struct array *control_points; + struct path *path; + + VGfloat back1_x, back1_y; + VGfloat back2_x, back2_y; + + VGfloat stroke_width; + VGfloat miter_limit; + VGCapStyle cap_style; + VGJoinStyle join_style; + + VGPathCommand last_cmd; +}; + +struct dash_stroker { + struct stroker base; + + struct stroker stroker; + + VGfloat dash_pattern[VEGA_MAX_DASH_COUNT]; + VGint dash_pattern_num; + VGfloat dash_phase; + VGboolean dash_phase_reset; +}; + +void stroker_init(struct stroker *stroker, + struct vg_state *state); +void dash_stroker_init(struct stroker *stroker, + struct vg_state *state); +void dash_stroker_cleanup(struct dash_stroker *stroker); +void stroker_cleanup(struct stroker *stroker); + +void stroker_begin(struct stroker *stroker); +void stroker_move_to(struct stroker *stroker, VGfloat x, VGfloat y); +void stroker_line_to(struct stroker *stroker, VGfloat x, VGfloat y); +void stroker_curve_to(struct stroker *stroker, VGfloat px1, VGfloat py1, + VGfloat px2, VGfloat py2, + VGfloat x, VGfloat y); +void stroker_end(struct stroker *stroker); + +void stroker_emit_move_to(struct stroker *stroker, VGfloat x, VGfloat y); +void stroker_emit_line_to(struct stroker *stroker, VGfloat x, VGfloat y); +void stroker_emit_curve_to(struct stroker *stroker, VGfloat px1, VGfloat py1, + VGfloat px2, VGfloat py2, + VGfloat x, VGfloat y); + +#endif diff --git a/src/gallium/state_trackers/vega/util_array.h b/src/gallium/state_trackers/vega/util_array.h new file mode 100644 index 00000000000..4343dfe36e2 --- /dev/null +++ b/src/gallium/state_trackers/vega/util_array.h @@ -0,0 +1,122 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 UTIL_ARRAY_H +#define UTIL_ARRAY_H + +#include "util/u_memory.h" + +#define DEFAULT_ARRAY_SIZE 256 + +struct array { + VGint datatype_size; + void *data; + VGint size; + VGint num_elements; +}; + +static INLINE struct array *array_create(VGint datatype_size) +{ + struct array *array = CALLOC_STRUCT(array); + array->datatype_size = datatype_size; + + array->size = DEFAULT_ARRAY_SIZE; + array->data = malloc(array->size * array->datatype_size); + + return array; +} + + +static INLINE struct array *array_create_size(VGint datatype_size, VGint size) +{ + struct array *array = CALLOC_STRUCT(array); + array->datatype_size = datatype_size; + + array->size = size; + array->data = malloc(array->size * array->datatype_size); + + return array; +} + +static INLINE void array_destroy(struct array *array) +{ + if (array) + free(array->data); + free(array); +} + +static INLINE void array_resize(struct array *array, int num) +{ + VGint size = array->datatype_size * num; + void *data = malloc(size); + memcpy(data, array->data, array->size * array->datatype_size); + free(array->data); + array->data = data; + array->size = num; + array->num_elements = (array->num_elements > num) ? num : + array->num_elements; +} + +static INLINE void array_append_data(struct array *array, + const void *data, int num_elements) +{ + VGbyte *adata; + + while (array->num_elements + num_elements > array->size) { + array_resize(array, (array->num_elements + num_elements) * 1.5); + } + adata = (VGbyte *)array->data; + memcpy(adata + (array->num_elements * array->datatype_size), data, + num_elements * array->datatype_size); + array->num_elements += num_elements; +} + +static INLINE void array_change_data(struct array *array, + const void *data, + int start_idx, + int num_elements) +{ + VGbyte *adata = (VGbyte *)array->data; + memcpy(adata + (start_idx * array->datatype_size), data, + num_elements * array->datatype_size); +} + +static INLINE void array_remove_element(struct array *array, + int idx) +{ + VGbyte *adata = (VGbyte *)array->data; + memmove(adata + (idx * array->datatype_size), + adata + ((idx + 1) * array->datatype_size), + (array->num_elements - idx - 1) * array->datatype_size); + --array->num_elements; +} + +static INLINE void array_reset(struct array *array) +{ + array->num_elements = 0; +} + +#endif diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c new file mode 100644 index 00000000000..e0ff02f3a99 --- /dev/null +++ b/src/gallium/state_trackers/vega/vg_context.c @@ -0,0 +1,543 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "vg_context.h" + +#include "paint.h" +#include "renderer.h" +#include "shaders_cache.h" +#include "shader.h" +#include "asm_util.h" +#include "st_inlines.h" + +#include "pipe/p_context.h" +#include "pipe/p_inlines.h" +#include "pipe/p_shader_tokens.h" + +#include "cso_cache/cso_context.h" + +#include "util/u_simple_shaders.h" +#include "util/u_memory.h" +#include "util/u_blit.h" + +struct vg_context *_vg_context = 0; + +struct vg_context * vg_current_context(void) +{ + return _vg_context; +} + +static void init_clear(struct vg_context *st) +{ + struct pipe_context *pipe = st->pipe; + + /* rasterizer state: bypass clipping */ + memset(&st->clear.raster, 0, sizeof(st->clear.raster)); + st->clear.raster.gl_rasterization_rules = 1; + + /* fragment shader state: color pass-through program */ + st->clear.fs = + util_make_fragment_passthrough_shader(pipe); +} +void vg_set_current_context(struct vg_context *ctx) +{ + _vg_context = ctx; +} + +struct vg_context * vg_create_context(struct pipe_context *pipe, + const void *visual, + struct vg_context *share) +{ + struct vg_context *ctx; + + ctx = CALLOC_STRUCT(vg_context); + + ctx->pipe = pipe; + + vg_init_state(&ctx->state.vg); + ctx->state.dirty = ALL_DIRTY; + + ctx->cso_context = cso_create_context(pipe); + + init_clear(ctx); + + ctx->default_paint = paint_create(ctx); + ctx->state.vg.stroke_paint = ctx->default_paint; + ctx->state.vg.fill_paint = ctx->default_paint; + + + ctx->mask.sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + ctx->mask.sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + ctx->mask.sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; + ctx->mask.sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; + ctx->mask.sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; + ctx->mask.sampler.normalized_coords = 0; + + ctx->blend_sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + ctx->blend_sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + ctx->blend_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; + ctx->blend_sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; + ctx->blend_sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; + ctx->blend_sampler.normalized_coords = 0; + + vg_set_error(ctx, VG_NO_ERROR); + + ctx->owned_objects[VG_OBJECT_PAINT] = cso_hash_create(); + ctx->owned_objects[VG_OBJECT_IMAGE] = cso_hash_create(); + ctx->owned_objects[VG_OBJECT_MASK] = cso_hash_create(); + ctx->owned_objects[VG_OBJECT_FONT] = cso_hash_create(); + ctx->owned_objects[VG_OBJECT_PATH] = cso_hash_create(); + + ctx->renderer = renderer_create(ctx); + ctx->sc = shaders_cache_create(ctx); + ctx->shader = shader_create(ctx); + + ctx->blit = util_create_blit(ctx->pipe, ctx->cso_context); + + return ctx; +} + +void vg_destroy_context(struct vg_context *ctx) +{ + struct pipe_constant_buffer *cbuf = &ctx->mask.cbuf; + struct pipe_constant_buffer *vsbuf = &ctx->vs_const_buffer; + + util_destroy_blit(ctx->blit); + renderer_destroy(ctx->renderer); + shaders_cache_destroy(ctx->sc); + shader_destroy(ctx->shader); + paint_destroy(ctx->default_paint); + + if (cbuf && cbuf->buffer) + pipe_buffer_reference(&cbuf->buffer, NULL); + + if (vsbuf && vsbuf->buffer) + pipe_buffer_reference(&vsbuf->buffer, NULL); + + if (ctx->clear.fs) { + cso_delete_fragment_shader(ctx->cso_context, ctx->clear.fs); + ctx->clear.fs = NULL; + } + + if (ctx->plain_vs) { + vg_shader_destroy(ctx, ctx->plain_vs); + ctx->plain_vs = NULL; + } + if (ctx->clear_vs) { + vg_shader_destroy(ctx, ctx->clear_vs); + ctx->clear_vs = NULL; + } + if (ctx->texture_vs) { + vg_shader_destroy(ctx, ctx->texture_vs); + ctx->texture_vs = NULL; + } + + if (ctx->pass_through_depth_fs) + vg_shader_destroy(ctx, ctx->pass_through_depth_fs); + if (ctx->mask.union_fs) + vg_shader_destroy(ctx, ctx->mask.union_fs); + if (ctx->mask.intersect_fs) + vg_shader_destroy(ctx, ctx->mask.intersect_fs); + if (ctx->mask.subtract_fs) + vg_shader_destroy(ctx, ctx->mask.subtract_fs); + if (ctx->mask.set_fs) + vg_shader_destroy(ctx, ctx->mask.set_fs); + + cso_release_all(ctx->cso_context); + cso_destroy_context(ctx->cso_context); + + cso_hash_delete(ctx->owned_objects[VG_OBJECT_PAINT]); + cso_hash_delete(ctx->owned_objects[VG_OBJECT_IMAGE]); + cso_hash_delete(ctx->owned_objects[VG_OBJECT_MASK]); + cso_hash_delete(ctx->owned_objects[VG_OBJECT_FONT]); + cso_hash_delete(ctx->owned_objects[VG_OBJECT_PATH]); + + free(ctx); +} + +void vg_init_object(struct vg_object *obj, struct vg_context *ctx, enum vg_object_type type) +{ + obj->type = type; + obj->ctx = ctx; +} + +VGboolean vg_context_is_object_valid(struct vg_context *ctx, + enum vg_object_type type, + void *ptr) +{ + if (ctx) { + struct cso_hash *hash = ctx->owned_objects[type]; + if (!hash) + return VG_FALSE; + return cso_hash_contains(hash, (unsigned)(long)ptr); + } + return VG_FALSE; +} + +void vg_context_add_object(struct vg_context *ctx, + enum vg_object_type type, + void *ptr) +{ + if (ctx) { + struct cso_hash *hash = ctx->owned_objects[type]; + if (!hash) + return; + cso_hash_insert(hash, (unsigned)(long)ptr, ptr); + } +} + +void vg_context_remove_object(struct vg_context *ctx, + enum vg_object_type type, + void *ptr) +{ + if (ctx) { + struct cso_hash *hash = ctx->owned_objects[type]; + if (!hash) + return; + cso_hash_take(hash, (unsigned)(long)ptr); + } +} + +static void update_clip_state(struct vg_context *ctx) +{ + struct pipe_depth_stencil_alpha_state *dsa = &ctx->state.g3d.dsa; + struct vg_state *state = &ctx->state.vg; + + memset(dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state)); + + if (state->scissoring) { + struct pipe_blend_state *blend = &ctx->state.g3d.blend; + struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + dsa->depth.writemask = 1;/*glDepthMask(TRUE);*/ + dsa->depth.func = PIPE_FUNC_ALWAYS; + dsa->depth.enabled = 1; + + cso_save_blend(ctx->cso_context); + cso_save_fragment_shader(ctx->cso_context); + /* set a passthrough shader */ + if (!ctx->pass_through_depth_fs) + ctx->pass_through_depth_fs = shader_create_from_text(ctx->pipe, + pass_through_depth_asm, + 40, + PIPE_SHADER_FRAGMENT); + cso_set_fragment_shader_handle(ctx->cso_context, + ctx->pass_through_depth_fs->driver); + cso_set_depth_stencil_alpha(ctx->cso_context, dsa); + + ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_DEPTHSTENCIL, NULL, 1.0, 0); + + /* disable color writes */ + blend->colormask = 0; /*disable colorwrites*/ + cso_set_blend(ctx->cso_context, blend); + + /* enable scissoring */ + for (int i = 0; i < state->scissor_rects_num; ++i) { + const float x = state->scissor_rects[i * 4 + 0].f; + const float y = state->scissor_rects[i * 4 + 1].f; + const float width = state->scissor_rects[i * 4 + 2].f; + const float height = state->scissor_rects[i * 4 + 3].f; + VGfloat minx, miny, maxx, maxy; + + minx = 0; + miny = 0; + maxx = fb->width; + maxy = fb->height; + + if (x > minx) + minx = x; + if (y > miny) + miny = y; + + if (x + width < maxx) + maxx = x + width; + if (y + height < maxy) + maxy = y + height; + + /* check for null space */ + if (minx >= maxx || miny >= maxy) + minx = miny = maxx = maxy = 0; + + /*glClear(GL_DEPTH_BUFFER_BIT);*/ + renderer_draw_quad(ctx->renderer, minx, miny, maxx, maxy, 0.0f); + } + + blend->colormask = 1; /*enable colorwrites*/ + cso_restore_blend(ctx->cso_context); + cso_restore_fragment_shader(ctx->cso_context); + + dsa->depth.enabled = 1; /* glEnable(GL_DEPTH_TEST); */ + dsa->depth.writemask = 0;/*glDepthMask(FALSE);*/ + dsa->depth.func = PIPE_FUNC_GEQUAL; + } +} + +void vg_validate_state(struct vg_context *ctx) +{ + if ((ctx->state.dirty & BLEND_DIRTY)) { + struct pipe_blend_state *blend = &ctx->state.g3d.blend; + memset(blend, 0, sizeof(struct pipe_blend_state)); + blend->blend_enable = 1; + blend->colormask |= PIPE_MASK_R; + blend->colormask |= PIPE_MASK_G; + blend->colormask |= PIPE_MASK_B; + blend->colormask |= PIPE_MASK_A; + + switch (ctx->state.vg.blend_mode) { + case VG_BLEND_SRC: + blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend->rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend->alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; + break; + case VG_BLEND_SRC_OVER: + blend->rgb_src_factor = PIPE_BLENDFACTOR_SRC_ALPHA; + blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend->rgb_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA; + blend->alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA; + break; + case VG_BLEND_DST_OVER: + blend->rgb_src_factor = PIPE_BLENDFACTOR_INV_DST_ALPHA; + blend->alpha_src_factor = PIPE_BLENDFACTOR_INV_DST_ALPHA; + blend->rgb_dst_factor = PIPE_BLENDFACTOR_DST_ALPHA; + blend->alpha_dst_factor = PIPE_BLENDFACTOR_DST_ALPHA; + break; + case VG_BLEND_SRC_IN: + blend->rgb_src_factor = PIPE_BLENDFACTOR_DST_ALPHA; + blend->alpha_src_factor = PIPE_BLENDFACTOR_DST_ALPHA; + blend->rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend->alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; + break; + case VG_BLEND_DST_IN: + blend->rgb_src_factor = PIPE_BLENDFACTOR_ZERO; + blend->alpha_src_factor = PIPE_BLENDFACTOR_ZERO; + blend->rgb_dst_factor = PIPE_BLENDFACTOR_SRC_ALPHA; + blend->alpha_dst_factor = PIPE_BLENDFACTOR_SRC_ALPHA; + break; + case VG_BLEND_MULTIPLY: + case VG_BLEND_SCREEN: + case VG_BLEND_DARKEN: + case VG_BLEND_LIGHTEN: + blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend->rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend->alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; + break; + case VG_BLEND_ADDITIVE: + blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend->rgb_dst_factor = PIPE_BLENDFACTOR_ONE; + blend->alpha_dst_factor = PIPE_BLENDFACTOR_ONE; + break; + default: + assert(!"not implemented blend mode"); + } + cso_set_blend(ctx->cso_context, &ctx->state.g3d.blend); + } + if ((ctx->state.dirty & RASTERIZER_DIRTY)) { + struct pipe_rasterizer_state *raster = &ctx->state.g3d.rasterizer; + memset(raster, 0, sizeof(struct pipe_rasterizer_state)); + raster->gl_rasterization_rules = 1; + cso_set_rasterizer(ctx->cso_context, &ctx->state.g3d.rasterizer); + } + if ((ctx->state.dirty & VIEWPORT_DIRTY)) { + struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + const VGint param_bytes = 8 * sizeof(VGfloat); + VGfloat vs_consts[8] = { + 2.f/fb->width, 2.f/fb->height, 1, 1, + -1, -1, 0, 0 + }; + struct pipe_constant_buffer *cbuf = &ctx->vs_const_buffer; + + vg_set_viewport(ctx, VEGA_Y0_BOTTOM); + + pipe_buffer_reference(&cbuf->buffer, NULL); + cbuf->buffer = pipe_buffer_create(ctx->pipe->screen, 16, + PIPE_BUFFER_USAGE_CONSTANT, + param_bytes); + + if (cbuf->buffer) { + st_no_flush_pipe_buffer_write(ctx, cbuf->buffer, + 0, param_bytes, vs_consts); + } + ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_VERTEX, 0, cbuf); + } + if ((ctx->state.dirty & VS_DIRTY)) { + cso_set_vertex_shader_handle(ctx->cso_context, + vg_plain_vs(ctx)); + } + + /* must be last because it renders to the depth buffer*/ + if ((ctx->state.dirty & DEPTH_STENCIL_DIRTY)) { + update_clip_state(ctx); + cso_set_depth_stencil_alpha(ctx->cso_context, &ctx->state.g3d.dsa); + } + + shader_set_masking(ctx->shader, ctx->state.vg.masking); + shader_set_image_mode(ctx->shader, ctx->state.vg.image_mode); + + ctx->state.dirty = NONE_DIRTY; +} + +VGboolean vg_object_is_valid(void *ptr, enum vg_object_type type) +{ + struct vg_object *obj = ptr; + if (ptr && is_aligned(obj) && obj->type == type) + return VG_TRUE; + else + return VG_FALSE; +} + +void vg_set_error(struct vg_context *ctx, + VGErrorCode code) +{ + /*vgGetError returns the oldest error code provided by + * an API call on the current context since the previous + * call to vgGetError on that context (or since the creation + of the context).*/ + if (ctx->_error == VG_NO_ERROR) + ctx->_error = code; +} + +void vg_prepare_blend_surface(struct vg_context *ctx) +{ + struct pipe_surface *dest_surface = NULL; + struct pipe_context *pipe = ctx->pipe; + struct st_framebuffer *stfb = ctx->draw_buffer; + struct st_renderbuffer *strb = stfb->strb; + + /* first finish all pending rendering */ + vgFinish(); + + dest_surface = pipe->screen->get_tex_surface(pipe->screen, + stfb->blend_texture, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + /* flip it, because we want to use it as a sampler */ + util_blit_pixels_tex(ctx->blit, + strb->texture, + 0, strb->height, + strb->width, 0, + dest_surface, + 0, 0, + strb->width, strb->height, + 0.0, PIPE_TEX_MIPFILTER_NEAREST); + + if (dest_surface) + pipe_surface_reference(&dest_surface, NULL); + + /* make sure it's complete */ + vgFinish(); +} + + +void vg_prepare_blend_surface_from_mask(struct vg_context *ctx) +{ + struct pipe_surface *dest_surface = NULL; + struct pipe_context *pipe = ctx->pipe; + struct st_framebuffer *stfb = ctx->draw_buffer; + struct st_renderbuffer *strb = stfb->strb; + + vg_validate_state(ctx); + + /* first finish all pending rendering */ + vgFinish(); + + dest_surface = pipe->screen->get_tex_surface(pipe->screen, + stfb->blend_texture, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* flip it, because we want to use it as a sampler */ + util_blit_pixels_tex(ctx->blit, + stfb->alpha_mask, + 0, strb->height, + strb->width, 0, + dest_surface, + 0, 0, + strb->width, strb->height, + 0.0, PIPE_TEX_MIPFILTER_NEAREST); + + /* make sure it's complete */ + vgFinish(); + + if (dest_surface) + pipe_surface_reference(&dest_surface, NULL); +} + +void * vg_plain_vs(struct vg_context *ctx) +{ + if (!ctx->plain_vs) { + ctx->plain_vs = shader_create_from_text(ctx->pipe, + vs_plain_asm, + 200, + PIPE_SHADER_VERTEX); + } + + return ctx->plain_vs->driver; +} + + +void * vg_clear_vs(struct vg_context *ctx) +{ + if (!ctx->clear_vs) { + ctx->clear_vs = shader_create_from_text(ctx->pipe, + vs_clear_asm, + 200, + PIPE_SHADER_VERTEX); + } + + return ctx->clear_vs->driver; +} + +void * vg_texture_vs(struct vg_context *ctx) +{ + if (!ctx->texture_vs) { + ctx->texture_vs = shader_create_from_text(ctx->pipe, + vs_texture_asm, + 200, + PIPE_SHADER_VERTEX); + } + + return ctx->texture_vs->driver; +} + +void vg_set_viewport(struct vg_context *ctx, VegaOrientation orientation) +{ + struct pipe_viewport_state viewport; + struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + VGfloat y_scale = (orientation == VEGA_Y0_BOTTOM) ? -2.f : 2.f; + + viewport.scale[0] = fb->width / 2.f; + viewport.scale[1] = fb->height / y_scale; + viewport.scale[2] = 1.0; + viewport.scale[3] = 1.0; + viewport.translate[0] = fb->width / 2.f; + viewport.translate[1] = fb->height / 2.f; + viewport.translate[2] = 0.0; + viewport.translate[3] = 0.0; + + cso_set_viewport(ctx->cso_context, &viewport); +} diff --git a/src/gallium/state_trackers/vega/vg_context.h b/src/gallium/state_trackers/vega/vg_context.h new file mode 100644 index 00000000000..ccc8889c8c5 --- /dev/null +++ b/src/gallium/state_trackers/vega/vg_context.h @@ -0,0 +1,292 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 VG_CONTEXT_H +#define VG_CONTEXT_H + +#include "vg_state.h" + +#include "pipe/p_format.h" +#include "pipe/p_state.h" +#include "util/u_pointer.h" +#include "util/u_math.h" + +#include "cso_cache/cso_hash.h" +#include "cso_cache/cso_context.h" + +struct renderer; +struct shaders_cache; +struct shader; +struct vg_shader; + +struct st_renderbuffer { + enum pipe_format format; + struct pipe_surface *surface; + struct pipe_texture *texture; + VGint width, height; +}; + +struct st_framebuffer { + VGint init_width, init_height; + struct st_renderbuffer *strb; + struct st_renderbuffer *dsrb; + + struct pipe_texture *alpha_mask; + + struct pipe_texture *blend_texture; + + void *privateData; +}; + +enum vg_object_type { + VG_OBJECT_UNKNOWN = 0, + VG_OBJECT_PAINT, + VG_OBJECT_IMAGE, + VG_OBJECT_MASK, + VG_OBJECT_FONT, + VG_OBJECT_PATH, + + VG_OBJECT_LAST +}; +enum dirty_state { + NONE_DIRTY = 0<<0, + BLEND_DIRTY = 1<<1, + RASTERIZER_DIRTY = 1<<2, + VIEWPORT_DIRTY = 1<<3, + VS_DIRTY = 1<<4, + DEPTH_STENCIL_DIRTY = 1<<5, + ALL_DIRTY = BLEND_DIRTY | RASTERIZER_DIRTY | + VIEWPORT_DIRTY | VS_DIRTY | DEPTH_STENCIL_DIRTY +}; + +struct vg_context +{ + struct pipe_context *pipe; + + struct { + struct vg_state vg; + struct { + struct pipe_blend_state blend; + struct pipe_rasterizer_state rasterizer; + struct pipe_shader_state vs_state; + struct pipe_depth_stencil_alpha_state dsa; + struct pipe_framebuffer_state fb; + } g3d; + VGbitfield dirty; + } state; + + VGErrorCode _error; + + struct st_framebuffer *draw_buffer; + + struct cso_hash *owned_objects[VG_OBJECT_LAST]; + + struct { + struct pipe_shader_state vert_shader; + struct pipe_shader_state frag_shader; + struct pipe_rasterizer_state raster; + void *fs; + float vertices[4][2][4]; /**< vertex pos + color */ + } clear; + + struct { + struct pipe_constant_buffer cbuf; + struct pipe_sampler_state sampler; + + struct vg_shader *union_fs; + struct vg_shader *intersect_fs; + struct vg_shader *subtract_fs; + struct vg_shader *set_fs; + } mask; + + struct vg_shader *pass_through_depth_fs; + + struct cso_context *cso_context; + + struct pipe_buffer *stencil_quad; + VGfloat stencil_vertices[4][2][4]; + + struct renderer *renderer; + struct shaders_cache *sc; + struct shader *shader; + + struct pipe_sampler_state blend_sampler; + struct { + struct pipe_constant_buffer buffer; + void *color_matrix_fs; + } filter; + struct vg_paint *default_paint; + + struct blit_state *blit; + + struct vg_shader *plain_vs; + struct vg_shader *clear_vs; + struct vg_shader *texture_vs; + struct pipe_constant_buffer vs_const_buffer; +}; + +struct vg_object { + enum vg_object_type type; + struct vg_context *ctx; +}; +void vg_init_object(struct vg_object *obj, struct vg_context *ctx, enum vg_object_type type); +VGboolean vg_object_is_valid(void *ptr, enum vg_object_type type); + +struct vg_context *vg_create_context(struct pipe_context *pipe, + const void *visual, + struct vg_context *share); +void vg_destroy_context(struct vg_context *ctx); +struct vg_context *vg_current_context(void); +void vg_set_current_context(struct vg_context *ctx); + +VGboolean vg_context_is_object_valid(struct vg_context *ctx, + enum vg_object_type type, + void *ptr); +void vg_context_add_object(struct vg_context *ctx, + enum vg_object_type type, + void *ptr); +void vg_context_remove_object(struct vg_context *ctx, + enum vg_object_type type, + void *ptr); + +void vg_validate_state(struct vg_context *ctx); + +void vg_set_error(struct vg_context *ctx, + VGErrorCode code); + +void vg_prepare_blend_surface(struct vg_context *ctx); +void vg_prepare_blend_surface_from_mask(struct vg_context *ctx); + + +static INLINE VGboolean is_aligned_to(const void *ptr, VGbyte alignment) +{ + void *aligned = align_pointer(ptr, alignment); + return (ptr == aligned) ? VG_TRUE : VG_FALSE; +} + +static INLINE VGboolean is_aligned(const void *ptr) +{ + return is_aligned_to(ptr, 4); +} + +static INLINE void vg_shift_rectx(VGfloat coords[4], + const VGfloat *bounds, + const VGfloat shift) +{ + coords[0] += shift; + coords[2] -= shift; + if (bounds) { + coords[2] = MIN2(coords[2], bounds[2]); + /* bound x/y + width/height */ + if ((coords[0] + coords[2]) > (bounds[0] + bounds[2])) { + coords[2] = (bounds[0] + bounds[2]) - coords[0]; + } + } +} + +static INLINE void vg_shift_recty(VGfloat coords[4], + const VGfloat *bounds, + const VGfloat shift) +{ + coords[1] += shift; + coords[3] -= shift; + if (bounds) { + coords[3] = MIN2(coords[3], bounds[3]); + if ((coords[1] + coords[3]) > (bounds[1] + bounds[3])) { + coords[3] = (bounds[1] + bounds[3]) - coords[1]; + } + } +} + +static INLINE void vg_bound_rect(VGfloat coords[4], + const VGfloat bounds[4], + VGfloat shift[4]) +{ + /* if outside the bounds */ + if (coords[0] > (bounds[0] + bounds[2]) || + coords[1] > (bounds[1] + bounds[3]) || + (coords[0] + coords[2]) < bounds[0] || + (coords[1] + coords[3]) < bounds[1]) { + coords[0] = 0.f; + coords[1] = 0.f; + coords[2] = 0.f; + coords[3] = 0.f; + shift[0] = 0.f; + shift[1] = 0.f; + return; + } + + /* bound x */ + if (coords[0] < bounds[0]) { + shift[0] = bounds[0] - coords[0]; + coords[2] -= shift[0]; + coords[0] = bounds[0]; + } else + shift[0] = 0.f; + + /* bound y */ + if (coords[1] < bounds[1]) { + shift[1] = bounds[1] - coords[1]; + coords[3] -= shift[1]; + coords[1] = bounds[1]; + } else + shift[1] = 0.f; + + shift[2] = bounds[2] - coords[2]; + shift[3] = bounds[3] - coords[3]; + /* bound width/height */ + coords[2] = MIN2(coords[2], bounds[2]); + coords[3] = MIN2(coords[3], bounds[3]); + + /* bound x/y + width/height */ + if ((coords[0] + coords[2]) > (bounds[0] + bounds[2])) { + coords[2] = (bounds[0] + bounds[2]) - coords[0]; + } + if ((coords[1] + coords[3]) > (bounds[1] + bounds[3])) { + coords[3] = (bounds[1] + bounds[3]) - coords[1]; + } + + /* if outside the bounds */ + if ((coords[0] + coords[2]) < bounds[0] || + (coords[1] + coords[3]) < bounds[1]) { + coords[0] = 0.f; + coords[1] = 0.f; + coords[2] = 0.f; + coords[3] = 0.f; + return; + } +} + +void *vg_plain_vs(struct vg_context *ctx); +void *vg_clear_vs(struct vg_context *ctx); +void *vg_texture_vs(struct vg_context *ctx); +typedef enum { + VEGA_Y0_TOP, + VEGA_Y0_BOTTOM +} VegaOrientation; +void vg_set_viewport(struct vg_context *ctx, VegaOrientation orientation); + +#endif diff --git a/src/gallium/state_trackers/vega/vg_state.c b/src/gallium/state_trackers/vega/vg_state.c new file mode 100644 index 00000000000..6f6bfdaf7a2 --- /dev/null +++ b/src/gallium/state_trackers/vega/vg_state.c @@ -0,0 +1,124 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "vg_state.h" + +#include <string.h> + +void vg_init_state(struct vg_state *state) +{ + state->matrix_mode = VG_MATRIX_PATH_USER_TO_SURFACE; + state->fill_rule = VG_EVEN_ODD; + state->image_quality = VG_IMAGE_QUALITY_FASTER; + state->rendering_quality = VG_RENDERING_QUALITY_BETTER; + state->blend_mode = VG_BLEND_SRC_OVER; + state->image_mode = VG_DRAW_IMAGE_NORMAL; + + memset(state->scissor_rects, 0, sizeof(state->scissor_rects)); + state->scissor_rects_num = 0; + + state->color_transform = VG_FALSE; + state->color_transform_values[0] = 1.0f; + state->color_transform_values[1] = 1.0f; + state->color_transform_values[2] = 1.0f; + state->color_transform_values[3] = 1.0f; + state->color_transform_values[4] = 0.0f; + state->color_transform_values[5] = 0.0f; + state->color_transform_values[6] = 0.0f; + state->color_transform_values[7] = 0.0f; + + /* Stroke parameters */ + state->stroke.line_width.f = 1.0f; + state->stroke.line_width.i = 1; + state->stroke.cap_style = VG_CAP_BUTT; + state->stroke.join_style = VG_JOIN_MITER; + state->stroke.miter_limit.f = 4.0f; + state->stroke.miter_limit.i = 4; + state->stroke.dash_pattern_num = 0; + state->stroke.dash_phase.f = 0.0f; + state->stroke.dash_phase.i = 0; + state->stroke.dash_phase_reset = VG_FALSE; + + /* Edge fill color for VG_TILE_FILL tiling mode */ + state->tile_fill_color[0] = 0.0f; + state->tile_fill_color[1] = 0.0f; + state->tile_fill_color[2] = 0.0f; + state->tile_fill_color[3] = 0.0f; + + /* Color for vgClear */ + state->clear_color[0] = 0.0f; + state->clear_color[1] = 0.0f; + state->clear_color[2] = 0.0f; + state->clear_color[3] = 0.0f; + + /* Glyph origin */ + state->glyph_origin[0].f = 0.0f; + state->glyph_origin[1].f = 0.0f; + state->glyph_origin[0].i = 0; + state->glyph_origin[1].i = 0; + + /* Enable/disable alpha masking and scissoring */ + state->masking = VG_FALSE; + state->scissoring = VG_FALSE; + + /* Pixel layout information */ + state->pixel_layout = VG_PIXEL_LAYOUT_UNKNOWN; + state->screen_layout = VG_PIXEL_LAYOUT_UNKNOWN; + + /* Source format selection for image filters */ + state->filter_format_linear = VG_FALSE; + state->filter_format_premultiplied = VG_FALSE; + + /* Destination write enable mask for image filters */ + state->filter_channel_mask = (VG_RED | VG_GREEN | VG_BLUE | VG_ALPHA); + + matrix_load_identity(&state->path_user_to_surface_matrix); + matrix_load_identity(&state->image_user_to_surface_matrix); + matrix_load_identity(&state->fill_paint_to_user_matrix); + matrix_load_identity(&state->stroke_paint_to_user_matrix); + matrix_load_identity(&state->glyph_user_to_surface_matrix); +} + +struct matrix *vg_state_matrix(struct vg_state *state) +{ + switch(state->matrix_mode) { + case VG_MATRIX_PATH_USER_TO_SURFACE: + return &state->path_user_to_surface_matrix; + case VG_MATRIX_IMAGE_USER_TO_SURFACE: + return &state->image_user_to_surface_matrix; + case VG_MATRIX_FILL_PAINT_TO_USER: + return &state->fill_paint_to_user_matrix; + case VG_MATRIX_STROKE_PAINT_TO_USER: + return &state->stroke_paint_to_user_matrix; +#ifdef OPENVG_VERSION_1_1 + case VG_MATRIX_GLYPH_USER_TO_SURFACE: + return &state->glyph_user_to_surface_matrix; +#endif + default: + break; + } + return NULL; +} diff --git a/src/gallium/state_trackers/vega/vg_state.h b/src/gallium/state_trackers/vega/vg_state.h new file mode 100644 index 00000000000..ed90689f917 --- /dev/null +++ b/src/gallium/state_trackers/vega/vg_state.h @@ -0,0 +1,109 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 VG_STATE_H +#define VG_STATE_H + +#include "VG/openvg.h" + +#include "api_consts.h" +#include "matrix.h" + +struct vg_value +{ + VGfloat f; + VGint i; +}; + +struct vg_state { + /* Mode settings */ + VGMatrixMode matrix_mode; + VGFillRule fill_rule; + VGImageQuality image_quality; + VGRenderingQuality rendering_quality; + VGBlendMode blend_mode; + VGImageMode image_mode; + + /* Scissoring rectangles */ + struct vg_value scissor_rects[32*4]; + VGint scissor_rects_num; + + /* Color Transformation */ + VGboolean color_transform; + VGfloat color_transform_values[8]; + + /* Stroke parameters */ + struct { + struct vg_value line_width; + VGCapStyle cap_style; + VGJoinStyle join_style; + struct vg_value miter_limit; + struct vg_value dash_pattern[VEGA_MAX_DASH_COUNT]; + VGint dash_pattern_num; + struct vg_value dash_phase; + VGboolean dash_phase_reset; + } stroke; + + /* Edge fill color for VG_TILE_FILL tiling mode */ + VGfloat tile_fill_color[4]; + VGint tile_fill_colori[4]; + + /* Color for vgClear */ + VGfloat clear_color[4]; + VGint clear_colori[4]; + + /* Glyph origin */ + struct vg_value glyph_origin[2]; + + /* Enable/disable alpha masking and scissoring */ + VGboolean masking; + VGboolean scissoring; + + /* Pixel layout information */ + VGPixelLayout pixel_layout; + VGPixelLayout screen_layout; + + /* Source format selection for image filters */ + VGboolean filter_format_linear; + VGboolean filter_format_premultiplied; + + /* Destination write enable mask for image filters */ + VGbitfield filter_channel_mask; + + struct matrix path_user_to_surface_matrix; + struct matrix image_user_to_surface_matrix; + struct matrix fill_paint_to_user_matrix; + struct matrix stroke_paint_to_user_matrix; + struct matrix glyph_user_to_surface_matrix; + + struct vg_paint *stroke_paint; + struct vg_paint *fill_paint; +}; + +void vg_init_state(struct vg_state *state); +struct matrix * vg_state_matrix(struct vg_state *state); + +#endif diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c new file mode 100644 index 00000000000..c262ce08fa9 --- /dev/null +++ b/src/gallium/state_trackers/vega/vg_tracker.c @@ -0,0 +1,406 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "vg_context.h" +#include "vg_tracker.h" +#include "mask.h" + +#include "pipe/p_context.h" +#include "pipe/p_inlines.h" +#include "pipe/p_screen.h" +#include "util/u_memory.h" +#include "util/u_math.h" + +static struct pipe_texture * +create_texture(struct pipe_context *pipe, enum pipe_format format, + VGint width, VGint height) +{ + struct pipe_texture templ; + + memset(&templ, 0, sizeof(templ)); + + if (format != PIPE_FORMAT_NONE) { + templ.format = format; + } + else { + templ.format = PIPE_FORMAT_A8R8G8B8_UNORM; + } + + templ.target = PIPE_TEXTURE_2D; + pf_get_block(templ.format, &templ.block); + templ.width[0] = width; + templ.height[0] = height; + templ.depth[0] = 1; + templ.last_level = 0; + + if (pf_get_component_bits(format, PIPE_FORMAT_COMP_S)) { + templ.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; + } else { + templ.tex_usage = (PIPE_TEXTURE_USAGE_DISPLAY_TARGET | + PIPE_TEXTURE_USAGE_RENDER_TARGET | + PIPE_TEXTURE_USAGE_SAMPLER); + } + + return pipe->screen->texture_create(pipe->screen, &templ); +} + +/** + * Allocate a renderbuffer for a an on-screen window (not a user-created + * renderbuffer). The window system code determines the format. + */ +static struct st_renderbuffer * +st_new_renderbuffer_fb(enum pipe_format format) +{ + struct st_renderbuffer *strb; + + strb = CALLOC_STRUCT(st_renderbuffer); + if (!strb) { + /*_vega_error(NULL, VG_OUT_OF_MEMORY, "creating renderbuffer");*/ + return NULL; + } + + strb->format = format; + + return strb; +} + + +/** + * This is called to allocate the original drawing surface, and + * during window resize. + */ +static VGboolean +st_renderbuffer_alloc_storage(struct vg_context * ctx, + struct st_renderbuffer *strb, + VGuint width, VGuint height) +{ + struct pipe_context *pipe = ctx->pipe; + unsigned surface_usage; + + /* Free the old surface and texture + */ + pipe_surface_reference(&strb->surface, NULL); + pipe_texture_reference(&strb->texture, NULL); + + + /* Probably need dedicated flags for surface usage too: + */ + surface_usage = (PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE); + + strb->texture = create_texture(pipe, strb->format, + width, height); + + if (!strb->texture) + return FALSE; + + strb->surface = pipe->screen->get_tex_surface(pipe->screen, + strb->texture, + 0, 0, 0, + surface_usage); + strb->width = width; + strb->height = height; + + assert(strb->surface->width == width); + assert(strb->surface->height == height); + + return strb->surface != NULL; +} + +struct vg_context * st_create_context(struct pipe_context *pipe, + const void *visual, + struct vg_context *share) +{ + struct vg_context *ctx = vg_create_context(pipe, visual, share); + /*debug_printf("--------- CREATE CONTEXT %p\n", ctx);*/ + return ctx; +} + +void st_destroy_context(struct vg_context *st) +{ + /*debug_printf("--------- DESTROY CONTEXT %p\n", st);*/ + vg_destroy_context(st); +} + +void st_copy_context_state(struct vg_context *dst, struct vg_context *src, + uint mask) +{ + fprintf(stderr, "FIXME: %s\n", __FUNCTION__); +} + +void st_get_framebuffer_dimensions(struct st_framebuffer *stfb, + uint *width, + uint *height) +{ + *width = stfb->strb->width; + *height = stfb->strb->height; +} + +struct st_framebuffer * st_create_framebuffer(const void *visual, + enum pipe_format colorFormat, + enum pipe_format depthFormat, + enum pipe_format stencilFormat, + uint width, uint height, + void *privateData) +{ + struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer); + if (stfb) { + struct st_renderbuffer *rb = + st_new_renderbuffer_fb(colorFormat); + stfb->strb = rb; +#if 0 + if (doubleBuffer) { + struct st_renderbuffer *rb = + st_new_renderbuffer_fb(colorFormat); + } +#endif + + /* we want to combine the depth/stencil */ + if (stencilFormat == depthFormat) + stfb->dsrb = st_new_renderbuffer_fb(stencilFormat); + else + stfb->dsrb = st_new_renderbuffer_fb(PIPE_FORMAT_S8Z24_UNORM); + + /*### currently we always allocate it but it's possible it's + not necessary if EGL_ALPHA_MASK_SIZE was 0 + */ + stfb->alpha_mask = 0; + + stfb->init_width = width; + stfb->init_height = height; + stfb->privateData = privateData; + } + + return stfb; +} + +static void setup_new_alpha_mask(struct vg_context *ctx, + struct st_framebuffer *stfb, + uint width, uint height) +{ + struct pipe_context *pipe = ctx->pipe; + struct pipe_texture *old_texture = stfb->alpha_mask; + + /* + we use PIPE_FORMAT_A8R8G8B8_UNORM because we want to render to + this texture and use it as a sampler, so while this wastes some + space it makes both of those a lot simpler + */ + stfb->alpha_mask = + create_texture(pipe, PIPE_FORMAT_A8R8G8B8_UNORM, width, height); + + if (!stfb->alpha_mask) { + if (old_texture) + pipe_texture_reference(&old_texture, NULL); + return; + } + + vg_validate_state(ctx); + + /* alpha mask starts with 1.f alpha */ + mask_fill(0, 0, width, height, 1.f); + + /* if we had an old surface copy it over */ + if (old_texture) { + struct pipe_surface *surface = pipe->screen->get_tex_surface( + pipe->screen, + stfb->alpha_mask, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + struct pipe_surface *old_surface = pipe->screen->get_tex_surface( + pipe->screen, + old_texture, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_READ); + pipe->surface_copy(pipe, + surface, + 0, 0, + old_surface, + 0, 0, + MIN2(old_surface->width, width), + MIN2(old_surface->height, height)); + if (surface) + pipe_surface_reference(&surface, NULL); + if (old_surface) + pipe_surface_reference(&old_surface, NULL); + } + + /* Free the old texture + */ + if (old_texture) + pipe_texture_reference(&old_texture, NULL); +} + +void st_resize_framebuffer(struct st_framebuffer *stfb, + uint width, uint height) +{ + struct vg_context *ctx = vg_current_context(); + struct st_renderbuffer *strb = stfb->strb; + struct pipe_framebuffer_state *state; + + if (!ctx) + return; + + state = &ctx->state.g3d.fb; + + /* If this is a noop, exit early and don't do the clear, etc below. + */ + if (strb->width == width && + strb->height == height && + state->zsbuf) + return; + + if (strb->width != width || strb->height != height) + st_renderbuffer_alloc_storage(ctx, strb, + width, height); + + if (stfb->dsrb->width != width || stfb->dsrb->height != height) + st_renderbuffer_alloc_storage(ctx, stfb->dsrb, + width, height); + + { + VGuint i; + + memset(state, 0, sizeof(struct pipe_framebuffer_state)); + + state->width = width; + state->height = height; + + state->nr_cbufs = 1; + state->cbufs[0] = strb->surface; + for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) + state->cbufs[i] = 0; + + state->zsbuf = stfb->dsrb->surface; + + cso_set_framebuffer(ctx->cso_context, state); + } + + ctx->state.dirty |= VIEWPORT_DIRTY; + ctx->state.dirty |= DEPTH_STENCIL_DIRTY;/*to reset the scissors*/ + + ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_DEPTHSTENCIL, + NULL, 0.0, 0); + + /* we need all the other state already set */ + + setup_new_alpha_mask(ctx, stfb, width, height); + + pipe_texture_reference( &stfb->blend_texture, NULL ); + stfb->blend_texture = create_texture(ctx->pipe, PIPE_FORMAT_A8R8G8B8_UNORM, + width, height); +} + +void st_set_framebuffer_surface(struct st_framebuffer *stfb, + uint surfIndex, struct pipe_surface *surf) +{ + struct st_renderbuffer *rb = stfb->strb; + + /* unreference existing surfaces */ + pipe_surface_reference( &rb->surface, NULL ); + pipe_texture_reference( &rb->texture, NULL ); + + /* reference new ones */ + pipe_surface_reference( &rb->surface, surf ); + pipe_texture_reference( &rb->texture, surf->texture ); + + rb->width = surf->width; + rb->height = surf->height; +} + +int st_get_framebuffer_surface(struct st_framebuffer *stfb, + uint surfIndex, struct pipe_surface **surf) +{ + struct st_renderbuffer *rb = stfb->strb; + *surf = rb->surface; + return VG_TRUE; +} + +int st_get_framebuffer_texture(struct st_framebuffer *stfb, + uint surfIndex, struct pipe_texture **tex) +{ + struct st_renderbuffer *rb = stfb->strb; + *tex = rb->texture; + return VG_TRUE; +} + +void * st_framebuffer_private(struct st_framebuffer *stfb) +{ + return stfb->privateData; +} + +void st_unreference_framebuffer(struct st_framebuffer *stfb) +{ + /* FIXME */ +} + +void st_make_current(struct vg_context *st, + struct st_framebuffer *draw, + struct st_framebuffer *read) +{ + vg_set_current_context(st); + if (st) { + st->draw_buffer = draw; + } +} + +void st_flush(struct vg_context *st, uint pipeFlushFlags, + struct pipe_fence_handle **fence) +{ + st->pipe->flush(st->pipe, pipeFlushFlags, fence); +} + +void st_finish(struct vg_context *st) +{ + struct pipe_fence_handle *fence = NULL; + + st_flush(st, PIPE_FLUSH_RENDER_CACHE, &fence); + + st->pipe->screen->fence_finish(st->pipe->screen, fence, 0); + st->pipe->screen->fence_reference(st->pipe->screen, &fence, NULL); +} + +void st_notify_swapbuffers(struct st_framebuffer *stfb) +{ + struct vg_context *ctx = vg_current_context(); + if (ctx && ctx->draw_buffer == stfb) { + st_flush(ctx, + PIPE_FLUSH_RENDER_CACHE | + PIPE_FLUSH_SWAPBUFFERS | + PIPE_FLUSH_FRAME, + NULL); + } +} + +void st_notify_swapbuffers_complete(struct st_framebuffer *stfb) +{ +} + +int +st_set_teximage(struct pipe_texture *pt, int target) +{ + return 0; +} diff --git a/src/gallium/state_trackers/vega/vg_tracker.h b/src/gallium/state_trackers/vega/vg_tracker.h new file mode 100644 index 00000000000..805c58ccc70 --- /dev/null +++ b/src/gallium/state_trackers/vega/vg_tracker.h @@ -0,0 +1,102 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 VG_TRACKER_H +#define VG_TRACKER_H + +#include "VG/openvg.h" + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" + +#define ST_SURFACE_FRONT_LEFT 0 +#define ST_SURFACE_BACK_LEFT 1 +#define ST_SURFACE_FRONT_RIGHT 2 +#define ST_SURFACE_BACK_RIGHT 3 +#define ST_SURFACE_DEPTH 8 + +struct vg_context; +struct st_framebuffer; +struct pipe_context; +struct pipe_fence_handle; +struct pipe_surface; + + +struct vg_context *st_create_context(struct pipe_context *pipe, + const void *visual, + struct vg_context *share); + +void st_destroy_context( struct vg_context *st ); + +void st_copy_context_state(struct vg_context *dst, struct vg_context *src, + uint mask); + +struct st_framebuffer *st_create_framebuffer(const void *visual, + enum pipe_format colorFormat, + enum pipe_format depthFormat, + enum pipe_format stencilFormat, + uint width, uint height, + void *privateData); + +void st_resize_framebuffer(struct st_framebuffer *stfb, + uint width, uint height); + +void st_set_framebuffer_surface(struct st_framebuffer *stfb, + uint surfIndex, struct pipe_surface *surf); + +void st_get_framebuffer_dimensions( struct st_framebuffer *stfb, + uint *width, uint *height); + +int st_set_teximage(struct pipe_texture *pt, int target); + +int st_get_framebuffer_surface(struct st_framebuffer *stfb, + uint surfIndex, struct pipe_surface **surf); + +int st_get_framebuffer_texture(struct st_framebuffer *stfb, + uint surfIndex, struct pipe_texture **tex); + +void *st_framebuffer_private(struct st_framebuffer *stfb); + +void st_unreference_framebuffer(struct st_framebuffer *stfb); + +void st_make_current(struct vg_context *st, + struct st_framebuffer *draw, + struct st_framebuffer *read); + +void st_flush(struct vg_context *st, uint pipeFlushFlags, + struct pipe_fence_handle **fence); +void st_finish(struct vg_context *st); + +void st_notify_swapbuffers(struct st_framebuffer *stfb); +void st_notify_swapbuffers_complete(struct st_framebuffer *stfb); + + +/** Generic function type */ +typedef void (*st_proc)(); + +st_proc st_get_proc_address(const char *procname); + +#endif diff --git a/src/gallium/state_trackers/vega/vg_translate.c b/src/gallium/state_trackers/vega/vg_translate.c new file mode 100644 index 00000000000..00e07647062 --- /dev/null +++ b/src/gallium/state_trackers/vega/vg_translate.c @@ -0,0 +1,1030 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "vg_translate.h" + +#include "pipe/p_format.h" +#include "util/u_pack_color.h" + +void _vega_pack_rgba_span_float(struct vg_context *ctx, + VGuint n, VGfloat rgba[][4], + VGImageFormat dstFormat, + void *dstAddr) +{ + VGint i; + + switch (dstFormat) { + case VG_sRGBX_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = 255; + dst[i] = r << 24 | g << 16 | b << 8 | a; + } + return; + } + break; + case VG_sRGBA_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = r << 24 | g << 16 | b << 8 | a; + } + return; + } + break; + case VG_sRGBA_8888_PRE: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = r << 24 | g << 16 | b << 8 | a; + } + return; + } + break; + case VG_sRGB_565: { + VGshort *dst = (VGshort *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + r = (r / 255.0) * 32; + g = (g / 255.0) * 32; + b = (b / 255.0) * 32; + + dst[i] = b | g << 5 | r << 11; + } + return; + } + break; + case VG_sRGBA_5551: { + VGshort *dst = (VGshort *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b, a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + r = (r / 255.0) * 32; + g = (g / 255.0) * 32; + b = (b / 255.0) * 32; + a = (a / 255.0); + + dst[i] = a | b << 1 | g << 6 | r << 11; + } + return; + } + break; + case VG_sRGBA_4444: { + VGshort *dst = (VGshort *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b, a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + r = (r / 255.0) * 16; + g = (g / 255.0) * 16; + b = (b / 255.0) * 16; + a = (a / 255.0) * 16; + + dst[i] = a | b << 4 | g << 8 | r << 12; + } + return; + } + break; + case VG_sL_8: { + VGubyte *dst = (VGubyte *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b, a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + + dst[i] = a; + } + return; + } + break; + case VG_lRGBX_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = 255; + dst[i] = r << 24 | g << 16 | b << 8 | a; + } + return; + } + break; + case VG_lRGBA_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = r << 24 | g << 16 | b << 8 | a; + } + return; + } + case VG_lRGBA_8888_PRE: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = r << 24 | g << 16 | b << 8 | a; + } + return; + } + break; + case VG_lL_8: { + VGubyte *dst = (VGubyte *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = a; + } + return; + } + break; + case VG_A_8: { + VGubyte *dst = (VGubyte *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b, a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + + dst[i] = a; + } + return; + } + break; + case VG_BW_1: { + VGshort *dst = (VGshort *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b, a; + VGubyte res; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + + res = (r + g + b + a)/4; + dst[i] = (res & (128)); + } + return; + } + break; +#ifdef OPENVG_VERSION_1_1 + case VG_A_1: { + VGshort *dst = (VGshort *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b, a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + + dst[i] = (a & (128)); + } + return; + } + break; + case VG_A_4: { + VGshort *dst = (VGshort *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b, a; + VGubyte res; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + + res = a/4; + dst[i] = (res & (128)); + } + return; + } + break; +#endif + case VG_sXRGB_8888: + break; + case VG_sARGB_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = a << 24 | r << 16 | g << 8 | b; + } + return; + } + break; + case VG_sARGB_8888_PRE: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = a << 24 | r << 16 | g << 8 | b; + } + return; + } + break; + case VG_sARGB_1555: + break; + case VG_sARGB_4444: + break; + case VG_lXRGB_8888: + break; + case VG_lARGB_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = a << 24 | r << 16 | g << 8 | b; + } + return; + } + break; + case VG_lARGB_8888_PRE: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = a << 24 | r << 16 | g << 8 | b; + } + return; + } + break; + case VG_sBGRX_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = 0xff; + dst[i] = b << 24 | g << 16 | r << 8 | a; + } + return; + } + break; + case VG_sBGRA_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = b << 24 | g << 16 | r << 8 | a; + } + return; + } + break; + case VG_sBGRA_8888_PRE: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = b << 24 | g << 16 | r << 8 | a; + } + return; + } + break; + case VG_sBGR_565: + break; + case VG_sBGRA_5551: + break; + case VG_sBGRA_4444: + break; + case VG_lBGRX_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = 0xff; + dst[i] = b << 24 | g << 16 | r << 8 | a; + } + return; + } + break; + case VG_lBGRA_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = b << 24 | g << 16 | r << 8 | a; + } + return; + } + break; + case VG_lBGRA_8888_PRE: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = b << 24 | g << 16 | r << 8 | a; + } + return; + } + break; + case VG_sXBGR_8888: + break; + case VG_sABGR_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = a << 24 | b << 16 | g << 8 | r; + } + return; + } + break; + case VG_sABGR_8888_PRE: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = a << 24 | b << 16 | g << 8 | r; + } + return; + } + break; + case VG_sABGR_1555: + break; + case VG_sABGR_4444: + break; + case VG_lXBGR_8888: + break; + case VG_lABGR_8888: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = a << 24 | b << 16 | g << 8 | r; + } + return; + } + break; + case VG_lABGR_8888_PRE: { + VGint *dst = (VGint *)dstAddr; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = float_to_ubyte(rgba[i][0]); + g = float_to_ubyte(rgba[i][1]); + b = float_to_ubyte(rgba[i][2]); + a = float_to_ubyte(rgba[i][3]); + dst[i] = a << 24 | b << 16 | g << 8 | r; + } + return; + } + break; + default: + assert(!"Unknown ReadPixels format"); + break; + } + assert(!"Not implemented ReadPixels format"); +} + +void _vega_unpack_float_span_rgba(struct vg_context *ctx, + VGuint n, + VGuint offset, + const void * data, + VGImageFormat dataFormat, + VGfloat rgba[][4]) +{ + VGint i; + + switch (dataFormat) { + case VG_sRGBX_8888: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + b = (*src >> 8) & 0xff; + a = 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + } + return; + case VG_sRGBA_8888: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + b = (*src >> 8) & 0xff; + a = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sRGBA_8888_PRE: { + VGint *src = (VGint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + b = (*src >> 8) & 0xff; + a = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sRGB_565: { + VGshort *src = (VGshort *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGfloat clr[4]; + clr[0] = ((*src >> 10) & 31)/31.; + clr[1] = ((*src >> 5) & 95)/95.; + clr[2] = ((*src >> 0) & 31)/31.; + clr[3] = 1.f; + + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + } + return; + case VG_sRGBA_5551: { + VGshort *src = (VGshort *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGfloat clr[4]; + clr[0] = ((*src >> 10) & 31)/31.; + clr[1] = ((*src >> 5) & 31)/31.; + clr[2] = ((*src >> 1) & 31)/31.; + clr[3] = ((*src >> 0) & 1)/1.; + + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + } + return; + case VG_sRGBA_4444: { + VGshort *src = (VGshort *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGfloat clr[4]; + clr[0] = ((*src >> 12) & 15)/15.; + clr[1] = ((*src >> 8) & 15)/15.; + clr[2] = ((*src >> 4) & 15)/15.; + clr[3] = ((*src >> 0) & 15)/15.; + + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + } + return; + case VG_sL_8: { + VGubyte *src = (VGubyte *)data; + src += offset; + for (i = 0; i < n; ++i) { + util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + } + return; + case VG_lRGBX_8888: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + b = (*src >> 8) & 0xff; + a = 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + } + return; + case VG_lRGBA_8888: { + VGint *src = (VGint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + b = (*src >> 8) & 0xff; + a = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_lRGBA_8888_PRE: { + VGint *src = (VGint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + r = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + b = (*src >> 8) & 0xff; + a = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_lL_8: { + VGubyte *src = (VGubyte *)data; + src += offset; + for (i = 0; i < n; ++i) { + util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + } + return; + case VG_A_8: { + VGubyte *src = (VGubyte *)data; + src += offset; + for (i = 0; i < n; ++i) { + util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + } + return; + case VG_BW_1: { + VGubyte *src = (VGubyte *)data; + src += offset; + for (i = 0; i < n; i += 8) { + VGfloat clr[4]; + VGint j; + for (j = 0; j < 8 && j < n ; ++j) { + VGint shift = j; + clr[0] = (((*src) & (1<<shift)) >> shift); + clr[1] = clr[0]; + clr[2] = clr[0]; + clr[3] = 1.f; + + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i+j]); + } + ++src; + } + } + return; +#ifdef OPENVG_VERSION_1_1 + case VG_A_1: { + VGubyte *src = (VGubyte *)data; + src += offset; + for (i = 0; i < n; i += 8) { + VGfloat clr[4]; + VGint j; + for (j = 0; j < 8 && j < n ; ++j) { + VGint shift = j; + clr[0] = 0.f; + clr[1] = 0.f; + clr[2] = 0.f; + clr[3] = (((*src) & (1<<shift)) >> shift); + + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i+j]); + } + ++src; + } + } + return; + case VG_A_4: { + VGubyte *src = (VGubyte *)data; + src += offset/2; + for (i = 0; i < n; i += 2) { + VGfloat clr[4]; + VGint j; + for (j = 0; j < n && j < 2; ++j) { + VGint bitter, shift; + if (j == 0) { + bitter = 0x0f; + shift = 0; + } else { + bitter = 0xf0; + shift = 4; + } + clr[0] = 0.f; + clr[1] = 0.f; + clr[2] = 0.f; + clr[3] = ((*src) & (bitter)) >> shift; + + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i +j]); + } + ++src; + } + } + return; +#endif + case VG_sXRGB_8888: + break; + case VG_sARGB_8888: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + a = (*src >> 24) & 0xff; + r = (*src >> 16) & 0xff; + g = (*src >> 8) & 0xff; + b = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sARGB_8888_PRE: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + a = (*src >> 24) & 0xff; + r = (*src >> 16) & 0xff; + g = (*src >> 8) & 0xff; + b = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sARGB_1555: + break; + case VG_sARGB_4444: + break; + case VG_lXRGB_8888: + break; + case VG_lARGB_8888: { + VGint *src = (VGint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + a = (*src >> 24) & 0xff; + r = (*src >> 16) & 0xff; + g = (*src >> 8) & 0xff; + b = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_lARGB_8888_PRE: { + VGint *src = (VGint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + a = (*src >> 24) & 0xff; + r = (*src >> 16) & 0xff; + g = (*src >> 8) & 0xff; + b = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sBGRX_8888: + break; + case VG_sBGRA_8888: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + b = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + r = (*src >> 8) & 0xff; + a = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sBGRA_8888_PRE: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + b = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + r = (*src >> 8) & 0xff; + a = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sBGR_565: + break; + case VG_sBGRA_5551: + break; + case VG_sBGRA_4444: + break; + case VG_lBGRX_8888: + break; + case VG_lBGRA_8888: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + b = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + r = (*src >> 8) & 0xff; + a = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_lBGRA_8888_PRE: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + b = (*src >> 24) & 0xff; + g = (*src >> 16) & 0xff; + r = (*src >> 8) & 0xff; + a = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sXBGR_8888: + break; + case VG_sABGR_8888: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + a = (*src >> 24) & 0xff; + b = (*src >> 16) & 0xff; + g = (*src >> 8) & 0xff; + r = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sABGR_8888_PRE: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + a = (*src >> 24) & 0xff; + b = (*src >> 16) & 0xff; + g = (*src >> 8) & 0xff; + r = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_sABGR_1555: + break; + case VG_sABGR_4444: + break; + case VG_lXBGR_8888: + break; + case VG_lABGR_8888: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + a = (*src >> 24) & 0xff; + b = (*src >> 16) & 0xff; + g = (*src >> 8) & 0xff; + r = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + case VG_lABGR_8888_PRE: { + VGuint *src = (VGuint *)data; + src += offset; + for (i = 0; i < n; ++i) { + VGubyte r, g, b ,a; + a = (*src >> 24) & 0xff; + b = (*src >> 16) & 0xff; + g = (*src >> 8) & 0xff; + r = (*src >> 0) & 0xff; + + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, + rgba[i]); + ++src; + } + return; + } + break; + default: + assert(!"Unknown ReadPixels format"); + break; + } + assert(!"Not implemented ReadPixels format"); +} + +VGint _vega_size_for_format(VGImageFormat dataFormat) +{ + switch (dataFormat) { + case VG_sRGBX_8888: + case VG_sRGBA_8888: + case VG_sRGBA_8888_PRE: + return 4; + case VG_sRGB_565: + case VG_sRGBA_5551: + case VG_sRGBA_4444: + return 2; + case VG_sL_8: + return 1; + case VG_lRGBX_8888: + case VG_lRGBA_8888: + case VG_lRGBA_8888_PRE: + return 4; + case VG_lL_8: + return 1; + case VG_A_8: + return 1; + case VG_BW_1: + return 1; +#ifdef OPENVG_VERSION_1_1 + case VG_A_1: + break; + case VG_A_4: + break; +#endif + case VG_sXRGB_8888: + case VG_sARGB_8888: + case VG_sARGB_8888_PRE: + return 4; + case VG_sARGB_1555: + case VG_sARGB_4444: + return 2; + case VG_lXRGB_8888: + case VG_lARGB_8888: + case VG_lARGB_8888_PRE: + case VG_sBGRX_8888: + case VG_sBGRA_8888: + case VG_sBGRA_8888_PRE: + return 4; + case VG_sBGR_565: + case VG_sBGRA_5551: + case VG_sBGRA_4444: + return 2; + case VG_lBGRX_8888: + case VG_lBGRA_8888: + case VG_lBGRA_8888_PRE: + case VG_sXBGR_8888: + case VG_sABGR_8888: + case VG_sABGR_8888_PRE: + return 4; + case VG_sABGR_1555: + case VG_sABGR_4444: + return 2; + case VG_lXBGR_8888: + case VG_lABGR_8888: + case VG_lABGR_8888_PRE: + return 4; + default: + assert(!"Unknown ReadPixels format"); + break; + } + assert(!"Not implemented ReadPixels format"); + return 0; +} diff --git a/src/gallium/state_trackers/vega/vg_translate.h b/src/gallium/state_trackers/vega/vg_translate.h new file mode 100644 index 00000000000..70815bacbcb --- /dev/null +++ b/src/gallium/state_trackers/vega/vg_translate.h @@ -0,0 +1,49 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 VG_TRANSLATE_H +#define VG_TRANSLATE_H + +#include "VG/openvg.h" +#include "vg_context.h" + +/*FIXME: we really should be using translate module + * but pipe_format can't express some of the VG formats + * (the premultiplied ones) so currently it won't work */ + +void _vega_pack_rgba_span_float(struct vg_context *ctx, + VGuint n, VGfloat rgba[][4], + VGImageFormat dstFormat, + void *dstAddr); +void _vega_unpack_float_span_rgba(struct vg_context *ctx, + VGuint n, + VGuint offset, + const void * data, + VGImageFormat dataFormat, + VGfloat rgba[][4]); +VGint _vega_size_for_format(VGImageFormat format); + +#endif diff --git a/src/gallium/state_trackers/vega/vgu.c b/src/gallium/state_trackers/vega/vgu.c new file mode 100644 index 00000000000..7dc51c5599c --- /dev/null +++ b/src/gallium/state_trackers/vega/vgu.c @@ -0,0 +1,450 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. 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 VMWARE 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 "VG/openvg.h" +#include "VG/vgu.h" + +#include "matrix.h" +#include "path.h" + +#include "util/u_debug.h" +#include "util/u_pointer.h" + +#include <math.h> +#include <assert.h> + +static VGboolean is_aligned_to(const void *ptr, VGbyte alignment) +{ + void *aligned = align_pointer(ptr, alignment); + return (ptr == aligned) ? VG_TRUE : VG_FALSE; +} + +static VGboolean is_aligned(const void *ptr) +{ + return is_aligned_to(ptr, 4); +} + +static void vgu_append_float_coords(VGPath path, + const VGubyte *cmds, + VGint num_cmds, + const VGfloat *coords, + VGint num_coords) +{ + VGubyte common_data[40 * sizeof(VGfloat)]; + struct path *p = (struct path *)path; + + vg_float_to_datatype(path_datatype(p), common_data, coords, num_coords); + vgAppendPathData(path, num_cmds, cmds, common_data); +} + +VGUErrorCode vguLine(VGPath path, + VGfloat x0, VGfloat y0, + VGfloat x1, VGfloat y1) +{ + static const VGubyte cmds[] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS}; + VGfloat coords[4]; + VGbitfield caps; + + if (path == VG_INVALID_HANDLE) { + return VGU_BAD_HANDLE_ERROR; + } + caps = vgGetPathCapabilities(path); + if (!(caps & VG_PATH_CAPABILITY_APPEND_TO)) { + return VGU_PATH_CAPABILITY_ERROR; + } + + coords[0] = x0; + coords[1] = y0; + coords[2] = x1; + coords[3] = y1; + + vgu_append_float_coords(path, cmds, 2, coords, 4); + + return VGU_NO_ERROR; +} + +VGUErrorCode vguPolygon(VGPath path, + const VGfloat * points, + VGint count, + VGboolean closed) +{ + VGubyte *cmds; + VGfloat *coords; + VGbitfield caps; + VGint i; + + if (path == VG_INVALID_HANDLE) { + return VGU_BAD_HANDLE_ERROR; + } + + if (!points || count <= 0 || !is_aligned(points)) { + return VGU_ILLEGAL_ARGUMENT_ERROR; + } + + caps = vgGetPathCapabilities(path); + if (!(caps & VG_PATH_CAPABILITY_APPEND_TO)) { + return VGU_PATH_CAPABILITY_ERROR; + } + + cmds = malloc(sizeof(VGubyte) * count + 1); + coords = malloc(sizeof(VGfloat) * count * 2); + + cmds[0] = VG_MOVE_TO_ABS; + coords[0] = points[0]; + coords[1] = points[1]; + for (i = 1; i < count; ++i) { + cmds[i] = VG_LINE_TO_ABS; + coords[2*i + 0] = points[2*i + 0]; + coords[2*i + 1] = points[2*i + 1]; + } + + if (closed) { + cmds[i] = VG_CLOSE_PATH; + ++i; + } + + vgu_append_float_coords(path, cmds, i, coords, 2*i); + + free(cmds); + free(coords); + + return VGU_NO_ERROR; +} + +VGUErrorCode vguRect(VGPath path, + VGfloat x, VGfloat y, + VGfloat width, VGfloat height) +{ + static const VGubyte cmds[] = {VG_MOVE_TO_ABS, + VG_HLINE_TO_REL, + VG_VLINE_TO_REL, + VG_HLINE_TO_REL, + VG_CLOSE_PATH + }; + VGfloat coords[5]; + VGbitfield caps; + + if (path == VG_INVALID_HANDLE) { + return VGU_BAD_HANDLE_ERROR; + } + caps = vgGetPathCapabilities(path); + if (!(caps & VG_PATH_CAPABILITY_APPEND_TO)) { + return VGU_PATH_CAPABILITY_ERROR; + } + if (width <= 0 || height <= 0) { + return VGU_ILLEGAL_ARGUMENT_ERROR; + } + + coords[0] = x; + coords[1] = y; + coords[2] = width; + coords[3] = height; + coords[4] = -width; + + vgu_append_float_coords(path, cmds, 5, coords, 5); + + return VGU_NO_ERROR; +} + +VGUErrorCode vguRoundRect(VGPath path, + VGfloat x, VGfloat y, + VGfloat width, + VGfloat height, + VGfloat arcWidth, + VGfloat arcHeight) +{ + static const VGubyte cmds[] = {VG_MOVE_TO_ABS, + VG_HLINE_TO_REL, + VG_SCCWARC_TO_REL, + VG_VLINE_TO_REL, + VG_SCCWARC_TO_REL, + VG_HLINE_TO_REL, + VG_SCCWARC_TO_REL, + VG_VLINE_TO_REL, + VG_SCCWARC_TO_REL, + VG_CLOSE_PATH + }; + VGfloat c[26]; + VGbitfield caps; + + if (path == VG_INVALID_HANDLE) { + return VGU_BAD_HANDLE_ERROR; + } + caps = vgGetPathCapabilities(path); + if (!(caps & VG_PATH_CAPABILITY_APPEND_TO)) { + return VGU_PATH_CAPABILITY_ERROR; + } + if (width <= 0 || height <= 0) { + return VGU_ILLEGAL_ARGUMENT_ERROR; + } + + c[0] = x + arcWidth/2; c[1] = y; + + c[2] = width - arcWidth; + + c[3] = arcWidth/2; c[4] = arcHeight/2; c[5] = 0; + c[6] = arcWidth/2; c[7] = arcHeight/2; + + c[8] = height - arcHeight; + + c[9] = arcWidth/2; c[10] = arcHeight/2; c[11] = 0; + c[12] = -arcWidth/2; c[13] = arcHeight/2; + + c[14] = -(width - arcWidth); + + c[15] = arcWidth/2; c[16] = arcHeight/2; c[17] = 0; + c[18] = -arcWidth/2; c[19] = -arcHeight/2; + + c[20] = -(height - arcHeight); + + c[21] = arcWidth/2; c[22] = arcHeight/2; c[23] = 0; + c[24] = arcWidth/2; c[25] = -arcHeight/2; + + vgu_append_float_coords(path, cmds, 10, c, 26); + + return VGU_NO_ERROR; +} + +VGUErrorCode vguEllipse(VGPath path, + VGfloat cx, VGfloat cy, + VGfloat width, + VGfloat height) +{ + static const VGubyte cmds[] = {VG_MOVE_TO_ABS, + VG_SCCWARC_TO_REL, + VG_SCCWARC_TO_REL, + VG_CLOSE_PATH + }; + VGfloat coords[12]; + VGbitfield caps; + + if (path == VG_INVALID_HANDLE) { + return VGU_BAD_HANDLE_ERROR; + } + caps = vgGetPathCapabilities(path); + if (!(caps & VG_PATH_CAPABILITY_APPEND_TO)) { + return VGU_PATH_CAPABILITY_ERROR; + } + if (width <= 0 || height <= 0) { + return VGU_ILLEGAL_ARGUMENT_ERROR; + } + + coords[0] = cx + width/2; coords[1] = cy; + + coords[2] = width/2; coords[3] = height/2; coords[4] = 0; + coords[5] = -width; coords[6] = 0; + + coords[7] = width/2; coords[8] = height/2; coords[9] = 0; + coords[10] = width; coords[11] = 0; + + vgu_append_float_coords(path, cmds, 4, coords, 11); + + return VGU_NO_ERROR; +} + +VGUErrorCode vguArc(VGPath path, + VGfloat x, VGfloat y, + VGfloat width, VGfloat height, + VGfloat startAngle, + VGfloat angleExtent, + VGUArcType arcType) +{ + VGubyte cmds[11]; + VGfloat coords[40]; + VGbitfield caps; + VGfloat last = startAngle + angleExtent; + VGint i, c = 0; + + if (path == VG_INVALID_HANDLE) { + return VGU_BAD_HANDLE_ERROR; + } + caps = vgGetPathCapabilities(path); + if (!(caps & VG_PATH_CAPABILITY_APPEND_TO)) { + return VGU_PATH_CAPABILITY_ERROR; + } + if (width <= 0 || height <= 0) { + return VGU_ILLEGAL_ARGUMENT_ERROR; + } + if (arcType != VGU_ARC_OPEN && + arcType != VGU_ARC_CHORD && + arcType != VGU_ARC_PIE) { + return VGU_ILLEGAL_ARGUMENT_ERROR; + } + + cmds[c] = VG_MOVE_TO_ABS; ++c; + coords[0] = x+cos(DEGREES_TO_RADIANS(startAngle))*width/2; + coords[1] = y+sin(DEGREES_TO_RADIANS(startAngle))*height/2; +#ifdef DEBUG_VGUARC + debug_printf("start [%f, %f]\n", coords[0], coords[1]); +#endif + i = 2; + if (angleExtent > 0) { + VGfloat angle = startAngle + 180; + while (angle < last) { + cmds[c] = VG_SCCWARC_TO_ABS; ++c; + coords[i] = width/2; coords[i+1] = height/2; coords[i+2] = 0; + coords[i+3] = x + cos(DEGREES_TO_RADIANS(angle))*width/2; + coords[i+4] = y + sin(DEGREES_TO_RADIANS(angle))*height/2; +#ifdef DEBUG_VGUARC + debug_printf("1 [%f, %f]\n", coords[i+3], + coords[i+4]); +#endif + i += 5; + angle += 180; + } + cmds[c] = VG_SCCWARC_TO_ABS; ++c; + coords[i] = width/2; coords[i+1] = height/2; coords[i+2] = 0; + coords[i+3] = x+cos(DEGREES_TO_RADIANS(last))*width/2; + coords[i+4] = y+sin(DEGREES_TO_RADIANS(last))*height/2; +#ifdef DEBUG_VGUARC + debug_printf("2 [%f, %f]\n", coords[i+3], + coords[i+4]); +#endif + i += 5; + } else { + VGfloat angle = startAngle - 180; + while (angle > last) { + cmds[c] = VG_SCWARC_TO_ABS; ++c; + coords[i] = width/2; coords[i+1] = height/2; coords[i+2] = 0; + coords[i+3] = x + cos(DEGREES_TO_RADIANS(angle)) * width/2; + coords[i+4] = y + sin(DEGREES_TO_RADIANS(angle)) * height/2; +#ifdef DEBUG_VGUARC + debug_printf("3 [%f, %f]\n", coords[i+3], + coords[i+4]); +#endif + angle -= 180; + i += 5; + } + cmds[c] = VG_SCWARC_TO_ABS; ++c; + coords[i] = width/2; coords[i+1] = height/2; coords[i+2] = 0; + coords[i+3] = x + cos(DEGREES_TO_RADIANS(last)) * width/2; + coords[i+4] = y + sin(DEGREES_TO_RADIANS(last)) * height/2; +#ifdef DEBUG_VGUARC + debug_printf("4 [%f, %f]\n", coords[i+3], + coords[i+4]); +#endif + i += 5; + } + + if (arcType == VGU_ARC_PIE) { + cmds[c] = VG_LINE_TO_ABS; ++c; + coords[i] = x; coords[i + 1] = y; + i += 2; + } + if (arcType == VGU_ARC_PIE || arcType == VGU_ARC_CHORD) { + cmds[c] = VG_CLOSE_PATH; + ++c; + } + + assert(c < 11); + + vgu_append_float_coords(path, cmds, c, coords, i); + + return VGU_NO_ERROR; +} + +VGUErrorCode vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0, + VGfloat sx1, VGfloat sy1, + VGfloat sx2, VGfloat sy2, + VGfloat sx3, VGfloat sy3, + VGfloat * matrix) +{ + struct matrix mat; + + if (!matrix || !is_aligned(matrix)) + return VGU_ILLEGAL_ARGUMENT_ERROR; + + if (!matrix_quad_to_square(sx0, sy0, + sx1, sy1, + sx2, sy2, + sx3, sy3, + &mat)) + return VGU_BAD_WARP_ERROR; + + if (!matrix_is_invertible(&mat)) + return VGU_BAD_WARP_ERROR; + + memcpy(matrix, mat.m, sizeof(VGfloat) * 9); + + return VGU_NO_ERROR; +} + +VGUErrorCode vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0, + VGfloat dx1, VGfloat dy1, + VGfloat dx2, VGfloat dy2, + VGfloat dx3, VGfloat dy3, + VGfloat * matrix) +{ + struct matrix mat; + + if (!matrix || !is_aligned(matrix)) + return VGU_ILLEGAL_ARGUMENT_ERROR; + + if (!matrix_square_to_quad(dx0, dy0, + dx1, dy1, + dx2, dy2, + dx3, dy3, + &mat)) + return VGU_BAD_WARP_ERROR; + + if (!matrix_is_invertible(&mat)) + return VGU_BAD_WARP_ERROR; + + memcpy(matrix, mat.m, sizeof(VGfloat) * 9); + + return VGU_NO_ERROR; +} + +VGUErrorCode vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0, + VGfloat dx1, VGfloat dy1, + VGfloat dx2, VGfloat dy2, + VGfloat dx3, VGfloat dy3, + VGfloat sx0, VGfloat sy0, + VGfloat sx1, VGfloat sy1, + VGfloat sx2, VGfloat sy2, + VGfloat sx3, VGfloat sy3, + VGfloat * matrix) +{ + struct matrix mat; + + if (!matrix || !is_aligned(matrix)) + return VGU_ILLEGAL_ARGUMENT_ERROR; + + if (!matrix_quad_to_quad(dx0, dy0, + dx1, dy1, + dx2, dy2, + dx3, dy3, + sx0, sy0, + sx1, sy1, + sx2, sy2, + sx3, sy3, + &mat)) + return VGU_BAD_WARP_ERROR; + + memcpy(matrix, mat.m, sizeof(VGfloat) * 9); + + return VGU_NO_ERROR; +} diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript index 5bbcc7175f7..a0866574876 100644 --- a/src/gallium/state_trackers/wgl/SConscript +++ b/src/gallium/state_trackers/wgl/SConscript @@ -27,6 +27,7 @@ if env['platform'] in ['windows']: 'shared/stw_framebuffer.c', 'shared/stw_pixelformat.c', 'shared/stw_extensionsstring.c', + 'shared/stw_extswapinterval.c', 'shared/stw_getprocaddress.c', 'shared/stw_arbpixelformat.c', 'shared/stw_tls.c', diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 662b5fbcd2a..4968ecc692d 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -47,6 +47,29 @@ #include "stw_context.h" #include "stw_tls.h" + +static INLINE struct stw_context * +stw_context(GLcontext *glctx) +{ + if(!glctx) + return NULL; + assert(glctx->DriverCtx); + return (struct stw_context *)glctx->DriverCtx; +} + +static INLINE struct stw_context * +stw_current_context(void) +{ + /* We must check if multiple threads are being used or GET_CURRENT_CONTEXT + * might return the current context of the thread first seen. */ + _glapi_check_multithread(); + + { + GET_CURRENT_CONTEXT( glctx ); + return stw_context(glctx); + } +} + BOOL stw_copy_context( UINT_PTR hglrcSrc, @@ -57,7 +80,7 @@ stw_copy_context( struct stw_context *dst; BOOL ret = FALSE; - pipe_mutex_lock( stw_dev->mutex ); + pipe_mutex_lock( stw_dev->ctx_mutex ); src = stw_lookup_context_locked( hglrcSrc ); dst = stw_lookup_context_locked( hglrcDst ); @@ -70,7 +93,7 @@ stw_copy_context( (void) mask; } - pipe_mutex_unlock( stw_dev->mutex ); + pipe_mutex_unlock( stw_dev->ctx_mutex ); return ret; } @@ -84,7 +107,7 @@ stw_share_lists( struct stw_context *ctx2; BOOL ret = FALSE; - pipe_mutex_lock( stw_dev->mutex ); + pipe_mutex_lock( stw_dev->ctx_mutex ); ctx1 = stw_lookup_context_locked( hglrc1 ); ctx2 = stw_lookup_context_locked( hglrc2 ); @@ -94,11 +117,25 @@ stw_share_lists( ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx); } - pipe_mutex_unlock( stw_dev->mutex ); + pipe_mutex_unlock( stw_dev->ctx_mutex ); return ret; } +static void +stw_viewport(GLcontext * glctx, GLint x, GLint y, + GLsizei width, GLsizei height) +{ + struct stw_context *ctx = (struct stw_context *)glctx->DriverCtx; + struct stw_framebuffer *fb; + + fb = stw_framebuffer_from_hdc( ctx->hdc ); + if(fb) { + stw_framebuffer_update(fb); + stw_framebuffer_release(fb); + } +} + UINT_PTR stw_create_layer_context( HDC hdc, @@ -158,10 +195,11 @@ stw_create_layer_context( goto no_st_ctx; ctx->st->ctx->DriverCtx = ctx; + ctx->st->ctx->Driver.Viewport = stw_viewport; - pipe_mutex_lock( stw_dev->mutex ); + pipe_mutex_lock( stw_dev->ctx_mutex ); ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx); - pipe_mutex_unlock( stw_dev->mutex ); + pipe_mutex_unlock( stw_dev->ctx_mutex ); if (!ctx->hglrc) goto no_hglrc; @@ -188,17 +226,16 @@ stw_delete_context( if (!stw_dev) return FALSE; - pipe_mutex_lock( stw_dev->mutex ); + pipe_mutex_lock( stw_dev->ctx_mutex ); ctx = stw_lookup_context_locked(hglrc); handle_table_remove(stw_dev->ctx_table, hglrc); - pipe_mutex_unlock( stw_dev->mutex ); + pipe_mutex_unlock( stw_dev->ctx_mutex ); if (ctx) { - GLcontext *glctx = ctx->st->ctx; - GET_CURRENT_CONTEXT( glcurctx ); - + struct stw_context *curctx = stw_current_context(); + /* Unbind current if deleting current context. */ - if (glcurctx == glctx) + if (curctx == ctx) st_make_current( NULL, NULL, NULL ); st_destroy_context(ctx->st); @@ -219,9 +256,9 @@ stw_release_context( if (!stw_dev) return FALSE; - pipe_mutex_lock( stw_dev->mutex ); + pipe_mutex_lock( stw_dev->ctx_mutex ); ctx = stw_lookup_context_locked( hglrc ); - pipe_mutex_unlock( stw_dev->mutex ); + pipe_mutex_unlock( stw_dev->ctx_mutex ); if (!ctx) return FALSE; @@ -230,13 +267,8 @@ stw_release_context( * current for this thread. We should check that and return False * if not the case. */ - { - GLcontext *glctx = ctx->st->ctx; - GET_CURRENT_CONTEXT( glcurctx ); - - if (glcurctx != glctx) - return FALSE; - } + if (ctx != stw_current_context()) + return FALSE; if (stw_make_current( NULL, 0 ) == FALSE) return FALSE; @@ -248,14 +280,9 @@ stw_release_context( UINT_PTR stw_get_current_context( void ) { - GET_CURRENT_CONTEXT( glcurctx ); struct stw_context *ctx; - if(!glcurctx) - return 0; - - ctx = (struct stw_context *)glcurctx->DriverCtx; - assert(ctx); + ctx = stw_current_context(); if(!ctx) return 0; @@ -265,14 +292,9 @@ stw_get_current_context( void ) HDC stw_get_current_dc( void ) { - GET_CURRENT_CONTEXT( glcurctx ); struct stw_context *ctx; - if(!glcurctx) - return NULL; - - ctx = (struct stw_context *)glcurctx->DriverCtx; - assert(ctx); + ctx = stw_current_context(); if(!ctx) return NULL; @@ -284,36 +306,37 @@ stw_make_current( HDC hdc, UINT_PTR hglrc ) { - struct stw_context *ctx; - GET_CURRENT_CONTEXT( glcurctx ); - struct stw_framebuffer *fb; + struct stw_context *curctx = NULL; + struct stw_context *ctx = NULL; + struct stw_framebuffer *fb = NULL; if (!stw_dev) goto fail; - if (glcurctx != NULL) { - struct stw_context *curctx; - curctx = (struct stw_context *) glcurctx->DriverCtx; - + curctx = stw_current_context(); + if (curctx != NULL) { if (curctx->hglrc != hglrc) - st_flush(glcurctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + st_flush(curctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); /* Return if already current. */ - if (curctx->hglrc == hglrc && curctx->hdc == hdc) - return TRUE; + if (curctx->hglrc == hglrc && curctx->hdc == hdc) { + ctx = curctx; + fb = stw_framebuffer_from_hdc( hdc ); + goto success; + } } if (hdc == NULL || hglrc == 0) { return st_make_current( NULL, NULL, NULL ); } - pipe_mutex_lock( stw_dev->mutex ); - + pipe_mutex_lock( stw_dev->ctx_mutex ); ctx = stw_lookup_context_locked( hglrc ); + pipe_mutex_unlock( stw_dev->ctx_mutex ); if(!ctx) goto fail; - fb = stw_framebuffer_from_hdc_locked( hdc ); + fb = stw_framebuffer_from_hdc( hdc ); if(!fb) { /* Applications should call SetPixelFormat before creating a context, * but not all do, and the opengl32 runtime seems to use a default pixel @@ -321,13 +344,11 @@ stw_make_current( */ int iPixelFormat = GetPixelFormat(hdc); if(iPixelFormat) - fb = stw_framebuffer_create_locked( hdc, iPixelFormat ); + fb = stw_framebuffer_create( hdc, iPixelFormat ); if(!fb) goto fail; } - pipe_mutex_unlock( stw_dev->mutex ); - if(fb->iPixelFormat != ctx->iPixelFormat) goto fail; @@ -344,11 +365,18 @@ stw_make_current( if(!st_make_current( ctx->st, fb->stfb, fb->stfb )) goto fail; - stw_framebuffer_resize(fb); +success: + assert(fb); + if(fb) { + stw_framebuffer_update(fb); + stw_framebuffer_release(fb); + } return TRUE; fail: + if(fb) + stw_framebuffer_release(fb); st_make_current( NULL, NULL, NULL ); return FALSE; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index 1a6b29807d7..0b6954915a6 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -30,6 +30,7 @@ #include "glapi/glthread.h" #include "util/u_debug.h" #include "pipe/p_screen.h" +#include "state_tracker/st_public.h" #ifdef DEBUG #include "trace/tr_screen.h" @@ -63,15 +64,36 @@ stw_flush_frontbuffer(struct pipe_screen *screen, { const struct stw_winsys *stw_winsys = stw_dev->stw_winsys; HDC hdc = (HDC)context_private; + struct stw_framebuffer *fb; + fb = stw_framebuffer_from_hdc( hdc ); + /* fb can be NULL if window was destroyed already */ + if (fb) { +#if DEBUG + { + struct pipe_surface *surface2; + + if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 )) + assert(0); + else + assert(surface2 == surface); + } +#endif + #ifdef DEBUG - if(stw_dev->trace_running) { - screen = trace_screen(screen)->screen; - surface = trace_surface(surface)->surface; - } + if(stw_dev->trace_running) { + screen = trace_screen(screen)->screen; + surface = trace_surface(surface)->surface; + } #endif + } stw_winsys->flush_frontbuffer(screen, surface, hdc); + + if(fb) { + stw_framebuffer_update(fb); + stw_framebuffer_release(fb); + } } @@ -113,7 +135,8 @@ stw_init(const struct stw_winsys *stw_winsys) stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer; - pipe_mutex_init( stw_dev->mutex ); + pipe_mutex_init( stw_dev->ctx_mutex ); + pipe_mutex_init( stw_dev->fb_mutex ); stw_dev->ctx_table = handle_table_create(); if (!stw_dev->ctx_table) { @@ -133,20 +156,13 @@ error1: boolean stw_init_thread(void) { - if (!stw_tls_init_thread()) - return FALSE; - - if (!stw_framebuffer_init_thread()) - return FALSE; - - return TRUE; + return stw_tls_init_thread(); } void stw_cleanup_thread(void) { - stw_framebuffer_cleanup_thread(); stw_tls_cleanup_thread(); } @@ -161,7 +177,7 @@ stw_cleanup(void) if (!stw_dev) return; - pipe_mutex_lock( stw_dev->mutex ); + pipe_mutex_lock( stw_dev->ctx_mutex ); { /* Ensure all contexts are destroyed */ i = handle_table_get_first_handle(stw_dev->ctx_table); @@ -171,11 +187,12 @@ stw_cleanup(void) } handle_table_destroy(stw_dev->ctx_table); } - pipe_mutex_unlock( stw_dev->mutex ); + pipe_mutex_unlock( stw_dev->ctx_mutex ); stw_framebuffer_cleanup(); - pipe_mutex_destroy( stw_dev->mutex ); + pipe_mutex_destroy( stw_dev->fb_mutex ); + pipe_mutex_destroy( stw_dev->ctx_mutex ); stw_dev->screen->destroy(stw_dev->screen); diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h index e097f1f71e0..e1bb9518dd1 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.h +++ b/src/gallium/state_trackers/wgl/shared/stw_device.h @@ -57,10 +57,10 @@ struct stw_device unsigned pixelformat_count; unsigned pixelformat_extended_count; - pipe_mutex mutex; - + pipe_mutex ctx_mutex; struct handle_table *ctx_table; + pipe_mutex fb_mutex; struct stw_framebuffer *fb_head; #ifdef DEBUG diff --git a/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c b/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c index 2660c591f9f..62c859e1f92 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c +++ b/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c @@ -38,6 +38,7 @@ static const char *stw_extension_string = "WGL_ARB_extensions_string " "WGL_ARB_multisample " "WGL_ARB_pixel_format " +/* "WGL_EXT_swap_interval " */ "WGL_EXT_extensions_string"; diff --git a/src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c b/src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c new file mode 100644 index 00000000000..9eac6a1d09d --- /dev/null +++ b/src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c @@ -0,0 +1,57 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * 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 TUNGSTEN GRAPHICS 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 <windows.h> + +#define WGL_WGLEXT_PROTOTYPES + +#include <GL/gl.h> +#include <GL/wglext.h> +#include "util/u_debug.h" + +/* A dummy implementation of this extension. + * + * Required as some applications retrieve and call these functions + * regardless of the fact that we don't advertise the extension and + * further more the results of wglGetProcAddress are NULL. + */ +WINGDIAPI BOOL APIENTRY +wglSwapIntervalEXT(int interval) +{ + (void) interval; + debug_printf("%s: %d\n", __FUNCTION__, interval); + return TRUE; +} + +WINGDIAPI int APIENTRY +wglGetSwapIntervalEXT(void) +{ + return 0; +} + + diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 58f18303191..b8956bb5509 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -45,6 +45,10 @@ #include "stw_tls.h" +/** + * Search the framebuffer with the matching HWND while holding the + * stw_dev::fb_mutex global lock. + */ static INLINE struct stw_framebuffer * stw_framebuffer_from_hwnd_locked( HWND hwnd ) @@ -52,13 +56,20 @@ stw_framebuffer_from_hwnd_locked( struct stw_framebuffer *fb; for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) - if (fb->hWnd == hwnd) + if (fb->hWnd == hwnd) { + pipe_mutex_lock(fb->mutex); break; + } return fb; } +/** + * Destroy this framebuffer. Both stw_dev::fb_mutex and stw_framebuffer::mutex + * must be held, by this order. Obviously no further access to fb can be done + * after this. + */ static INLINE void stw_framebuffer_destroy_locked( struct stw_framebuffer *fb ) @@ -74,17 +85,53 @@ stw_framebuffer_destroy_locked( st_unreference_framebuffer(fb->stfb); + pipe_mutex_unlock( fb->mutex ); + pipe_mutex_destroy( fb->mutex ); FREE( fb ); } +void +stw_framebuffer_release( + struct stw_framebuffer *fb) +{ + assert(fb); + pipe_mutex_unlock( fb->mutex ); +} + + +static INLINE void +stw_framebuffer_get_size( struct stw_framebuffer *fb ) +{ + unsigned width, height; + RECT rect; + + assert(fb->hWnd); + + GetClientRect( fb->hWnd, &rect ); + width = rect.right - rect.left; + height = rect.bottom - rect.top; + + if(width < 1) + width = 1; + if(height < 1) + height = 1; + + if(width != fb->width || height != fb->height) { + fb->must_resize = TRUE; + fb->width = width; + fb->height = height; + } +} + + /** * @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx * @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx */ -static LRESULT CALLBACK +LRESULT CALLBACK stw_call_window_proc( int nCode, WPARAM wParam, @@ -92,6 +139,7 @@ stw_call_window_proc( { struct stw_tls_data *tls_data; PCWPSTRUCT pParams = (PCWPSTRUCT)lParam; + struct stw_framebuffer *fb; tls_data = stw_tls_get_data(); if(!tls_data) @@ -100,51 +148,37 @@ stw_call_window_proc( if (nCode < 0) return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); - if (pParams->message == WM_SIZE && pParams->wParam != SIZE_MINIMIZED) { - struct stw_framebuffer *fb; - - pipe_mutex_lock( stw_dev->mutex ); - fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd ); - pipe_mutex_unlock( stw_dev->mutex ); - - if(fb) { - unsigned width = LOWORD( pParams->lParam ); - unsigned height = HIWORD( pParams->lParam ); - - /* FIXME: The mesa statetracker makes the assumptions that only - * one context is using the framebuffer, and that that context is the - * current one. However neither holds true, as WGL allows more than - * one context to be bound to the same drawable, and this function can - * be called from any thread. - */ - pipe_mutex_lock( fb->mutex ); - if (fb->stfb) - st_resize_framebuffer( fb->stfb, width, height ); - pipe_mutex_unlock( fb->mutex ); + if (pParams->message == WM_WINDOWPOSCHANGED) { + /* We handle WM_WINDOWPOSCHANGED instead of WM_SIZE because according to + * http://blogs.msdn.com/oldnewthing/archive/2008/01/15/7113860.aspx + * WM_SIZE is generated from WM_WINDOWPOSCHANGED by DefWindowProc so it + * can be masked out by the application. */ + LPWINDOWPOS lpWindowPos = (LPWINDOWPOS)pParams->lParam; + if((lpWindowPos->flags & SWP_SHOWWINDOW) || + !(lpWindowPos->flags & SWP_NOSIZE)) { + fb = stw_framebuffer_from_hwnd( pParams->hwnd ); + if(fb) { + /* Size in WINDOWPOS includes the window frame, so get the size + * of the client area via GetClientRect. */ + stw_framebuffer_get_size(fb); + stw_framebuffer_release(fb); + } } } - - if (pParams->message == WM_DESTROY) { - struct stw_framebuffer *fb; - - pipe_mutex_lock( stw_dev->mutex ); - + else if (pParams->message == WM_DESTROY) { + pipe_mutex_lock( stw_dev->fb_mutex ); fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd ); if(fb) stw_framebuffer_destroy_locked(fb); - - pipe_mutex_unlock( stw_dev->mutex ); + pipe_mutex_unlock( stw_dev->fb_mutex ); } return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); } -/** - * Create a new framebuffer object which will correspond to the given HDC. - */ struct stw_framebuffer * -stw_framebuffer_create_locked( +stw_framebuffer_create( HDC hdc, int iPixelFormat ) { @@ -169,51 +203,34 @@ stw_framebuffer_create_locked( stw_pixelformat_visual(&fb->visual, pfi); + stw_framebuffer_get_size(fb); + pipe_mutex_init( fb->mutex ); + /* This is the only case where we lock the stw_framebuffer::mutex before + * stw_dev::fb_mutex, since no other thread can know about this framebuffer + * and we must prevent any other thread from destroying it before we return. + */ + pipe_mutex_lock( fb->mutex ); + + pipe_mutex_lock( stw_dev->fb_mutex ); fb->next = stw_dev->fb_head; stw_dev->fb_head = fb; + pipe_mutex_unlock( stw_dev->fb_mutex ); return fb; } -static void -stw_framebuffer_get_size( struct stw_framebuffer *fb, GLuint *pwidth, GLuint *pheight ) -{ - GLuint width, height; - - if (fb->hWnd) { - RECT rect; - GetClientRect( fb->hWnd, &rect ); - width = rect.right - rect.left; - height = rect.bottom - rect.top; - } - else { - width = GetDeviceCaps( fb->hDC, HORZRES ); - height = GetDeviceCaps( fb->hDC, VERTRES ); - } - - if(width < 1) - width = 1; - if(height < 1) - height = 1; - - *pwidth = width; - *pheight = height; -} - - BOOL stw_framebuffer_allocate( struct stw_framebuffer *fb) { - pipe_mutex_lock( fb->mutex ); - + assert(fb); + if(!fb->stfb) { const struct stw_pixelformat_info *pfi = fb->pfi; enum pipe_format colorFormat, depthFormat, stencilFormat; - GLuint width, height; colorFormat = pfi->color_format; @@ -229,32 +246,50 @@ stw_framebuffer_allocate( else stencilFormat = PIPE_FORMAT_NONE; - stw_framebuffer_get_size(fb, &width, &height); - + assert(fb->must_resize); + assert(fb->width); + assert(fb->height); + fb->stfb = st_create_framebuffer( &fb->visual, colorFormat, depthFormat, stencilFormat, - width, - height, + fb->width, + fb->height, (void *) fb ); + + // to notify the context + fb->must_resize = TRUE; } - pipe_mutex_unlock( fb->mutex ); - return fb->stfb ? TRUE : FALSE; } +/** + * Update the framebuffer's size if necessary. + */ void -stw_framebuffer_resize( +stw_framebuffer_update( struct stw_framebuffer *fb) { - GLuint width, height; assert(fb->stfb); - stw_framebuffer_get_size(fb, &width, &height); - st_resize_framebuffer(fb->stfb, width, height); + assert(fb->height); + assert(fb->width); + + /* XXX: It would be nice to avoid checking the size again -- in theory + * stw_call_window_proc would have cought the resize and stored the right + * size already, but unfortunately threads created before the DllMain is + * called don't get a DLL_THREAD_ATTACH notification, and there is no way + * to know of their existing without using the not very portable PSAPI. + */ + stw_framebuffer_get_size(fb); + + if(fb->must_resize) { + st_resize_framebuffer(fb->stfb, fb->width, fb->height); + fb->must_resize = FALSE; + } } @@ -264,32 +299,47 @@ stw_framebuffer_cleanup( void ) struct stw_framebuffer *fb; struct stw_framebuffer *next; - pipe_mutex_lock( stw_dev->mutex ); + pipe_mutex_lock( stw_dev->fb_mutex ); fb = stw_dev->fb_head; while (fb) { next = fb->next; + + pipe_mutex_lock(fb->mutex); stw_framebuffer_destroy_locked(fb); + fb = next; } stw_dev->fb_head = NULL; - pipe_mutex_unlock( stw_dev->mutex ); + pipe_mutex_unlock( stw_dev->fb_mutex ); } /** * Given an hdc, return the corresponding stw_framebuffer. */ -struct stw_framebuffer * +static INLINE struct stw_framebuffer * stw_framebuffer_from_hdc_locked( HDC hdc ) { + HWND hwnd; struct stw_framebuffer *fb; + /* + * Some applications create and use several HDCs for the same window, so + * looking up the framebuffer by the HDC is not reliable. Use HWND whenever + * possible. + */ + hwnd = WindowFromDC(hdc); + if(hwnd) + return stw_framebuffer_from_hwnd_locked(hwnd); + for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) - if (fb->hDC == hdc) + if (fb->hDC == hdc) { + pipe_mutex_lock(fb->mutex); break; + } return fb; } @@ -304,9 +354,26 @@ stw_framebuffer_from_hdc( { struct stw_framebuffer *fb; - pipe_mutex_lock( stw_dev->mutex ); + pipe_mutex_lock( stw_dev->fb_mutex ); fb = stw_framebuffer_from_hdc_locked(hdc); - pipe_mutex_unlock( stw_dev->mutex ); + pipe_mutex_unlock( stw_dev->fb_mutex ); + + return fb; +} + + +/** + * Given an hdc, return the corresponding stw_framebuffer. + */ +struct stw_framebuffer * +stw_framebuffer_from_hwnd( + HWND hwnd ) +{ + struct stw_framebuffer *fb; + + pipe_mutex_lock( stw_dev->fb_mutex ); + fb = stw_framebuffer_from_hwnd_locked(hwnd); + pipe_mutex_unlock( stw_dev->fb_mutex ); return fb; } @@ -326,22 +393,19 @@ stw_pixelformat_set( if (index >= count) return FALSE; - pipe_mutex_lock( stw_dev->mutex ); - fb = stw_framebuffer_from_hdc_locked(hdc); if(fb) { /* SetPixelFormat must be called only once */ - pipe_mutex_unlock( stw_dev->mutex ); + stw_framebuffer_release( fb ); return FALSE; } - fb = stw_framebuffer_create_locked(hdc, iPixelFormat); + fb = stw_framebuffer_create(hdc, iPixelFormat); if(!fb) { - pipe_mutex_unlock( stw_dev->mutex ); return FALSE; } - pipe_mutex_unlock( stw_dev->mutex ); + stw_framebuffer_release( fb ); /* Some applications mistakenly use the undocumented wglSetPixelFormat * function instead of SetPixelFormat, so we call SetPixelFormat here to @@ -358,13 +422,16 @@ int stw_pixelformat_get( HDC hdc ) { + int iPixelFormat = 0; struct stw_framebuffer *fb; fb = stw_framebuffer_from_hdc(hdc); - if(!fb) - return 0; + if(fb) { + iPixelFormat = fb->iPixelFormat; + stw_framebuffer_release(fb); + } - return fb->iPixelFormat; + return iPixelFormat; } @@ -380,10 +447,10 @@ stw_swap_buffers( if (fb == NULL) return FALSE; - if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) + if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) { + stw_framebuffer_release(fb); return TRUE; - - pipe_mutex_lock( fb->mutex ); + } /* If we're swapping the buffer associated with the current context * we have to flush any pending rendering commands first. @@ -394,7 +461,7 @@ stw_swap_buffers( if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surface )) { /* FIXME: this shouldn't happen, but does on glean */ - pipe_mutex_unlock( fb->mutex ); + stw_framebuffer_release(fb); return FALSE; } @@ -407,7 +474,8 @@ stw_swap_buffers( stw_dev->stw_winsys->flush_frontbuffer( screen, surface, hdc ); - pipe_mutex_unlock( fb->mutex ); + stw_framebuffer_update(fb); + stw_framebuffer_release(fb); return TRUE; } @@ -423,38 +491,3 @@ stw_swap_layer_buffers( return FALSE; } - - -boolean -stw_framebuffer_init_thread(void) -{ - struct stw_tls_data *tls_data; - - tls_data = stw_tls_get_data(); - if(!tls_data) - return FALSE; - - tls_data->hCallWndProcHook = SetWindowsHookEx(WH_CALLWNDPROC, - stw_call_window_proc, - NULL, - GetCurrentThreadId()); - if(tls_data->hCallWndProcHook == NULL) - return FALSE; - - return TRUE; -} - -void -stw_framebuffer_cleanup_thread(void) -{ - struct stw_tls_data *tls_data; - - tls_data = stw_tls_get_data(); - if(!tls_data) - return; - - if(tls_data->hCallWndProcHook) { - UnhookWindowsHookEx(tls_data->hCallWndProcHook); - tls_data->hCallWndProcHook = NULL; - } -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h index e7fa51c3a81..13d29f37e48 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h @@ -41,6 +41,23 @@ struct stw_pixelformat_info; */ struct stw_framebuffer { + /** + * This mutex has two purposes: + * - protect the access to the mutable data members below + * - prevent the the framebuffer from being deleted while being accessed. + * + * It is OK to lock this mutex while holding the stw_device::fb_mutex lock, + * but the opposite must never happen. + */ + pipe_mutex mutex; + + /* + * Immutable members. + * + * Note that even access to immutable members implies acquiring the mutex + * above, to prevent the framebuffer from being destroyed. + */ + HDC hDC; HWND hWnd; @@ -48,41 +65,84 @@ struct stw_framebuffer const struct stw_pixelformat_info *pfi; GLvisual visual; - pipe_mutex mutex; + /* + * Mutable members. + */ + struct st_framebuffer *stfb; - /** This is protected by stw_device::mutex, not the mutex above */ + /* FIXME: Make this work for multiple contexts bound to the same framebuffer */ + boolean must_resize; + unsigned width; + unsigned height; + + /** + * This is protected by stw_device::fb_mutex, not the mutex above. + * + * Deletions must be done by first acquiring stw_device::fb_mutex, and then + * acquiring the stw_framebuffer::mutex of the framebuffer to be deleted. + * This ensures that nobody else is reading/writing to the. + * + * It is not necessary to aquire the mutex above to navigate the linked list + * given that deletions are done with stw_device::fb_mutex held, so no other + * thread can delete. + */ struct stw_framebuffer *next; }; + +/** + * Create a new framebuffer object which will correspond to the given HDC. + * + * This function will acquire stw_framebuffer::mutex. stw_framebuffer_release + * must be called when done + */ struct stw_framebuffer * -stw_framebuffer_create_locked( +stw_framebuffer_create( HDC hdc, int iPixelFormat ); +/** + * Search a framebuffer with a matching HWND. + * + * This function will acquire stw_framebuffer::mutex. stw_framebuffer_release + * must be called when done + */ +struct stw_framebuffer * +stw_framebuffer_from_hwnd( + HWND hwnd ); + +/** + * Search a framebuffer with a matching HDC. + * + * This function will acquire stw_framebuffer::mutex. stw_framebuffer_release + * must be called when done + */ +struct stw_framebuffer * +stw_framebuffer_from_hdc( + HDC hdc ); + BOOL stw_framebuffer_allocate( struct stw_framebuffer *fb ); void -stw_framebuffer_resize( +stw_framebuffer_update( struct stw_framebuffer *fb); +/** + * Release stw_framebuffer::mutex lock. This framebuffer must not be accessed + * after calling this function, as it may have been deleted by another thread + * in the meanwhile. + */ void -stw_framebuffer_cleanup(void); - -struct stw_framebuffer * -stw_framebuffer_from_hdc_locked( - HDC hdc ); - -struct stw_framebuffer * -stw_framebuffer_from_hdc( - HDC hdc ); - -boolean -stw_framebuffer_init_thread(void); +stw_framebuffer_release( + struct stw_framebuffer *fb); +/** + * Cleanup any existing framebuffers when exiting application. + */ void -stw_framebuffer_cleanup_thread(void); +stw_framebuffer_cleanup(void); #endif /* STW_FRAMEBUFFER_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c index 4070cbd5c00..54cc0389059 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c @@ -56,6 +56,10 @@ static const struct stw_extension_entry stw_extension_entries[] = { /* WGL_EXT_extensions_string */ STW_EXTENSION_ENTRY( wglGetExtensionsStringEXT ), + /* WGL_EXT_swap_interval */ + STW_EXTENSION_ENTRY( wglGetSwapIntervalEXT ), + STW_EXTENSION_ENTRY( wglSwapIntervalEXT ), + { NULL, NULL } }; @@ -65,13 +69,13 @@ stw_get_proc_address( { const struct stw_extension_entry *entry; - PROC p = (PROC) _glapi_get_proc_address( lpszProc ); - if (p) - return p; + if (lpszProc[0] == 'w' && lpszProc[1] == 'g' && lpszProc[2] == 'l') + for (entry = stw_extension_entries; entry->name; entry++) + if (strcmp( lpszProc, entry->name ) == 0) + return entry->proc; - for (entry = stw_extension_entries; entry->name; entry++) - if (strcmp( lpszProc, entry->name ) == 0) - return entry->proc; + if (lpszProc[0] == 'g' && lpszProc[1] == 'l') + return (PROC) _glapi_get_proc_address( lpszProc ); return NULL; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.c b/src/gallium/state_trackers/wgl/shared/stw_tls.c index 0c18a52352c..4bd6a9289c9 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_tls.c +++ b/src/gallium/state_trackers/wgl/shared/stw_tls.c @@ -51,9 +51,23 @@ stw_tls_data_create() data = CALLOC_STRUCT(stw_tls_data); if (!data) - return NULL; + goto no_data; + + data->hCallWndProcHook = SetWindowsHookEx(WH_CALLWNDPROC, + stw_call_window_proc, + NULL, + GetCurrentThreadId()); + if(data->hCallWndProcHook == NULL) + goto no_hook; + + TlsSetValue(tlsIndex, data); return data; + +no_hook: + FREE(data); +no_data: + return NULL; } boolean @@ -69,8 +83,6 @@ stw_tls_init_thread(void) if(!data) return FALSE; - TlsSetValue(tlsIndex, data); - return TRUE; } @@ -84,8 +96,16 @@ stw_tls_cleanup_thread(void) } data = (struct stw_tls_data *) TlsGetValue(tlsIndex); - TlsSetValue(tlsIndex, NULL); - FREE(data); + if(data) { + TlsSetValue(tlsIndex, NULL); + + if(data->hCallWndProcHook) { + UnhookWindowsHookEx(data->hCallWndProcHook); + data->hCallWndProcHook = NULL; + } + + FREE(data); + } } void @@ -110,12 +130,9 @@ stw_tls_get_data(void) if(!data) { /* DllMain is called with DLL_THREAD_ATTACH only by threads created after * the DLL is loaded by the process */ - data = stw_tls_data_create(); if(!data) return NULL; - - TlsSetValue(tlsIndex, data); } return data; diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.h b/src/gallium/state_trackers/wgl/shared/stw_tls.h index 6af8be70c9f..fbf8b1cbee4 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_tls.h +++ b/src/gallium/state_trackers/wgl/shared/stw_tls.h @@ -50,4 +50,10 @@ stw_tls_cleanup(void); struct stw_tls_data * stw_tls_get_data(void); +LRESULT CALLBACK +stw_call_window_proc( + int nCode, + WPARAM wParam, + LPARAM lParam ); + #endif /* STW_TLS_H */ diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile index a00ea3e2a4e..27a1990724d 100644 --- a/src/gallium/state_trackers/xorg/Makefile +++ b/src/gallium/state_trackers/xorg/Makefile @@ -1,29 +1,18 @@ -TARGET = libxorgtracker.a -CFILES = $(wildcard ./*.c) -OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES)) -GALLIUMDIR = ../.. -TOP = ../../../.. - +TOP = ../../../.. include $(TOP)/configs/current -CFLAGS = -DHAVE_CONFIG_H \ - -g -Wall -Wimplicit-function-declaration -fPIC \ - $(shell pkg-config --cflags pixman-1 xorg-server libdrm xproto) \ - -I$(GALLIUMDIR)/include \ - -I$(GALLIUMDIR)/auxiliary \ - -I$(TOP)/src/mesa/drivers/dri/common \ - -I$(TOP)/src/mesa \ - -I$(TOP)/include \ - -I$(TOP)/src/egl/main - -############################################# - -.PHONY = all clean +LIBNAME = xorgtracker -all: $(TARGET) +LIBRARY_INCLUDES = \ + -DHAVE_CONFIG_H \ + $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/auxiliary \ + -I$(TOP)/include \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/drivers/dri/common \ + -I$(TOP)/src/mesa/main -$(TARGET): $(OBJECTS) - ar rcs $(TARGET) $(OBJECTS) +C_SOURCES = $(wildcard ./*.c) -clean: - rm -rf $(OBJECTS) $(TARGET) +include ../../Makefile.template diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c new file mode 100644 index 00000000000..255ae91f096 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -0,0 +1,27 @@ +#include "xorg_composite.h" + + +boolean xorg_composite_accelerated(int op, + PicturePtr pSrcPicture, + PicturePtr pMaskPicture, + PicturePtr pDstPicture) +{ + return FALSE; +} + +boolean xorg_composite_bind_state(struct exa_context *exa, + int op, + PicturePtr pSrcPicture, + PicturePtr pMaskPicture, + PicturePtr pDstPicture) +{ + return FALSE; +} + +void xorg_composite(struct exa_context *exa, + struct exa_pixmap_priv *dst, + int srcX, int srcY, int maskX, int maskY, + int dstX, int dstY, int width, int height) +{ +} + diff --git a/src/gallium/state_trackers/xorg/xorg_composite.h b/src/gallium/state_trackers/xorg/xorg_composite.h new file mode 100644 index 00000000000..a52e0e6dff0 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xorg_composite.h @@ -0,0 +1,22 @@ +#ifndef XORG_COMPOSITE_H +#define XORG_COMPOSITE_H + +#include "xorg_exa.h" + +boolean xorg_composite_accelerated(int op, + PicturePtr pSrcPicture, + PicturePtr pMaskPicture, + PicturePtr pDstPicture); + +boolean xorg_composite_bind_state(struct exa_context *exa, + int op, + PicturePtr pSrcPicture, + PicturePtr pMaskPicture, + PicturePtr pDstPicture); + +void xorg_composite(struct exa_context *exa, + struct exa_pixmap_priv *dst, + int srcX, int srcY, int maskX, int maskY, + int dstX, int dstY, int width, int height); + +#endif diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 7304113a659..2235961b031 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -171,7 +171,6 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) static void crtc_destroy(xf86CrtcPtr crtc) { - modesettingPtr ms = modesettingPTR(crtc->scrn); struct crtc_private *crtcp = crtc->driver_private; if (crtcp->cursor_buf) @@ -194,9 +193,10 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_GPU_READ, 64*64*4); - drm_api_hooks.handle_from_buffer(ms->screen, - crtcp->cursor_buf, - &crtcp->cursor_handle); + ms->api->handle_from_buffer(ms->api, + ms->screen, + crtcp->cursor_buf, + &crtcp->cursor_handle); } ptr = pipe_buffer_map(ms->screen, crtcp->cursor_buf, PIPE_BUFFER_USAGE_CPU_WRITE); diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 401bd39dac0..ae3338ffeff 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -108,8 +108,8 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) tex = ms->screen->texture_create(ms->screen, &template); } - drm_api_hooks.buffer_from_texture(tex, &buf, &stride); - drm_api_hooks.global_handle_from_buffer(ms->screen, buf, &handle); + ms->api->buffer_from_texture(ms->api, tex, &buf, &stride); + ms->api->global_handle_from_buffer(ms->api, ms->screen, buf, &handle); buffers[i].name = handle; buffers[i].attachment = attachments[i]; diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 45e831f0c28..e01e5294b11 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -300,6 +300,7 @@ PreInit(ScrnInfoPtr pScrn, int flags) ms->PciInfo->dev, ms->PciInfo->func ); + ms->api = drm_api_create(); ms->fd = drmOpen(NULL, BusID); if (ms->fd < 0) @@ -476,7 +477,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } if (!ms->screen) { - ms->screen = drm_api_hooks.create_screen(ms->fd, NULL); + ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL); if (!ms->screen) { FatalError("Could not init pipe_screen\n"); @@ -678,6 +679,8 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen) if (ms->exa) xorg_exa_close(pScrn); + ms->api->destroy(ms->api); + ms->api = NULL; drmClose(ms->fd); ms->fd = -1; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 79131743542..2c4291aa4ea 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -28,9 +28,14 @@ * */ -#include "xorg-server.h" -#include "xf86.h" +#include "xorg_exa.h" #include "xorg_tracker.h" +#include "xorg_composite.h" + +#include <xorg-server.h> +#include <xf86.h> +#include <picturestr.h> +#include <picture.h> #include "pipe/p_format.h" #include "pipe/p_context.h" @@ -39,24 +44,6 @@ #include "util/u_rect.h" -struct exa_entity -{ - ExaDriverPtr pExa; - struct pipe_context *ctx; - struct pipe_screen *scrn; -}; - -struct PixmapPriv -{ - int flags; - struct pipe_texture *tex; - unsigned int color; - struct pipe_surface *src_surf; /* for copies */ - - struct pipe_transfer *map_transfer; - unsigned map_count; -}; - /* * Helper functions */ @@ -113,8 +100,8 @@ ExaPrepareAccess(PixmapPtr pPix, int index) ScreenPtr pScreen = pPix->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); - struct exa_entity *exa = ms->exa; - struct PixmapPriv *priv; + struct exa_context *exa = ms->exa; + struct exa_pixmap_priv *priv; priv = exaGetPixmapDriverPrivate(pPix); @@ -145,8 +132,8 @@ ExaFinishAccess(PixmapPtr pPix, int index) ScreenPtr pScreen = pPix->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); - struct exa_entity *exa = ms->exa; - struct PixmapPriv *priv; + struct exa_context *exa = ms->exa; + struct exa_pixmap_priv *priv; priv = exaGetPixmapDriverPrivate(pPix); if (!priv) @@ -168,8 +155,8 @@ ExaDone(PixmapPtr pPixmap) { ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); - struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap); - struct exa_entity *exa = ms->exa; + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); + struct exa_context *exa = ms->exa; if (!priv) return; @@ -190,8 +177,8 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) { ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); - struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap); - struct exa_entity *exa = ms->exa; + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); + struct exa_context *exa = ms->exa; if (1) return FALSE; @@ -221,8 +208,8 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1) { ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); - struct exa_entity *exa = ms->exa; - struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap); + struct exa_context *exa = ms->exa; + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); struct pipe_surface *surf = exa->scrn->get_tex_surface(exa->scrn, priv->tex, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ | @@ -240,9 +227,9 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, { ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); - struct exa_entity *exa = ms->exa; - struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pDstPixmap); - struct PixmapPriv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap); + struct exa_context *exa = ms->exa; + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap); + struct exa_pixmap_priv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap); if (1) return FALSE; @@ -279,8 +266,8 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, { ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); - struct exa_entity *exa = ms->exa; - struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pDstPixmap); + struct exa_context *exa = ms->exa; + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap); struct pipe_surface *surf = exa->scrn->get_tex_surface(exa->scrn, priv->tex, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ | @@ -296,13 +283,25 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst) { - return FALSE; + ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); + struct exa_context *exa = ms->exa; + + return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, + pDstPicture); } static void ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int width, int height) { + ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); + struct exa_context *exa = ms->exa; + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDst); + + xorg_composite(exa, priv, srcX, srcY, maskX, maskY, + dstX, dstY, width, height); } static Bool @@ -310,15 +309,18 @@ ExaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { - return FALSE; + return xorg_composite_accelerated(op, + pSrcPicture, + pMaskPicture, + pDstPicture); } static void * ExaCreatePixmap(ScreenPtr pScreen, int size, int align) { - struct PixmapPriv *priv; + struct exa_pixmap_priv *priv; - priv = xcalloc(1, sizeof(struct PixmapPriv)); + priv = xcalloc(1, sizeof(struct exa_pixmap_priv)); if (!priv) return NULL; @@ -328,7 +330,7 @@ ExaCreatePixmap(ScreenPtr pScreen, int size, int align) static void ExaDestroyPixmap(ScreenPtr pScreen, void *dPriv) { - struct PixmapPriv *priv = (struct PixmapPriv *)dPriv; + struct exa_pixmap_priv *priv = (struct exa_pixmap_priv *)dPriv; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); @@ -344,7 +346,7 @@ ExaDestroyPixmap(ScreenPtr pScreen, void *dPriv) static Bool ExaPixmapIsOffscreen(PixmapPtr pPixmap) { - struct PixmapPriv *priv; + struct exa_pixmap_priv *priv; priv = exaGetPixmapDriverPrivate(pPixmap); @@ -363,7 +365,7 @@ xorg_exa_get_pixmap_handle(PixmapPtr pPixmap) ScreenPtr pScreen = pPixmap->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); - struct PixmapPriv *priv; + struct exa_pixmap_priv *priv; struct pipe_buffer *buffer = NULL; unsigned handle; unsigned stride; @@ -380,8 +382,8 @@ xorg_exa_get_pixmap_handle(PixmapPtr pPixmap) return 0; } - drm_api_hooks.buffer_from_texture(priv->tex, &buffer, &stride); - drm_api_hooks.handle_from_buffer(ms->screen, buffer, &handle); + ms->api->buffer_from_texture(ms->api, priv->tex, &buffer, &stride); + ms->api->handle_from_buffer(ms->api, ms->screen, buffer, &handle); pipe_buffer_reference(&buffer, NULL); return handle; } @@ -393,9 +395,9 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, { ScreenPtr pScreen = pPixmap->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap); + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); modesettingPtr ms = modesettingPTR(pScrn); - struct exa_entity *exa = ms->exa; + struct exa_context *exa = ms->exa; if (!priv) return FALSE; @@ -456,7 +458,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, struct pipe_texture * xorg_exa_get_texture(PixmapPtr pPixmap) { - struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap); + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); struct pipe_texture *tex = NULL; pipe_texture_reference(&tex, priv->tex); return tex; @@ -466,7 +468,7 @@ void xorg_exa_close(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); - struct exa_entity *exa = ms->exa; + struct exa_context *exa = ms->exa; if (exa->ctx) exa->ctx->destroy(exa->ctx); @@ -480,10 +482,10 @@ void * xorg_exa_init(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); - struct exa_entity *exa; + struct exa_context *exa; ExaDriverPtr pExa; - exa = xcalloc(1, sizeof(struct exa_entity)); + exa = xcalloc(1, sizeof(struct exa_context)); if (!exa) return NULL; @@ -527,7 +529,7 @@ xorg_exa_init(ScrnInfoPtr pScrn) } exa->scrn = ms->screen; - exa->ctx = drm_api_hooks.create_context(exa->scrn); + exa->ctx = ms->api->create_context(ms->api, exa->scrn); /* Share context with DRI */ ms->ctx = exa->ctx; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h new file mode 100644 index 00000000000..650997aec67 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -0,0 +1,27 @@ +#ifndef XORG_EXA_H +#define XORG_EXA_H + +#include "xorg_tracker.h" + +struct exa_context +{ + ExaDriverPtr pExa; + struct pipe_context *ctx; + struct pipe_screen *scrn; +}; + + +struct exa_pixmap_priv +{ + int flags; + struct pipe_texture *tex; + unsigned int color; + struct pipe_surface *src_surf; /* for copies */ + + struct pipe_transfer *map_transfer; + unsigned map_count; +}; + + + +#endif diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 82c3890dfbd..b4742bdbf56 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -31,11 +31,14 @@ #ifndef _XORG_TRACKER_H_ #define _XORG_TRACKER_H_ +#include <stdint.h> #include <errno.h> #include <drm.h> #include <xf86drm.h> #include <xf86drmMode.h> -#include "exa.h" +#include <xorg-server.h> +#include <xf86.h> +#include <exa.h> #include "pipe/p_screen.h" #include "state_tracker/drm_api.h" @@ -75,6 +78,7 @@ typedef struct _modesettingRec CreateScreenResourcesProcPtr createScreenResources; /* gallium */ + struct drm_api *api; struct pipe_screen *screen; struct pipe_context *ctx; diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/winsys/drm/intel/dri/Makefile index de39e759d87..5e212b62a46 100644 --- a/src/gallium/winsys/drm/intel/dri/Makefile +++ b/src/gallium/winsys/drm/intel/dri/Makefile @@ -8,6 +8,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ + $(TOP)/src/gallium/drivers/identity/libidentity.a \ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.c b/src/gallium/winsys/drm/intel/gem/intel_be_api.c index a74be13bf7a..dd5f814da3c 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.c @@ -1,21 +1,37 @@ #include "intel_be_api.h" #include "i915simple/i915_winsys.h" +#include "identity/id_drm.h" +#include "trace/tr_drm.h" -#ifdef DEBUG -#include "trace/trace_drm.h" +static void destroy(struct drm_api *api) +{ -struct drm_api hooks = -#else -struct drm_api drm_api_hooks = -#endif +} + +struct drm_api intel_be_drm_api = { /* intel_be_context.c */ .create_context = intel_be_create_context, /* intel_be_device.c */ .create_screen = intel_be_create_screen, - .buffer_from_texture = i915_get_texture_buffer, + .buffer_from_texture = intel_be_get_texture_buffer, .buffer_from_handle = intel_be_buffer_from_handle, .handle_from_buffer = intel_be_handle_from_buffer, .global_handle_from_buffer = intel_be_global_handle_from_buffer, + .destroy = destroy, }; + +struct drm_api * +drm_api_create() +{ +#ifdef DEBUG +#if 0 + return identity_drm_create(&intel_be_drm_api); +#else + return trace_drm_create(&intel_be_drm_api); +#endif +#else + return &intel_be_drm_api; +#endif +} diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.h b/src/gallium/winsys/drm/intel/gem/intel_be_api.h index 1c622f3b978..f286b62eb8c 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_api.h +++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.h @@ -8,8 +8,11 @@ #include "intel_be_device.h" -struct pipe_screen *intel_be_create_screen(int drmFD, +extern struct drm_api intel_be_drm_api; + +struct pipe_screen *intel_be_create_screen(struct drm_api *api, int drmFD, struct drm_create_screen_arg *arg); -struct pipe_context *intel_be_create_context(struct pipe_screen *screen); +struct pipe_context *intel_be_create_context(struct drm_api *api, + struct pipe_screen *screen); #endif diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_context.c b/src/gallium/winsys/drm/intel/gem/intel_be_context.c index fe0b138fbea..db84f9af514 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c @@ -97,7 +97,7 @@ intel_be_init_context(struct intel_be_context *intel, struct intel_be_device *de } struct pipe_context * -intel_be_create_context(struct pipe_screen *screen) +intel_be_create_context(struct drm_api *api, struct pipe_screen *screen) { struct intel_be_context *intel; struct pipe_context *pipe; diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c index 907ac86637f..e3630f5d120 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -142,8 +142,27 @@ err: return NULL; } +boolean +intel_be_get_texture_buffer(struct drm_api *api, + struct pipe_texture *texture, + struct pipe_buffer **buffer, + unsigned *stride) +{ + struct intel_be_device *dev; + + if (!texture) + return FALSE; + + dev = intel_be_device(texture->screen->winsys); + if (dev->softpipe) + return softpipe_get_texture_buffer(texture, buffer, stride); + else + return i915_get_texture_buffer(texture, buffer, stride); +} + struct pipe_buffer * -intel_be_buffer_from_handle(struct pipe_screen *screen, +intel_be_buffer_from_handle(struct drm_api *api, + struct pipe_screen *screen, const char* name, unsigned handle) { struct intel_be_device *dev = intel_be_device(screen->winsys); @@ -174,7 +193,8 @@ err: } boolean -intel_be_handle_from_buffer(struct pipe_screen *screen, +intel_be_handle_from_buffer(struct drm_api *api, + struct pipe_screen *screen, struct pipe_buffer *buffer, unsigned *handle) { @@ -186,7 +206,8 @@ intel_be_handle_from_buffer(struct pipe_screen *screen, } boolean -intel_be_global_handle_from_buffer(struct pipe_screen *screen, +intel_be_global_handle_from_buffer(struct drm_api *api, + struct pipe_screen *screen, struct pipe_buffer *buffer, unsigned *handle) { @@ -296,6 +317,7 @@ intel_be_get_device_id(unsigned int *device_id) { char path[512]; FILE *file; + void *shutup_gcc; /* * FIXME: Fix this up to use a drm ioctl or whatever. @@ -307,13 +329,14 @@ intel_be_get_device_id(unsigned int *device_id) return; } - fgets(path, sizeof(path), file); + shutup_gcc = fgets(path, sizeof(path), file); sscanf(path, "%x", device_id); fclose(file); } struct pipe_screen * -intel_be_create_screen(int drmFD, struct drm_create_screen_arg *arg) +intel_be_create_screen(struct drm_api *api, int drmFD, + struct drm_create_screen_arg *arg) { struct intel_be_device *dev; struct pipe_screen *screen; @@ -339,7 +362,6 @@ intel_be_create_screen(int drmFD, struct drm_create_screen_arg *arg) if (dev->softpipe) { screen = softpipe_create_screen(&dev->base); - drm_api_hooks.buffer_from_texture = softpipe_get_texture_buffer; } else screen = i915_create_screen(&dev->base, deviceID); diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h index b32637ece29..56d95bd7fe0 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h @@ -8,6 +8,8 @@ #include "drm.h" #include "intel_bufmgr.h" +struct drm_api; + /* * Device */ @@ -50,13 +52,23 @@ struct intel_be_buffer { unsigned flink; }; +/* + * Wrapper for driver get_texture_buffer functions. + */ +boolean +intel_be_get_texture_buffer(struct drm_api *api, + struct pipe_texture *texture, + struct pipe_buffer **buffer, + unsigned *stride); + /** * Create a be buffer from a drm bo handle. * * Takes a reference. */ struct pipe_buffer * -intel_be_buffer_from_handle(struct pipe_screen *screen, +intel_be_buffer_from_handle(struct drm_api *api, + struct pipe_screen *screen, const char* name, unsigned handle); /** @@ -65,7 +77,8 @@ intel_be_buffer_from_handle(struct pipe_screen *screen, * If buffer is destroyed handle may become invalid. */ boolean -intel_be_handle_from_buffer(struct pipe_screen *screen, +intel_be_handle_from_buffer(struct drm_api *api, + struct pipe_screen *screen, struct pipe_buffer *buffer, unsigned *handle); @@ -75,7 +88,8 @@ intel_be_handle_from_buffer(struct pipe_screen *screen, * If buffer is destroyed handle may become invalid. */ boolean -intel_be_global_handle_from_buffer(struct pipe_screen *screen, +intel_be_global_handle_from_buffer(struct drm_api *api, + struct pipe_screen *screen, struct pipe_buffer *buffer, unsigned *handle); diff --git a/src/gallium/winsys/drm/intel/xorg/Makefile b/src/gallium/winsys/drm/intel/xorg/Makefile index d9aa5d54e1d..d51cca8d213 100644 --- a/src/gallium/winsys/drm/intel/xorg/Makefile +++ b/src/gallium/winsys/drm/intel/xorg/Makefile @@ -1,36 +1,38 @@ TARGET = modesetting_drv.so CFILES = $(wildcard ./*.c) OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES)) -GALLIUMDIR = ../../../.. TOP = ../../../../../.. -include ${TOP}/configs/current +include $(TOP)/configs/current -CFLAGS = -DHAVE_CONFIG_H \ - -g -Wall -Wimplicit-function-declaration -fPIC \ - $(shell pkg-config --cflags pixman-1 xorg-server libdrm xproto) \ - -I../gem \ - -I${GALLIUMDIR}/include \ - -I${GALLIUMDIR}/drivers \ - -I${GALLIUMDIR}/auxiliary \ - -I${TOP}/src/mesa \ - -I$(TOP)/include \ - -I$(TOP)/src/egl/main +INCLUDES = \ + $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ + -I../gem \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/drivers \ + -I$(TOP)/src/gallium/auxiliary \ + -I$(TOP)/src/mesa \ + -I$(TOP)/include \ + -I$(TOP)/src/egl/main LIBS = \ - $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a \ - $(GALLIUMDIR)/winsys/drm/intel/gem/libinteldrm.a \ + $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ + $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(GALLIUM_AUXILIARIES) +DRIVER_DEFINES = \ + -DHAVE_CONFIG_H + + ############################################# all default: $(TARGET) -$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a $(LIBS) +$(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS) $(TOP)/bin/mklib -noprefix -o $@ \ $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel @@ -41,4 +43,14 @@ install: $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) $(MINSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) + +############################################## + + +.c.o: + $(CC) -c $(CFLAGS) $(INCLUDES) $(DRIVER_DEFINES) $< -o $@ + + +############################################## + .PHONY = all clean install diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index 395b21ec7ab..3167ccfdc16 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -12,7 +12,7 @@ #include "nouveau/nouveau_screen.h" static struct pipe_surface * -dri_surface_from_handle(struct pipe_screen *screen, +dri_surface_from_handle(struct drm_api *api, struct pipe_screen *screen, unsigned handle, enum pipe_format format, unsigned width, @@ -24,7 +24,7 @@ dri_surface_from_handle(struct pipe_screen *screen, struct pipe_texture templat; struct pipe_buffer *buf = NULL; - buf = drm_api_hooks.buffer_from_handle(screen, "front buffer", handle); + buf = api->buffer_from_handle(api, screen, "front buffer", handle); if (!buf) return NULL; @@ -70,7 +70,8 @@ static struct dri1_api nouveau_dri1_api = { }; static struct pipe_screen * -nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) +nouveau_drm_create_screen(struct drm_api *api, int fd, + struct drm_create_screen_arg *arg) { struct dri1_create_screen_arg *dri1 = (void *)arg; struct nouveau_winsys *nvws; @@ -134,13 +135,12 @@ nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) else format = PIPE_FORMAT_A8R8G8B8_UNORM; - nvws->front = dri_surface_from_handle(nvws->pscreen, - nvdri->front_offset, - format, - nvdri->width, - nvdri->height, - nvdri->front_pitch * - (nvdri->bpp / 8)); + nvws->front = dri_surface_from_handle(api, nvws->pscreen, + nvdri->front_offset, + format, nvdri->width, + nvdri->height, + nvdri->front_pitch * + (nvdri->bpp / 8)); if (!nvws->front) { debug_printf("%s: error referencing front buffer\n", __func__); @@ -155,7 +155,7 @@ nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) } static struct pipe_context * -nouveau_drm_create_context(struct pipe_screen *pscreen) +nouveau_drm_create_context(struct drm_api *api, struct pipe_screen *pscreen) { struct nouveau_winsys *nvws = nouveau_winsys_screen(pscreen); struct pipe_context *(*init)(struct pipe_screen *, unsigned); @@ -206,15 +206,15 @@ nouveau_drm_create_context(struct pipe_screen *pscreen) } static boolean -nouveau_drm_pb_from_pt(struct pipe_texture *pt, struct pipe_buffer **ppb, - unsigned *stride) +nouveau_drm_pb_from_pt(struct drm_api *api, struct pipe_texture *pt, + struct pipe_buffer **ppb, unsigned *stride) { return false; } static struct pipe_buffer * -nouveau_drm_pb_from_handle(struct pipe_screen *pscreen, const char *name, - unsigned handle) +nouveau_drm_pb_from_handle(struct drm_api *api, struct pipe_screen *pscreen, + const char *name, unsigned handle) { struct nouveau_device *dev = nouveau_screen(pscreen)->device; struct pipe_buffer *pb; @@ -242,8 +242,8 @@ nouveau_drm_pb_from_handle(struct pipe_screen *pscreen, const char *name, } static boolean -nouveau_drm_handle_from_pb(struct pipe_screen *pscreen, struct pipe_buffer *pb, - unsigned *handle) +nouveau_drm_handle_from_pb(struct drm_api *api, struct pipe_screen *pscreen, + struct pipe_buffer *pb, unsigned *handle) { struct nouveau_bo *bo = nouveau_bo(pb); @@ -255,8 +255,8 @@ nouveau_drm_handle_from_pb(struct pipe_screen *pscreen, struct pipe_buffer *pb, } static boolean -nouveau_drm_name_from_pb(struct pipe_screen *pscreen, struct pipe_buffer *pb, - unsigned *handle) +nouveau_drm_name_from_pb(struct drm_api *api, struct pipe_screen *pscreen, + struct pipe_buffer *pb, unsigned *handle) { struct nouveau_bo *bo = nouveau_bo(pb); @@ -275,3 +275,8 @@ struct drm_api drm_api_hooks = { .global_handle_from_buffer = nouveau_drm_name_from_pb, }; +struct drm_api * +drm_api_create() { + return &drm_api_hooks; +} + diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 0d0fdc5bd86..684a487f242 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -1,8 +1,8 @@ -/* +/* * Copyright © 2008 Jérôme Glisse * 2009 Corbin Simpson * 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 @@ -10,14 +10,14 @@ * 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 SOFTWARE IS PROVIDED "AS 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 COPYRIGHT HOLDERS, 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 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * * The above copyright notice and this permission notice (including the @@ -141,6 +141,8 @@ static void *radeon_buffer_map(struct pipe_winsys *ws, write = 1; } + radeon_bo_wait(radeon_buffer->bo); + if (radeon_bo_map(radeon_buffer->bo, write)) return NULL; return radeon_buffer->bo->ptr; @@ -198,6 +200,7 @@ struct radeon_winsys* radeon_pipe_winsys(int fd) return NULL; } + radeon_ws->priv->fd = fd; radeon_ws->priv->bom = radeon_bo_manager_gem_ctor(fd); radeon_ws->base.flush_frontbuffer = radeon_flush_frontbuffer; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h index ca8bbb3c117..8c8b61fa10b 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h @@ -1,7 +1,7 @@ -/* +/* * Copyright © 2008 Jérôme Glisse * 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 @@ -9,14 +9,14 @@ * 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 SOFTWARE IS PROVIDED "AS 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 COPYRIGHT HOLDERS, 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 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * * The above copyright notice and this permission notice (including the @@ -48,11 +48,16 @@ struct radeon_pipe_buffer { struct pipe_buffer base; struct radeon_bo *bo; + boolean flinked; + uint32_t flink; }; #define RADEON_MAX_BOS 24 struct radeon_winsys_priv { + /* DRM FD */ + int fd; + /* Radeon BO manager. */ struct radeon_bo_manager* bom; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index 5406d2bbea0..da2010184a2 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -1,7 +1,7 @@ -/* +/* * Copyright © 2009 Corbin Simpson * 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 @@ -9,14 +9,14 @@ * 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 SOFTWARE IS PROVIDED "AS 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 COPYRIGHT HOLDERS, 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 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * * The above copyright notice and this permission notice (including the @@ -29,13 +29,11 @@ */ #include "radeon_drm.h" - -#ifdef DEBUG -#include "trace/trace_drm.h" -#endif +#include "trace/tr_drm.h" /* Create a pipe_screen. */ -struct pipe_screen* radeon_create_screen(int drmFB, +struct pipe_screen* radeon_create_screen(struct drm_api* api, + int drmFB, struct drm_create_screen_arg *arg) { struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB); @@ -50,7 +48,8 @@ struct pipe_screen* radeon_create_screen(int drmFB, } /* Create a pipe_context. */ -struct pipe_context* radeon_create_context(struct pipe_screen* screen) +struct pipe_context* radeon_create_context(struct drm_api* api, + struct pipe_screen* screen) { if (getenv("RADEON_SOFTPIPE")) { return radeon_create_softpipe(screen->winsys); @@ -59,16 +58,19 @@ struct pipe_context* radeon_create_context(struct pipe_screen* screen) } } -boolean radeon_buffer_from_texture(struct pipe_texture* texture, +boolean radeon_buffer_from_texture(struct drm_api* api, + struct pipe_texture* texture, struct pipe_buffer** buffer, unsigned* stride) { - return FALSE; + /* XXX fix this */ + return r300_get_texture_buffer(texture, buffer, stride); } /* Create a buffer from a handle. */ /* XXX what's up with name? */ -struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen, +struct pipe_buffer* radeon_buffer_from_handle(struct drm_api* api, + struct pipe_screen* screen, const char* name, unsigned handle) { @@ -95,7 +97,8 @@ struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen, return &radeon_buffer->base; } -boolean radeon_handle_from_buffer(struct pipe_screen* screen, +boolean radeon_handle_from_buffer(struct drm_api* api, + struct pipe_screen* screen, struct pipe_buffer* buffer, unsigned* handle) { @@ -105,27 +108,50 @@ boolean radeon_handle_from_buffer(struct pipe_screen* screen, return TRUE; } -boolean radeon_global_handle_from_buffer(struct pipe_screen* screen, +boolean radeon_global_handle_from_buffer(struct drm_api* api, + struct pipe_screen* screen, struct pipe_buffer* buffer, unsigned* handle) { - /* XXX WTF is the difference here? global? */ + int retval, fd; + struct drm_gem_flink flink; struct radeon_pipe_buffer* radeon_buffer = (struct radeon_pipe_buffer*)buffer; - *handle = radeon_buffer->bo->handle; + + if (!radeon_buffer->flinked) { + fd = ((struct radeon_winsys*)screen->winsys)->priv->fd; + + flink.handle = radeon_buffer->bo->handle; + + retval = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); + if (retval) { + debug_printf("radeon: DRM_IOCTL_GEM_FLINK failed, error %d\n", + retval); + return FALSE; + } + + radeon_buffer->flink = flink.name; + radeon_buffer->flinked = TRUE; + } + + *handle = radeon_buffer->flink; return TRUE; } -#ifdef DEBUG -struct drm_api hooks = { -#else struct drm_api drm_api_hooks = { -#endif .create_screen = radeon_create_screen, .create_context = radeon_create_context, - /* XXX fix this */ - .buffer_from_texture = r300_get_texture_buffer, + .buffer_from_texture = radeon_buffer_from_texture, .buffer_from_handle = radeon_buffer_from_handle, .handle_from_buffer = radeon_handle_from_buffer, .global_handle_from_buffer = radeon_global_handle_from_buffer, }; + +struct drm_api* drm_api_create() +{ +#ifdef DEBUG + return trace_drm_create(&drm_api_hooks); +#else + return &drm_api_hooks; +#endif +} diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h index 049f9984dba..8560f71db65 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.h @@ -40,25 +40,32 @@ #include "radeon_r300.h" #include "radeon_winsys_softpipe.h" -struct pipe_screen* radeon_create_screen(int drmFB, +struct pipe_screen* radeon_create_screen(struct drm_api* api, + int drmFB, struct drm_create_screen_arg *arg); -struct pipe_context* radeon_create_context(struct pipe_screen* screen); +struct pipe_context* radeon_create_context(struct drm_api* api, + struct pipe_screen* screen); -boolean radeon_buffer_from_texture(struct pipe_texture* texture, +boolean radeon_buffer_from_texture(struct drm_api* api, + struct pipe_texture* texture, struct pipe_buffer** buffer, unsigned* stride); -struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen, +struct pipe_buffer* radeon_buffer_from_handle(struct drm_api* api, + struct pipe_screen* screen, const char* name, unsigned handle); -boolean radeon_handle_from_buffer(struct pipe_screen* screen, +boolean radeon_handle_from_buffer(struct drm_api* api, + struct pipe_screen* screen, struct pipe_buffer* buffer, unsigned* handle); -boolean radeon_global_handle_from_buffer(struct pipe_screen* screen, +boolean radeon_global_handle_from_buffer(struct drm_api* api, + struct pipe_screen* screen, struct pipe_buffer* buffer, unsigned* handle); +void radeon_destroy_drm_api(struct drm_api* api); #endif diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 63aa3179ac8..8c5f756ddf8 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -39,7 +39,7 @@ static boolean radeon_r300_add_buffer(struct r300_winsys* winsys, if (sc[i].bo == bo) { sc[i].read_domains |= rd; sc[i].write_domain |= wd; - return; + return TRUE; } } diff --git a/src/glew/glew.c b/src/glew/glew.c index 24c6a726c38..aa2278f6c03 100644 --- a/src/glew/glew.c +++ b/src/glew/glew.c @@ -547,7 +547,7 @@ PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus = NULL; PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers = NULL; PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers = NULL; PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer = NULL; -PFNGLFRAMEBUFFERTEXTURLAYERPROC __glewFramebufferTexturLayer = NULL; +PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer = NULL; PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D = NULL; PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D = NULL; PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D = NULL; @@ -2739,7 +2739,7 @@ static GLboolean _glewInit_GL_ARB_framebuffer_object (GLEW_CONTEXT_ARG_DEF_INIT) r = ((glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteFramebuffers")) == NULL) || r; r = ((glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteRenderbuffers")) == NULL) || r; r = ((glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glFramebufferRenderbuffer")) == NULL) || r; - r = ((glFramebufferTexturLayer = (PFNGLFRAMEBUFFERTEXTURLAYERPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexturLayer")) == NULL) || r; + r = ((glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayer")) == NULL) || r; r = ((glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture1D")) == NULL) || r; r = ((glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture2D")) == NULL) || r; r = ((glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture3D")) == NULL) || r; diff --git a/src/glew/glewinfo.c b/src/glew/glewinfo.c index 13c6d05bd1f..da2b241deab 100644 --- a/src/glew/glewinfo.c +++ b/src/glew/glewinfo.c @@ -708,7 +708,7 @@ static void _glewInfo_GL_ARB_framebuffer_object (void) glewInfoFunc("glDeleteFramebuffers", glDeleteFramebuffers == NULL); glewInfoFunc("glDeleteRenderbuffers", glDeleteRenderbuffers == NULL); glewInfoFunc("glFramebufferRenderbuffer", glFramebufferRenderbuffer == NULL); - glewInfoFunc("glFramebufferTexturLayer", glFramebufferTexturLayer == NULL); + glewInfoFunc("glFramebufferTextureLayer", glFramebufferTextureLayer == NULL); glewInfoFunc("glFramebufferTexture1D", glFramebufferTexture1D == NULL); glewInfoFunc("glFramebufferTexture2D", glFramebufferTexture2D == NULL); glewInfoFunc("glFramebufferTexture3D", glFramebufferTexture3D == NULL); diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c index fb31898db2d..f4865aecb1c 100644 --- a/src/glx/x11/dri2_glx.c +++ b/src/glx/x11/dri2_glx.c @@ -80,6 +80,8 @@ struct __GLXDRIdrawablePrivateRec { int have_fake_front; }; +static void dri2WaitX(__GLXDRIdrawable *pdraw); + static void dri2DestroyContext(__GLXDRIcontext *context, __GLXscreenConfigs *psc, Display *dpy) { @@ -215,6 +217,11 @@ static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw, DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region, DRI2BufferFrontLeft, DRI2BufferBackLeft); XFixesDestroyRegion(pdraw->psc->dpy, region); + + /* Refresh the fake front (if present) after we just damaged the real + * front. + */ + dri2WaitX(pdraw); } static void dri2SwapBuffers(__GLXDRIdrawable *pdraw) diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 3ce410d9be3..ac2eb05341a 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -305,6 +305,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, drm_handle_t hFB; int junk; const __DRIconfig **driver_configs; + __GLcontextModes *visual; /* DRI protocol version. */ dri_version.major = driDpy->driMajor; @@ -417,6 +418,28 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs); psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs); + /* Visuals with depth != screen depth are subject to automatic compositing + * in the X server, so DRI1 can't render to them properly. Mark them as + * non-conformant to prevent apps from picking them up accidentally. + */ + for (visual = psc->visuals; visual; visual = visual->next) { + XVisualInfo template; + XVisualInfo *visuals; + int num_visuals; + long mask; + + template.visualid = visual->visualID; + mask = VisualIDMask; + visuals = XGetVisualInfo(dpy, mask, &template, &num_visuals); + + if (visuals) { + if (num_visuals > 0 && visuals->depth != DefaultDepth(dpy, scrn)) + visual->visualRating = GLX_NON_CONFORMANT_CONFIG; + + XFree(visuals); + } + } + return psp; handle_error: diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c index b843ce484fb..1c229dde900 100644 --- a/src/glx/x11/drisw_glx.c +++ b/src/glx/x11/drisw_glx.c @@ -401,6 +401,8 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen, psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs); psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs); + free(driver_configs); + psp->destroyScreen = driDestroyScreen; psp->createContext = driCreateContext; psp->createDrawable = driCreateDrawable; diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index ec3e69e4fe1..820d8b98685 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -164,7 +164,7 @@ GetGLXScreenConfigs(Display *dpy, int scrn) { __GLXdisplayPrivate * const priv = __glXInitialize(dpy); - return (priv->screenConfigs != NULL) ? &priv->screenConfigs[scrn] : NULL; + return (priv && priv->screenConfigs != NULL) ? &priv->screenConfigs[scrn] : NULL; } @@ -869,6 +869,20 @@ PUBLIC void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap) req->glxpixmap = glxpixmap; UnlockDisplay(dpy); SyncHandle(); + +#ifdef GLX_DIRECT_RENDERING + { + int screen; + __GLXdisplayPrivate *const priv = __glXInitialize(dpy); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap, &screen); + __GLXscreenConfigs *psc = &priv->screenConfigs[screen]; + + if (pdraw != NULL) { + (*pdraw->destroyDrawable) (pdraw); + __glxHashDelete(psc->drawHash, glxpixmap); + } + } +#endif } PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable) diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c index 01f42332413..d44e0dd1fc8 100644 --- a/src/glx/x11/glxcurrent.c +++ b/src/glx/x11/glxcurrent.c @@ -457,7 +457,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, &dummy_reply); } #ifdef GLX_DIRECT_RENDERING - else if (oldGC->driContext) { + else if (oldGC->driContext && oldGC != gc) { oldGC->driContext->unbindContext(oldGC->driContext); } #endif diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index f31a2a25bf3..3b397fef7de 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -202,16 +202,11 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->GetIntegerv = NULL; driver->GetPointerv = NULL; -#if FEATURE_ARB_vertex_buffer_object - driver->NewBufferObject = _mesa_new_buffer_object; - driver->DeleteBuffer = _mesa_delete_buffer_object; - driver->BindBuffer = NULL; - driver->BufferData = _mesa_buffer_data; - driver->BufferSubData = _mesa_buffer_subdata; - driver->GetBufferSubData = _mesa_buffer_get_subdata; - driver->MapBuffer = _mesa_buffer_map; - driver->UnmapBuffer = _mesa_buffer_unmap; -#endif + /* buffer objects */ + _mesa_init_buffer_object_functions(driver); + + /* query objects */ + _mesa_init_query_object_functions(driver); #if FEATURE_EXT_framebuffer_object driver->NewFramebuffer = _mesa_new_framebuffer; @@ -225,22 +220,11 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->BlitFramebuffer = _swrast_BlitFramebuffer; #endif - /* query objects */ - driver->NewQueryObject = _mesa_new_query_object; - driver->DeleteQuery = _mesa_delete_query; - driver->BeginQuery = _mesa_begin_query; - driver->EndQuery = _mesa_end_query; - driver->WaitQuery = _mesa_wait_query; - driver->CheckQuery = _mesa_check_query; - /* APPLE_vertex_array_object */ driver->NewArrayObject = _mesa_new_array_object; driver->DeleteArrayObject = _mesa_delete_array_object; driver->BindArrayObject = NULL; - /* GL_ARB_copy_buffer */ - driver->CopyBufferSubData = _mesa_copy_buffer_subdata; - /* T&L stuff */ driver->NeedValidate = GL_FALSE; driver->ValidateTnlModule = NULL; diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index bd38e3be47c..18dbeba24a8 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -11,7 +11,8 @@ COMMON_GALLIUM_SOURCES = \ COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ ../../common/driverfuncs.c \ ../common/texmem.c \ - ../common/drirenderbuffer.c + ../common/drirenderbuffer.c \ + ../common/dri_metaops.c ifeq ($(WINDOW_SYSTEM),dri) WINOBJ= diff --git a/src/mesa/drivers/dri/common/dri_metaops.c b/src/mesa/drivers/dri/common/dri_metaops.c new file mode 100644 index 00000000000..fe183c2e870 --- /dev/null +++ b/src/mesa/drivers/dri/common/dri_metaops.c @@ -0,0 +1,541 @@ +/************************************************************************** + * + * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 Intel Corporation. + * 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 TUNGSTEN GRAPHICS 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/arrayobj.h" +#include "main/attrib.h" +#include "main/blend.h" +#include "main/bufferobj.h" +#include "main/buffers.h" +#include "main/depth.h" +#include "main/enable.h" +#include "main/matrix.h" +#include "main/macros.h" +#include "main/polygon.h" +#include "main/shaders.h" +#include "main/stencil.h" +#include "main/texstate.h" +#include "main/varray.h" +#include "main/viewport.h" +#include "shader/arbprogram.h" +#include "shader/program.h" +#include "dri_metaops.h" + +void +meta_set_passthrough_transform(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + meta->saved_vp_x = ctx->Viewport.X; + meta->saved_vp_y = ctx->Viewport.Y; + meta->saved_vp_width = ctx->Viewport.Width; + meta->saved_vp_height = ctx->Viewport.Height; + meta->saved_matrix_mode = ctx->Transform.MatrixMode; + + meta->internal_viewport_call = GL_TRUE; + _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); + meta->internal_viewport_call = GL_FALSE; + + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); + _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1); + + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); +} + +void +meta_restore_transform(struct dri_metaops *meta) +{ + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PopMatrix(); + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PopMatrix(); + + _mesa_MatrixMode(meta->saved_matrix_mode); + + meta->internal_viewport_call = GL_TRUE; + _mesa_Viewport(meta->saved_vp_x, meta->saved_vp_y, + meta->saved_vp_width, meta->saved_vp_height); + meta->internal_viewport_call = GL_FALSE; +} + + +/** + * Set up a vertex program to pass through the position and first texcoord + * for pixel path. + */ +void +meta_set_passthrough_vertex_program(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + static const char *vp = + "!!ARBvp1.0\n" + "TEMP vertexClip;\n" + "DP4 vertexClip.x, state.matrix.mvp.row[0], vertex.position;\n" + "DP4 vertexClip.y, state.matrix.mvp.row[1], vertex.position;\n" + "DP4 vertexClip.z, state.matrix.mvp.row[2], vertex.position;\n" + "DP4 vertexClip.w, state.matrix.mvp.row[3], vertex.position;\n" + "MOV result.position, vertexClip;\n" + "MOV result.texcoord[0], vertex.texcoord[0];\n" + "MOV result.color, vertex.color;\n" + "END\n"; + + assert(meta->saved_vp == NULL); + + _mesa_reference_vertprog(ctx, &meta->saved_vp, + ctx->VertexProgram.Current); + if (meta->passthrough_vp == NULL) { + GLuint prog_name; + _mesa_GenPrograms(1, &prog_name); + _mesa_BindProgram(GL_VERTEX_PROGRAM_ARB, prog_name); + _mesa_ProgramStringARB(GL_VERTEX_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(vp), (const GLubyte *)vp); + _mesa_reference_vertprog(ctx, &meta->passthrough_vp, + ctx->VertexProgram.Current); + _mesa_DeletePrograms(1, &prog_name); + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + meta->passthrough_vp); + ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, + &meta->passthrough_vp->Base); + + meta->saved_vp_enable = ctx->VertexProgram.Enabled; + _mesa_Enable(GL_VERTEX_PROGRAM_ARB); +} + +/** + * Restores the previous vertex program after + * meta_set_passthrough_vertex_program() + */ +void +meta_restore_vertex_program(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + meta->saved_vp); + _mesa_reference_vertprog(ctx, &meta->saved_vp, NULL); + ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, + &ctx->VertexProgram.Current->Base); + + if (!meta->saved_vp_enable) + _mesa_Disable(GL_VERTEX_PROGRAM_ARB); +} + +/** + * Binds the given program string to GL_FRAGMENT_PROGRAM_ARB, caching the + * program object. + */ +void +meta_set_fragment_program(struct dri_metaops *meta, + struct gl_fragment_program **prog, + const char *prog_string) +{ + GLcontext *ctx = meta->ctx; + assert(meta->saved_fp == NULL); + + _mesa_reference_fragprog(ctx, &meta->saved_fp, + ctx->FragmentProgram.Current); + if (*prog == NULL) { + GLuint prog_name; + _mesa_GenPrograms(1, &prog_name); + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, prog_name); + _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(prog_string), (const GLubyte *)prog_string); + _mesa_reference_fragprog(ctx, prog, ctx->FragmentProgram.Current); + /* Note that DeletePrograms unbinds the program on us */ + _mesa_DeletePrograms(1, &prog_name); + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, *prog); + ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, &((*prog)->Base)); + + meta->saved_fp_enable = ctx->FragmentProgram.Enabled; + _mesa_Enable(GL_FRAGMENT_PROGRAM_ARB); +} + +/** + * Restores the previous fragment program after + * meta_set_fragment_program() + */ +void +meta_restore_fragment_program(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + meta->saved_fp); + _mesa_reference_fragprog(ctx, &meta->saved_fp, NULL); + ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, + &ctx->FragmentProgram.Current->Base); + + if (!meta->saved_fp_enable) + _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); +} + +static const float default_texcoords[4][2] = { { 0.0, 0.0 }, + { 1.0, 0.0 }, + { 1.0, 1.0 }, + { 0.0, 1.0 } }; + +void +meta_set_default_texrect(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + struct gl_client_array *old_texcoord_array; + + meta->saved_active_texture = ctx->Texture.CurrentUnit; + if (meta->saved_array_vbo == NULL) { + _mesa_reference_buffer_object(ctx, &meta->saved_array_vbo, + ctx->Array.ArrayBufferObj); + } + + old_texcoord_array = &ctx->Array.ArrayObj->TexCoord[0]; + meta->saved_texcoord_type = old_texcoord_array->Type; + meta->saved_texcoord_size = old_texcoord_array->Size; + meta->saved_texcoord_stride = old_texcoord_array->Stride; + meta->saved_texcoord_enable = old_texcoord_array->Enabled; + meta->saved_texcoord_ptr = old_texcoord_array->Ptr; + _mesa_reference_buffer_object(ctx, &meta->saved_texcoord_vbo, + old_texcoord_array->BufferObj); + + _mesa_ClientActiveTextureARB(GL_TEXTURE0); + + if (meta->texcoord_vbo == NULL) { + GLuint vbo_name; + + _mesa_GenBuffersARB(1, &vbo_name); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo_name); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(default_texcoords), + default_texcoords, GL_STATIC_DRAW_ARB); + _mesa_reference_buffer_object(ctx, &meta->texcoord_vbo, + ctx->Array.ArrayBufferObj); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + meta->texcoord_vbo->Name); + } + _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), NULL); + + _mesa_Enable(GL_TEXTURE_COORD_ARRAY); +} + +void +meta_restore_texcoords(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + /* Restore the old TexCoordPointer */ + if (meta->saved_texcoord_vbo) { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + meta->saved_texcoord_vbo->Name); + _mesa_reference_buffer_object(ctx, &meta->saved_texcoord_vbo, NULL); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } + + _mesa_TexCoordPointer(meta->saved_texcoord_size, + meta->saved_texcoord_type, + meta->saved_texcoord_stride, + meta->saved_texcoord_ptr); + if (!meta->saved_texcoord_enable) + _mesa_Disable(GL_TEXTURE_COORD_ARRAY); + + _mesa_ClientActiveTextureARB(GL_TEXTURE0 + + meta->saved_active_texture); + + if (meta->saved_array_vbo) { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + meta->saved_array_vbo->Name); + _mesa_reference_buffer_object(ctx, &meta->saved_array_vbo, NULL); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } +} + + +/** + * Perform glClear where mask contains only color, depth, and/or stencil. + * + * The implementation is based on calling into Mesa to set GL state and + * performing normal triangle rendering. The intent of this path is to + * have as generic a path as possible, so that any driver could make use of + * it. + */ + +/** + * Per-context one-time init of things for intl_clear_tris(). + * Basically set up a private array object for vertex/color arrays. + */ +static void +meta_init_clear(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + struct gl_array_object *arraySave = NULL; + const GLuint arrayBuffer = ctx->Array.ArrayBufferObj->Name; + const GLuint elementBuffer = ctx->Array.ElementArrayBufferObj->Name; + + /* create new array object */ + meta->clear.arrayObj = _mesa_new_array_object(ctx, ~0); + + /* save current array object, bind new one */ + _mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj); + ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_ALL; + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, meta->clear.arrayObj); + + /* one-time setup of vertex arrays (pos, color) */ + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + _mesa_ColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), meta->clear.color); + _mesa_VertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), meta->clear.vertices); + _mesa_Enable(GL_COLOR_ARRAY); + _mesa_Enable(GL_VERTEX_ARRAY); + + /* restore original array object */ + ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_ALL; + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave); + _mesa_reference_array_object(ctx, &arraySave, NULL); + + /* restore original buffer objects */ + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, arrayBuffer); + _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementBuffer); +} + + + +/** + * Perform glClear where mask contains only color, depth, and/or stencil. + * + * The implementation is based on calling into Mesa to set GL state and + * performing normal triangle rendering. The intent of this path is to + * have as generic a path as possible, so that any driver could make use of + * it. + */ +void +meta_clear_tris(struct dri_metaops *meta, GLbitfield mask) +{ + GLcontext *ctx = meta->ctx; + GLfloat dst_z; + struct gl_framebuffer *fb = ctx->DrawBuffer; + int i; + GLboolean saved_fp_enable = GL_FALSE, saved_vp_enable = GL_FALSE; + GLuint saved_shader_program = 0; + unsigned int saved_active_texture; + struct gl_array_object *arraySave = NULL; + + if (!meta->clear.arrayObj) + meta_init_clear(meta); + + assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH | + BUFFER_BIT_STENCIL)) == 0); + + _mesa_PushAttrib(GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT | + GL_ENABLE_BIT | + GL_POLYGON_BIT | + GL_STENCIL_BUFFER_BIT | + GL_TRANSFORM_BIT | + GL_CURRENT_BIT | + GL_VIEWPORT_BIT); + saved_active_texture = ctx->Texture.CurrentUnit; + + /* Disable existing GL state we don't want to apply to a clear. */ + _mesa_Disable(GL_ALPHA_TEST); + _mesa_Disable(GL_BLEND); + _mesa_Disable(GL_CULL_FACE); + _mesa_Disable(GL_FOG); + _mesa_Disable(GL_POLYGON_SMOOTH); + _mesa_Disable(GL_POLYGON_STIPPLE); + _mesa_Disable(GL_POLYGON_OFFSET_FILL); + _mesa_Disable(GL_LIGHTING); + _mesa_Disable(GL_CLIP_PLANE0); + _mesa_Disable(GL_CLIP_PLANE1); + _mesa_Disable(GL_CLIP_PLANE2); + _mesa_Disable(GL_CLIP_PLANE3); + _mesa_Disable(GL_CLIP_PLANE4); + _mesa_Disable(GL_CLIP_PLANE5); + _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); + if (ctx->Extensions.ARB_fragment_program && ctx->FragmentProgram.Enabled) { + saved_fp_enable = GL_TRUE; + _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); + } + if (ctx->Extensions.ARB_vertex_program && ctx->VertexProgram.Enabled) { + saved_vp_enable = GL_TRUE; + _mesa_Disable(GL_VERTEX_PROGRAM_ARB); + } + if (ctx->Extensions.ARB_shader_objects && ctx->Shader.CurrentProgram) { + saved_shader_program = ctx->Shader.CurrentProgram->Name; + _mesa_UseProgramObjectARB(0); + } + + if (ctx->Texture._EnabledUnits != 0) { + int i; + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + _mesa_ActiveTextureARB(GL_TEXTURE0 + i); + _mesa_Disable(GL_TEXTURE_1D); + _mesa_Disable(GL_TEXTURE_2D); + _mesa_Disable(GL_TEXTURE_3D); + if (ctx->Extensions.ARB_texture_cube_map) + _mesa_Disable(GL_TEXTURE_CUBE_MAP_ARB); + if (ctx->Extensions.NV_texture_rectangle) + _mesa_Disable(GL_TEXTURE_RECTANGLE_NV); + if (ctx->Extensions.MESA_texture_array) { + _mesa_Disable(GL_TEXTURE_1D_ARRAY_EXT); + _mesa_Disable(GL_TEXTURE_2D_ARRAY_EXT); + } + } + } + + /* save current array object, bind our private one */ + _mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj); + ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_ALL; + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, meta->clear.arrayObj); + + meta_set_passthrough_transform(meta); + + for (i = 0; i < 4; i++) { + COPY_4FV(meta->clear.color[i], ctx->Color.ClearColor); + } + + /* convert clear Z from [0,1] to NDC coord in [-1,1] */ + dst_z = -1.0 + 2.0 * ctx->Depth.Clear; + + /* The ClearDepth value is unaffected by DepthRange, so do a default + * mapping. + */ + _mesa_DepthRange(0.0, 1.0); + + /* Prepare the vertices, which are the same regardless of which buffer we're + * drawing to. + */ + meta->clear.vertices[0][0] = fb->_Xmin; + meta->clear.vertices[0][1] = fb->_Ymin; + meta->clear.vertices[0][2] = dst_z; + meta->clear.vertices[1][0] = fb->_Xmax; + meta->clear.vertices[1][1] = fb->_Ymin; + meta->clear.vertices[1][2] = dst_z; + meta->clear.vertices[2][0] = fb->_Xmax; + meta->clear.vertices[2][1] = fb->_Ymax; + meta->clear.vertices[2][2] = dst_z; + meta->clear.vertices[3][0] = fb->_Xmin; + meta->clear.vertices[3][1] = fb->_Ymax; + meta->clear.vertices[3][2] = dst_z; + + while (mask != 0) { + GLuint this_mask = 0; + GLuint color_bit; + + color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS); + if (color_bit != 0) + this_mask |= (1 << (color_bit - 1)); + + /* Clear depth/stencil in the same pass as color. */ + this_mask |= (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)); + + /* Select the current color buffer and use the color write mask if + * we have one, otherwise don't write any color channels. + */ + if (this_mask & BUFFER_BIT_FRONT_LEFT) + _mesa_DrawBuffer(GL_FRONT_LEFT); + else if (this_mask & BUFFER_BIT_BACK_LEFT) + _mesa_DrawBuffer(GL_BACK_LEFT); + else if (color_bit != 0) + _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0 + + (color_bit - BUFFER_COLOR0 - 1)); + else + _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + + /* Control writing of the depth clear value to depth. */ + if (this_mask & BUFFER_BIT_DEPTH) { + _mesa_DepthFunc(GL_ALWAYS); + _mesa_Enable(GL_DEPTH_TEST); + } else { + _mesa_Disable(GL_DEPTH_TEST); + _mesa_DepthMask(GL_FALSE); + } + + /* Control writing of the stencil clear value to stencil. */ + if (this_mask & BUFFER_BIT_STENCIL) { + _mesa_Enable(GL_STENCIL_TEST); + _mesa_StencilOpSeparate(GL_FRONT_AND_BACK, + GL_REPLACE, GL_REPLACE, GL_REPLACE); + _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, + ctx->Stencil.Clear & 0x7fffffff, + ctx->Stencil.WriteMask[0]); + } else { + _mesa_Disable(GL_STENCIL_TEST); + } + + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + + mask &= ~this_mask; + } + + meta_restore_transform(meta); + + _mesa_ActiveTextureARB(GL_TEXTURE0 + saved_active_texture); + if (saved_fp_enable) + _mesa_Enable(GL_FRAGMENT_PROGRAM_ARB); + if (saved_vp_enable) + _mesa_Enable(GL_VERTEX_PROGRAM_ARB); + + if (saved_shader_program) + _mesa_UseProgramObjectARB(saved_shader_program); + + _mesa_PopAttrib(); + + /* restore current array object */ + ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_ALL; + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave); + _mesa_reference_array_object(ctx, &arraySave, NULL); +} + +void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta) +{ + meta->ctx = ctx; +} + +void meta_destroy_metaops(struct dri_metaops *meta) +{ + if (meta->clear.arrayObj) + _mesa_delete_array_object(meta->ctx, meta->clear.arrayObj); + +} diff --git a/src/mesa/drivers/dri/common/dri_metaops.h b/src/mesa/drivers/dri/common/dri_metaops.h new file mode 100644 index 00000000000..bb4079d5353 --- /dev/null +++ b/src/mesa/drivers/dri/common/dri_metaops.h @@ -0,0 +1,99 @@ +/************************************************************************** + * + * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 Intel Corporation. + * 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 TUNGSTEN GRAPHICS 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 DRI_METAOPS_H +#define DRI_METAOPS_H + +#define TRI_CLEAR_COLOR_BITS (BUFFER_BIT_BACK_LEFT | \ + BUFFER_BIT_FRONT_LEFT | \ + BUFFER_BIT_COLOR0 | \ + BUFFER_BIT_COLOR1 | \ + BUFFER_BIT_COLOR2 | \ + BUFFER_BIT_COLOR3 | \ + BUFFER_BIT_COLOR4 | \ + BUFFER_BIT_COLOR5 | \ + BUFFER_BIT_COLOR6 | \ + BUFFER_BIT_COLOR7) + +struct dri_meta_clear { + struct gl_array_object *arrayObj; + GLfloat vertices[4][3]; + GLfloat color[4][4]; +}; + +struct dri_metaops { + GLcontext *ctx; + GLboolean internal_viewport_call; + struct gl_fragment_program *bitmap_fp; + struct gl_vertex_program *passthrough_vp; + struct gl_buffer_object *texcoord_vbo; + + struct gl_fragment_program *saved_fp; + GLboolean saved_fp_enable; + struct gl_vertex_program *saved_vp; + GLboolean saved_vp_enable; + + struct gl_fragment_program *tex2d_fp; + + GLboolean saved_texcoord_enable; + struct gl_buffer_object *saved_array_vbo, *saved_texcoord_vbo; + GLenum saved_texcoord_type; + GLsizei saved_texcoord_size, saved_texcoord_stride; + const void *saved_texcoord_ptr; + int saved_active_texture; + + GLint saved_vp_x, saved_vp_y; + GLsizei saved_vp_width, saved_vp_height; + GLenum saved_matrix_mode; + + struct dri_meta_clear clear; +}; + + +void meta_set_passthrough_transform(struct dri_metaops *meta); + +void meta_restore_transform(struct dri_metaops *meta); + +void meta_set_passthrough_vertex_program(struct dri_metaops *meta); + +void meta_restore_vertex_program(struct dri_metaops *meta); + +void meta_set_fragment_program(struct dri_metaops *meta, + struct gl_fragment_program **prog, + const char *prog_string); + +void meta_restore_fragment_program(struct dri_metaops *meta); + +void meta_set_default_texrect(struct dri_metaops *meta); + +void meta_restore_texcoords(struct dri_metaops *meta); +void meta_clear_tris(struct dri_metaops *meta, GLbitfield mask); + +void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta); +void meta_destroy_metaops(struct dri_metaops *meta); +#endif + diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index ae0e61e515b..1d940603fa8 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/lib/GL/dri/dri_util.c,v 1.7 2003/04/28 17:01:25 dawes Exp $ */ /** * \file dri_util.c * DRI utility functions. @@ -122,6 +121,9 @@ static int driUnbindContext(__DRIcontext *pcp) pdp = pcp->driDrawablePriv; prp = pcp->driReadablePriv; + /* already unbound */ + if (!pdp && !prp) + return GL_TRUE; /* Let driver unbind drawable from context */ (*psp->DriverAPI.UnbindContext)(pcp); @@ -146,9 +148,10 @@ static int driUnbindContext(__DRIcontext *pcp) * window we can determine the last context bound to the window and * use that context's lock. (BrianP, 2-Dec-2000) */ + pcp->driDrawablePriv = pcp->driReadablePriv = NULL; + #if 0 /* Unbind the drawable */ - pcp->driDrawablePriv = NULL; pdp->driContextPriv = &psp->dummyContextPriv; #endif diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h index f5e35e41618..e308fd28311 100644 --- a/src/mesa/drivers/dri/common/extension_helper.h +++ b/src/mesa/drivers/dri/common/extension_helper.h @@ -406,9 +406,10 @@ static const char UniformMatrix4fvARB_names[] = ""; #endif -#if defined(need_GL_APPLE_vertex_array_object) +#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object) static const char DeleteVertexArraysAPPLE_names[] = "ip\0" /* Parameter signature */ + "glDeleteVertexArrays\0" "glDeleteVertexArraysAPPLE\0" ""; #endif @@ -941,6 +942,13 @@ static const char WeightivARB_names[] = ""; #endif +#if defined(need_GL_SGIX_instruments) +static const char PollInstrumentsSGIX_names[] = + "p\0" /* Parameter signature */ + "glPollInstrumentsSGIX\0" + ""; +#endif + #if defined(need_GL_SUN_global_alpha) static const char GlobalAlphaFactordSUN_names[] = "d\0" /* Parameter signature */ @@ -2114,6 +2122,13 @@ static const char Tangent3fvEXT_names[] = ""; #endif +#if defined(need_GL_ARB_vertex_array_object) +static const char GenVertexArrays_names[] = + "ip\0" /* Parameter signature */ + "glGenVertexArrays\0" + ""; +#endif + #if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) static const char BindFramebufferEXT_names[] = "ii\0" /* Parameter signature */ @@ -2340,10 +2355,10 @@ static const char GetCombinerStageParameterfvNV_names[] = ""; #endif -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3fEXT_names[] = - "fff\0" /* Parameter signature */ - "glBinormal3fEXT\0" +#if defined(need_GL_ARB_vertex_array_object) +static const char BindVertexArray_names[] = + "i\0" /* Parameter signature */ + "glBindVertexArray\0" ""; #endif @@ -2773,10 +2788,10 @@ static const char Uniform4fARB_names[] = ""; #endif -#if defined(need_GL_IBM_multimode_draw_arrays) -static const char MultiModeDrawArraysIBM_names[] = - "pppii\0" /* Parameter signature */ - "glMultiModeDrawArraysIBM\0" +#if defined(need_GL_ARB_map_buffer_range) +static const char FlushMappedBufferRange_names[] = + "iii\0" /* Parameter signature */ + "glFlushMappedBufferRange\0" ""; #endif @@ -3403,10 +3418,11 @@ static const char GetProgramParameterdvNV_names[] = ""; #endif -#if defined(need_GL_SGIX_instruments) -static const char PollInstrumentsSGIX_names[] = - "p\0" /* Parameter signature */ - "glPollInstrumentsSGIX\0" +#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object) +static const char IsVertexArrayAPPLE_names[] = + "i\0" /* Parameter signature */ + "glIsVertexArray\0" + "glIsVertexArrayAPPLE\0" ""; #endif @@ -3904,6 +3920,13 @@ static const char VertexAttribs4dvNV_names[] = ""; #endif +#if defined(need_GL_IBM_multimode_draw_arrays) +static const char MultiModeDrawArraysIBM_names[] = + "pppii\0" /* Parameter signature */ + "glMultiModeDrawArraysIBM\0" + ""; +#endif + #if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) static const char VertexAttrib4dARB_names[] = "idddd\0" /* Parameter signature */ @@ -3933,6 +3956,13 @@ static const char VertexWeightfEXT_names[] = ""; #endif +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3fEXT_names[] = + "fff\0" /* Parameter signature */ + "glBinormal3fEXT\0" + ""; +#endif + #if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) static const char FogCoordfvEXT_names[] = "p\0" /* Parameter signature */ @@ -4048,10 +4078,10 @@ static const char BlendFuncSeparateEXT_names[] = ""; #endif -#if defined(need_GL_APPLE_vertex_array_object) -static const char IsVertexArrayAPPLE_names[] = - "i\0" /* Parameter signature */ - "glIsVertexArrayAPPLE\0" +#if defined(need_GL_ARB_map_buffer_range) +static const char MapBufferRange_names[] = + "iiii\0" /* Parameter signature */ + "glMapBufferRange\0" ""; #endif @@ -4296,6 +4326,13 @@ static const char SpriteParameterivSGIX_names[] = ""; #endif +#if defined(need_GL_EXT_provoking_vertex) +static const char ProvokingVertexEXT_names[] = + "i\0" /* Parameter signature */ + "glProvokingVertexEXT\0" + ""; +#endif + #if defined(need_GL_VERSION_1_3) static const char MultiTexCoord1fARB_names[] = "if\0" /* Parameter signature */ @@ -4940,8 +4977,8 @@ static const struct dri_extension_function GL_3DFX_tbuffer_functions[] = { static const struct dri_extension_function GL_APPLE_vertex_array_object_functions[] = { { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 }, { GenVertexArraysAPPLE_names, GenVertexArraysAPPLE_remap_index, -1 }, - { BindVertexArrayAPPLE_names, BindVertexArrayAPPLE_remap_index, -1 }, { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 }, + { BindVertexArrayAPPLE_names, BindVertexArrayAPPLE_remap_index, -1 }, { NULL, 0, 0 } }; #endif @@ -4986,6 +5023,14 @@ static const struct dri_extension_function GL_ARB_framebuffer_object_functions[] }; #endif +#if defined(need_GL_ARB_map_buffer_range) +static const struct dri_extension_function GL_ARB_map_buffer_range_functions[] = { + { FlushMappedBufferRange_names, FlushMappedBufferRange_remap_index, -1 }, + { MapBufferRange_names, MapBufferRange_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + #if defined(need_GL_ARB_matrix_palette) static const struct dri_extension_function GL_ARB_matrix_palette_functions[] = { { MatrixIndexusvARB_names, MatrixIndexusvARB_remap_index, -1 }, @@ -5094,6 +5139,16 @@ static const struct dri_extension_function GL_ARB_transpose_matrix_functions[] = }; #endif +#if defined(need_GL_ARB_vertex_array_object) +static const struct dri_extension_function GL_ARB_vertex_array_object_functions[] = { + { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 }, + { GenVertexArrays_names, GenVertexArrays_remap_index, -1 }, + { BindVertexArray_names, BindVertexArray_remap_index, -1 }, + { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + #if defined(need_GL_ARB_vertex_blend) static const struct dri_extension_function GL_ARB_vertex_blend_functions[] = { { WeightubvARB_names, WeightubvARB_remap_index, -1 }, @@ -5347,7 +5402,6 @@ static const struct dri_extension_function GL_EXT_coordinate_frame_functions[] = { Binormal3ivEXT_names, Binormal3ivEXT_remap_index, -1 }, { Tangent3sEXT_names, Tangent3sEXT_remap_index, -1 }, { Tangent3fvEXT_names, Tangent3fvEXT_remap_index, -1 }, - { Binormal3fEXT_names, Binormal3fEXT_remap_index, -1 }, { Tangent3dvEXT_names, Tangent3dvEXT_remap_index, -1 }, { Binormal3bvEXT_names, Binormal3bvEXT_remap_index, -1 }, { Binormal3dEXT_names, Binormal3dEXT_remap_index, -1 }, @@ -5356,6 +5410,7 @@ static const struct dri_extension_function GL_EXT_coordinate_frame_functions[] = { Tangent3ivEXT_names, Tangent3ivEXT_remap_index, -1 }, { Tangent3dEXT_names, Tangent3dEXT_remap_index, -1 }, { Binormal3svEXT_names, Binormal3svEXT_remap_index, -1 }, + { Binormal3fEXT_names, Binormal3fEXT_remap_index, -1 }, { Binormal3dvEXT_names, Binormal3dvEXT_remap_index, -1 }, { Tangent3iEXT_names, Tangent3iEXT_remap_index, -1 }, { Tangent3bvEXT_names, Tangent3bvEXT_remap_index, -1 }, @@ -5541,6 +5596,13 @@ static const struct dri_extension_function GL_EXT_polygon_offset_functions[] = { }; #endif +#if defined(need_GL_EXT_provoking_vertex) +static const struct dri_extension_function GL_EXT_provoking_vertex_functions[] = { + { ProvokingVertexEXT_names, ProvokingVertexEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + #if defined(need_GL_EXT_secondary_color) static const struct dri_extension_function GL_EXT_secondary_color_functions[] = { { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, -1 }, @@ -6038,11 +6100,11 @@ static const struct dri_extension_function GL_SGIX_igloo_interface_functions[] = #if defined(need_GL_SGIX_instruments) static const struct dri_extension_function GL_SGIX_instruments_functions[] = { { ReadInstrumentsSGIX_names, ReadInstrumentsSGIX_remap_index, -1 }, + { PollInstrumentsSGIX_names, PollInstrumentsSGIX_remap_index, -1 }, { GetInstrumentsSGIX_names, GetInstrumentsSGIX_remap_index, -1 }, { StartInstrumentsSGIX_names, StartInstrumentsSGIX_remap_index, -1 }, { StopInstrumentsSGIX_names, StopInstrumentsSGIX_remap_index, -1 }, { InstrumentsBufferSGIX_names, InstrumentsBufferSGIX_remap_index, -1 }, - { PollInstrumentsSGIX_names, PollInstrumentsSGIX_remap_index, -1 }, { NULL, 0, 0 } }; #endif diff --git a/src/mesa/drivers/dri/common/xmlpool.h b/src/mesa/drivers/dri/common/xmlpool.h index 7fbc6e800d0..587517ea10a 100644 --- a/src/mesa/drivers/dri/common/xmlpool.h +++ b/src/mesa/drivers/dri/common/xmlpool.h @@ -60,6 +60,10 @@ #define DRI_CONF_OPT_BEGIN(name,type,def) \ "<option name=\""#name"\" type=\""#type"\" default=\""#def"\">\n" +/** \brief Begin an option definition with qouted default value */ +#define DRI_CONF_OPT_BEGIN_Q(name,type,def) \ +"<option name=\""#name"\" type=\""#type"\" default="#def">\n" + /** \brief Begin an option definition with restrictions on valid values */ #define DRI_CONF_OPT_BEGIN_V(name,type,def,valid) \ "<option name=\""#name"\" type=\""#type"\" default=\""#def"\" valid=\""valid"\">\n" diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index cbee9f9efe9..9c6f891dd32 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -737,12 +737,6 @@ i830_assert_not_dirty( struct intel_context *intel ) assert(!get_dirty(state)); } -static void -i830_note_unlock( struct intel_context *intel ) -{ - /* nothing */ -} - void i830InitVtbl(struct i830_context *i830) { @@ -757,6 +751,5 @@ i830InitVtbl(struct i830_context *i830) i830->intel.vtbl.render_start = i830_render_start; i830->intel.vtbl.render_prevalidate = i830_render_prevalidate; i830->intel.vtbl.assert_not_dirty = i830_assert_not_dirty; - i830->intel.vtbl.note_unlock = i830_note_unlock; i830->intel.vtbl.finish_batch = intel_finish_vb; } diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 2fca247af19..fe1be93a6d0 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -692,13 +692,6 @@ i915_assert_not_dirty( struct intel_context *intel ) assert(!dirty); } -static void -i915_note_unlock( struct intel_context *intel ) -{ - /* nothing */ -} - - void i915InitVtbl(struct i915_context *i915) { @@ -713,6 +706,5 @@ i915InitVtbl(struct i915_context *i915) i915->intel.vtbl.update_texture_state = i915UpdateTextureState; i915->intel.vtbl.flush_cmd = i915_flush_cmd; i915->intel.vtbl.assert_not_dirty = i915_assert_not_dirty; - i915->intel.vtbl.note_unlock = i915_note_unlock; i915->intel.vtbl.finish_batch = intel_finish_vb; } diff --git a/src/mesa/drivers/dri/i915/intel_pixel_read.c b/src/mesa/drivers/dri/i915/intel_pixel_read.c index 56087aacd4e..cc4589f4d42 100644..120000 --- a/src/mesa/drivers/dri/i915/intel_pixel_read.c +++ b/src/mesa/drivers/dri/i915/intel_pixel_read.c @@ -1,306 +1 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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 TUNGSTEN GRAPHICS 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/glheader.h" -#include "main/enums.h" -#include "main/mtypes.h" -#include "main/macros.h" -#include "main/image.h" -#include "main/bufferobj.h" -#include "swrast/swrast.h" - -#include "intel_screen.h" -#include "intel_context.h" -#include "intel_batchbuffer.h" -#include "intel_blit.h" -#include "intel_buffers.h" -#include "intel_regions.h" -#include "intel_pixel.h" -#include "intel_buffer_objects.h" - -/* For many applications, the new ability to pull the source buffers - * back out of the GTT and then do the packing/conversion operations - * in software will be as much of an improvement as trying to get the - * blitter and/or texture engine to do the work. - * - * This step is gated on private backbuffers. - * - * Obviously the frontbuffer can't be pulled back, so that is either - * an argument for blit/texture readpixels, or for blitting to a - * temporary and then pulling that back. - * - * When the destination is a pbo, however, it's not clear if it is - * ever going to be pulled to main memory (though the access param - * will be a good hint). So it sounds like we do want to be able to - * choose between blit/texture implementation on the gpu and pullback - * and cpu-based copying. - * - * Unless you can magically turn client memory into a PBO for the - * duration of this call, there will be a cpu-based copying step in - * any case. - */ - - -static GLboolean -do_texture_readpixels(GLcontext * ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, - struct intel_region *dest_region) -{ -#if 0 - struct intel_context *intel = intel_context(ctx); - intelScreenPrivate *screen = intel->intelScreen; - GLint pitch = pack->RowLength ? pack->RowLength : width; - __DRIdrawablePrivate *dPriv = intel->driDrawable; - int textureFormat; - GLenum glTextureFormat; - int destFormat, depthFormat, destPitch; - drm_clip_rect_t tmp; - - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s\n", __FUNCTION__); - - - if (ctx->_ImageTransferState || - pack->SwapBytes || pack->LsbFirst || !pack->Invert) { - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s: check_color failed\n", __FUNCTION__); - return GL_FALSE; - } - - intel->vtbl.meta_texrect_source(intel, intel_readbuf_region(intel)); - - if (!intel->vtbl.meta_render_dest(intel, dest_region, type, format)) { - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s: couldn't set dest %s/%s\n", - __FUNCTION__, - _mesa_lookup_enum_by_nr(type), - _mesa_lookup_enum_by_nr(format)); - return GL_FALSE; - } - - LOCK_HARDWARE(intel); - - if (intel->driDrawable->numClipRects) { - intel->vtbl.install_meta_state(intel); - intel->vtbl.meta_no_depth_write(intel); - intel->vtbl.meta_no_stencil_write(intel); - - if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) { - UNLOCK_HARDWARE(intel); - SET_STATE(i830, state); - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__); - return GL_TRUE; - } - - y = dPriv->h - y - height; - x += dPriv->x; - y += dPriv->y; - - - /* Set the frontbuffer up as a large rectangular texture. - */ - intel->vtbl.meta_tex_rect_source(intel, src_region, textureFormat); - - - intel->vtbl.meta_texture_blend_replace(i830, glTextureFormat); - - - /* Set the 3d engine to draw into the destination region: - */ - - intel->vtbl.meta_draw_region(intel, dest_region); - intel->vtbl.meta_draw_format(intel, destFormat, depthFormat); /* ?? */ - - - /* Draw a single quad, no cliprects: - */ - intel->vtbl.meta_disable_cliprects(intel); - - intel->vtbl.draw_quad(intel, - 0, width, 0, height, - 0x00ff00ff, x, x + width, y, y + height); - - intel->vtbl.leave_meta_state(intel); - } - UNLOCK_HARDWARE(intel); - - intel_region_wait_fence(ctx, dest_region); /* required by GL */ - return GL_TRUE; -#endif - - return GL_FALSE; -} - - - - -static GLboolean -do_blit_readpixels(GLcontext * ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, GLvoid * pixels) -{ - struct intel_context *intel = intel_context(ctx); - struct intel_region *src = intel_readbuf_region(intel); - struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj); - GLuint dst_offset; - GLuint rowLength; - - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s\n", __FUNCTION__); - - if (!src) - return GL_FALSE; - - if (dst) { - /* XXX This validation should be done by core mesa: - */ - if (!_mesa_validate_pbo_access(2, pack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels"); - return GL_TRUE; - } - } - else { - /* PBO only for now: - */ - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - not PBO\n", __FUNCTION__); - return GL_FALSE; - } - - - if (ctx->_ImageTransferState || - !intel_check_blit_format(src, format, type)) { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - bad format for blit\n", __FUNCTION__); - return GL_FALSE; - } - - if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s: bad packing params\n", __FUNCTION__); - return GL_FALSE; - } - - if (pack->RowLength > 0) - rowLength = pack->RowLength; - else - rowLength = width; - - if (pack->Invert) { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__); - return GL_FALSE; - } - else { - rowLength = -rowLength; - } - - /* XXX 64-bit cast? */ - dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height, - format, type, 0, 0, 0); - - - /* Although the blits go on the command buffer, need to do this and - * fire with lock held to guarentee cliprects are correct. - */ - intelFlush(&intel->ctx); - LOCK_HARDWARE(intel); - - if (intel->driDrawable->numClipRects) { - GLboolean all = (width * height * src->cpp == dst->Base.Size && - x == 0 && dst_offset == 0); - - dri_bo *dst_buffer = intel_bufferobj_buffer(intel, dst, - all ? INTEL_WRITE_FULL : - INTEL_WRITE_PART); - __DRIdrawablePrivate *dPriv = intel->driDrawable; - int nbox = dPriv->numClipRects; - drm_clip_rect_t *box = dPriv->pClipRects; - drm_clip_rect_t rect; - drm_clip_rect_t src_rect; - int i; - - src_rect.x1 = dPriv->x + x; - src_rect.y1 = dPriv->y + dPriv->h - (y + height); - src_rect.x2 = src_rect.x1 + width; - src_rect.y2 = src_rect.y1 + height; - - - - for (i = 0; i < nbox; i++) { - if (!intel_intersect_cliprects(&rect, &src_rect, &box[i])) - continue; - - intelEmitCopyBlit(intel, - src->cpp, - src->pitch, src->buffer, 0, src->tiling, - rowLength, dst_buffer, dst_offset, GL_FALSE, - rect.x1, - rect.y1, - rect.x1 - src_rect.x1, - rect.y2 - src_rect.y2, - rect.x2 - rect.x1, rect.y2 - rect.y1, - GL_COPY); - } - } - UNLOCK_HARDWARE(intel); - - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - DONE\n", __FUNCTION__); - - return GL_TRUE; -} - -void -intelReadPixels(GLcontext * ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, GLvoid * pixels) -{ - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s\n", __FUNCTION__); - - intelFlush(ctx); - - if (do_blit_readpixels - (ctx, x, y, width, height, format, type, pack, pixels)) - return; - - if (do_texture_readpixels - (ctx, x, y, width, height, format, type, pack, pixels)) - return; - - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s: fallback to swrast\n", __FUNCTION__); - - _swrast_ReadPixels(ctx, x, y, width, height, format, type, pack, pixels); -} +../intel/intel_pixel_read.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index 1d39278cbf0..a905455342d 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -1255,11 +1255,9 @@ intel_meta_draw_poly(struct intel_context *intel, { union fi *vb; GLint i; - GLboolean was_locked = intel->locked; unsigned int saved_vertex_size = intel->vertex_size; - if (!was_locked) - LOCK_HARDWARE(intel); + LOCK_HARDWARE(intel); intel->vertex_size = 6; @@ -1283,8 +1281,7 @@ intel_meta_draw_poly(struct intel_context *intel, intel->vertex_size = saved_vertex_size; - if (!was_locked) - UNLOCK_HARDWARE(intel); + UNLOCK_HARDWARE(intel); } static void diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 9712c387254..00a42111da0 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -23,6 +23,7 @@ DRIVER_SOURCES = \ intel_pixel_bitmap.c \ intel_pixel_copy.c \ intel_pixel_draw.c \ + intel_pixel_read.c \ intel_state.c \ intel_swapbuffers.c \ intel_tex.c \ diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index 5cffcebde43..54d30a3f422 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -65,21 +65,31 @@ static void compile_clip_prog( struct brw_context *brw, c.func.single_program_flow = 1; c.key = *key; - + c.need_ff_sync = BRW_IS_IGDNG(brw); /* Need to locate the two positions present in vertex + header. * These are currently hardcoded: */ c.header_position_offset = ATTR_SIZE; - for (i = 0, delta = REG_SIZE; i < VERT_RESULT_MAX; i++) + if (BRW_IS_IGDNG(brw)) + delta = 3 * REG_SIZE; + else + delta = REG_SIZE; + + for (i = 0; i < VERT_RESULT_MAX; i++) if (c.key.attrs & (1<<i)) { c.offset[i] = delta; delta += ATTR_SIZE; } c.nr_attrs = brw_count_bits(c.key.attrs); - c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */ + + if (BRW_IS_IGDNG(brw)) + c.nr_regs = (c.nr_attrs + 1) / 2 + 3; /* are vertices packed, or reg-aligned? */ + else + c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */ + c.nr_bytes = c.nr_regs * REG_SIZE; c.prog_data.clip_mode = c.key.clip_mode; /* XXX */ @@ -148,7 +158,11 @@ static void upload_clip_prog(struct brw_context *brw) key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT); /* _NEW_TRANSFORM */ key.nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled); - key.clip_mode = BRW_CLIPMODE_NORMAL; + + if (BRW_IS_IGDNG(brw)) + key.clip_mode = BRW_CLIPMODE_KERNEL_CLIP; + else + key.clip_mode = BRW_CLIPMODE_NORMAL; /* _NEW_POLYGON */ if (key.primitive == GL_TRIANGLES) { diff --git a/src/mesa/drivers/dri/i965/brw_clip.h b/src/mesa/drivers/dri/i965/brw_clip.h index e06747864b5..12e8548df1f 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.h +++ b/src/mesa/drivers/dri/i965/brw_clip.h @@ -117,6 +117,7 @@ struct brw_clip_compile { GLuint header_position_offset; GLuint offset[VERT_ATTRIB_MAX]; + GLboolean need_ff_sync; }; #define ATTR_SIZE (4*4) @@ -171,5 +172,5 @@ struct brw_reg get_tmp( struct brw_clip_compile *c ); void brw_clip_project_position(struct brw_clip_compile *c, struct brw_reg pos ); - +void brw_clip_ff_sync(struct brw_clip_compile *c); #endif diff --git a/src/mesa/drivers/dri/i965/brw_clip_line.c b/src/mesa/drivers/dri/i965/brw_clip_line.c index d830e49e50a..9abd0642aa2 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_line.c +++ b/src/mesa/drivers/dri/i965/brw_clip_line.c @@ -130,7 +130,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c ) struct brw_instruction *plane_loop; struct brw_instruction *plane_active; struct brw_instruction *is_negative; - struct brw_instruction *is_neg2; + struct brw_instruction *is_neg2 = NULL; struct brw_instruction *not_culled; struct brw_reg v1_null_ud = retype(vec1(brw_null_reg()), BRW_REGISTER_TYPE_UD); @@ -148,7 +148,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c ) brw_clip_init_clipmask(c); /* -ve rhw workaround */ - if (!BRW_IS_G4X(p->brw)) { + if (BRW_IS_965(p->brw)) { brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2), brw_imm_ud(1<<20)); @@ -185,7 +185,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c ) * Both can be negative on GM965/G965 due to RHW workaround * if so, this object should be rejected. */ - if (!BRW_IS_G4X(p->brw)) { + if (BRW_IS_965(p->brw)) { brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_LE, c->reg.dp0, brw_imm_f(0.0)); is_neg2 = brw_IF(p, BRW_EXECUTE_1); { @@ -210,7 +210,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c ) /* If both are positive, do nothing */ /* Only on GM965/G965 */ - if (!BRW_IS_G4X(p->brw)) { + if (BRW_IS_965(p->brw)) { brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.dp0, brw_imm_f(0.0)); is_neg2 = brw_IF(p, BRW_EXECUTE_1); } @@ -225,7 +225,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c ) brw_set_predicate_control(p, BRW_PREDICATE_NONE); } - if (!BRW_IS_G4X(p->brw)) { + if (BRW_IS_965(p->brw)) { brw_ENDIF(p, is_neg2); } } @@ -246,6 +246,8 @@ static void clip_and_emit_line( struct brw_clip_compile *c ) brw_ADD(p, c->reg.t, c->reg.t0, c->reg.t1); brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.t, brw_imm_f(1.0)); + if (c->need_ff_sync) + brw_clip_ff_sync(c); not_culled = brw_IF(p, BRW_EXECUTE_1); { brw_clip_interp_vertex(c, newvtx0, vtx0, vtx1, c->reg.t0, GL_FALSE); diff --git a/src/mesa/drivers/dri/i965/brw_clip_point.c b/src/mesa/drivers/dri/i965/brw_clip_point.c index d17b199b898..97382991686 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_point.c +++ b/src/mesa/drivers/dri/i965/brw_clip_point.c @@ -50,5 +50,7 @@ void brw_emit_point_clip( struct brw_clip_compile *c ) /* Send an empty message to kill the thread: */ brw_clip_tri_alloc_regs(c, 0); + if (c->need_ff_sync) + brw_clip_ff_sync(c); brw_clip_kill_thread(c); } diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index 9b0d7eab7bf..5762c9577c6 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -95,7 +95,14 @@ clip_unit_create_from_key(struct brw_context *brw, * even number. */ assert(key->nr_urb_entries % 2 == 0); - clip.thread4.max_threads = 2 - 1; + + /* Although up to 16 concurrent Clip threads are allowed on IGDNG, + * only 2 threads can output VUEs at a time. + */ + if (BRW_IS_IGDNG(brw)) + clip.thread4.max_threads = 16 - 1; + else + clip.thread4.max_threads = 2 - 1; } else { assert(key->nr_urb_entries >= 5); clip.thread4.max_threads = 1 - 1; diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c index 7fd37bd05ff..4c2d655fb10 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_tri.c +++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c @@ -77,6 +77,10 @@ void brw_clip_tri_alloc_regs( struct brw_clip_compile *c, if (c->nr_attrs & 1) { for (j = 0; j < 3; j++) { GLuint delta = c->nr_attrs*16 + 32; + + if (BRW_IS_IGDNG(c->func.brw)) + delta = c->nr_attrs * 16 + 32 * 3; + brw_MOV(&c->func, byte_offset(c->reg.vertex[j], delta), brw_imm_f(0)); } } @@ -562,7 +566,7 @@ void brw_emit_tri_clip( struct brw_clip_compile *c ) /* if -ve rhw workaround bit is set, do cliptest */ - if (!BRW_IS_G4X(p->brw)) { + if (BRW_IS_965(p->brw)) { brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2), brw_imm_ud(1<<20)); @@ -579,11 +583,14 @@ void brw_emit_tri_clip( struct brw_clip_compile *c ) if (c->key.do_flat_shading) brw_clip_tri_flat_shade(c); - if (c->key.clip_mode == BRW_CLIPMODE_NORMAL) + if ((c->key.clip_mode == BRW_CLIPMODE_NORMAL) || + (c->key.clip_mode == BRW_CLIPMODE_KERNEL_CLIP)) do_clip_tri(c); else maybe_do_clip_tri(c); - + + if (c->need_ff_sync) + brw_clip_ff_sync(c); brw_clip_tri_emit_polygon(c); /* Send an empty message to kill the thread: diff --git a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c index d7ca517927b..26950383c1b 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c +++ b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c @@ -496,6 +496,8 @@ void brw_emit_unfilled_clip( struct brw_clip_compile *c ) } brw_ENDIF(p, do_clip); + if (c->need_ff_sync) + brw_clip_ff_sync(c); emit_unfilled_primitives(c); brw_clip_kill_thread(c); } diff --git a/src/mesa/drivers/dri/i965/brw_clip_util.c b/src/mesa/drivers/dri/i965/brw_clip_util.c index 9d3b0be694a..e09efc07ed4 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_util.c +++ b/src/mesa/drivers/dri/i965/brw_clip_util.c @@ -140,6 +140,10 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c, /* Just copy the vertex header: */ + /* + * After CLIP stage, only first 256 bits of the VUE are read + * back on IGDNG, so needn't change it + */ brw_copy_indirect_to_indirect(p, dest_ptr, v0_ptr, 1); /* Iterate over each attribute (could be done in pairs?) @@ -147,6 +151,9 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c, for (i = 0; i < c->nr_attrs; i++) { GLuint delta = i*16 + 32; + if (BRW_IS_IGDNG(p->brw)) + delta = i * 16 + 32 * 3; + if (delta == c->offset[VERT_RESULT_EDGE]) { if (force_edgeflag) brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(1)); @@ -177,6 +184,10 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c, if (i & 1) { GLuint delta = i*16 + 32; + + if (BRW_IS_IGDNG(p->brw)) + delta = i * 16 + 32 * 3; + brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(0)); } @@ -343,3 +354,19 @@ void brw_clip_init_clipmask( struct brw_clip_compile *c ) } } +void brw_clip_ff_sync(struct brw_clip_compile *c) +{ + struct brw_compile *p = &c->func; + brw_ff_sync(p, + c->reg.R0, + 0, + c->reg.R0, + 1, + 1, /* used */ + 1, /* msg length */ + 1, /* response length */ + 0, /* eot */ + 1, /* write compelete */ + 0, /* urb offset */ + BRW_URB_SWIZZLE_NONE); +} diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 873fc8ffff6..57ddf75413a 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -129,7 +129,6 @@ struct brw_context; #define BRW_NEW_PRIMITIVE 0x40 #define BRW_NEW_CONTEXT 0x80 #define BRW_NEW_WM_INPUT_DIMENSIONS 0x100 -#define BRW_NEW_INPUT_VARYING 0x200 #define BRW_NEW_PSP 0x800 #define BRW_NEW_WM_SURFACES 0x1000 #define BRW_NEW_FENCE 0x2000 @@ -246,9 +245,6 @@ struct brw_vs_ouput_sizes { }; -/** Number of general purpose registers (VS, WM, etc) */ -#define BRW_MAX_GRF 128 - /** Number of texture sampler units */ #define BRW_MAX_TEX_UNIT 16 @@ -405,7 +401,6 @@ struct brw_vertex_element { struct brw_vertex_info { - GLuint varying; /* varying:1[VERT_ATTRIB_MAX] */ GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[VERT_ATTRIB_MAX] */ }; @@ -614,9 +609,10 @@ struct brw_context struct brw_wm_prog_data *prog_data; struct brw_wm_compile *compile_data; - /* Input sizes, calculated from active vertex program: + /** Input sizes, calculated from active vertex program. + * One bit per fragment program input attribute. */ - GLuint input_size_masks[4]; + GLbitfield input_size_masks[4]; /** Array of surface default colors (texture border color) */ dri_bo *sdc_bo[BRW_MAX_TEX_UNIT]; diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 98fc909c2ad..d166250b4fe 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -139,6 +139,7 @@ #define BRW_CLIPMODE_CLIP_NON_REJECTED 2 #define BRW_CLIPMODE_REJECT_ALL 3 #define BRW_CLIPMODE_ACCEPT_ALL 4 +#define BRW_CLIPMODE_KERNEL_CLIP 5 #define BRW_CLIP_NDCSPACE 0 #define BRW_CLIP_SCREENSPACE 1 @@ -670,6 +671,25 @@ #define BRW_SAMPLER_MESSAGE_SIMD8_LD 3 #define BRW_SAMPLER_MESSAGE_SIMD16_LD 3 +#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_IGDNG 0 +#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_IGDNG 0 +#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_IGDNG 0 +#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_BIAS_IGDNG 1 +#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_BIAS_IGDNG 1 +#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS_IGDNG 1 +#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_LOD_IGDNG 2 +#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD_IGDNG 2 +#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_LOD_IGDNG 2 +#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_COMPARE_IGDNG 3 +#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_COMPARE_IGDNG 3 +#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE_IGDNG 3 + +/* for IGDNG only */ +#define BRW_SAMPLER_SIMD_MODE_SIMD4X2 0 +#define BRW_SAMPLER_SIMD_MODE_SIMD8 1 +#define BRW_SAMPLER_SIMD_MODE_SIMD16 2 +#define BRW_SAMPLER_SIMD_MODE_SIMD32_64 3 + #define BRW_DATAPORT_OWORD_BLOCK_1_OWORDLOW 0 #define BRW_DATAPORT_OWORD_BLOCK_1_OWORDHIGH 1 #define BRW_DATAPORT_OWORD_BLOCK_2_OWORDS 2 @@ -819,8 +839,11 @@ #include "intel_chipset.h" #define BRW_IS_G4X(brw) (IS_G4X((brw)->intel.intelScreen->deviceID)) -#define CMD_PIPELINE_SELECT(brw) (BRW_IS_G4X(brw) ? CMD_PIPELINE_SELECT_GM45 : CMD_PIPELINE_SELECT_965) -#define CMD_VF_STATISTICS(brw) (BRW_IS_G4X(brw) ? CMD_VF_STATISTICS_GM45 : CMD_VF_STATISTICS_965) -#define URB_SIZES(brw) (BRW_IS_G4X(brw) ? 384 : 256) /* 512 bit units */ +#define BRW_IS_IGDNG(brw) (IS_IGDNG((brw)->intel.intelScreen->deviceID)) +#define BRW_IS_965(brw) (!(BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw))) +#define CMD_PIPELINE_SELECT(brw) ((BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw)) ? CMD_PIPELINE_SELECT_GM45 : CMD_PIPELINE_SELECT_965) +#define CMD_VF_STATISTICS(brw) ((BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw)) ? CMD_VF_STATISTICS_GM45 : CMD_VF_STATISTICS_965) +#define URB_SIZES(brw) (BRW_IS_IGDNG(brw) ? 1024 : \ + (BRW_IS_G4X(brw) ? 384 : 256)) /* 512 bit units */ #endif diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 5342622a737..5152c3f3a5f 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -187,19 +187,13 @@ static void brw_merge_inputs( struct brw_context *brw, brw->vb.inputs[i].glarray = arrays[i]; if (arrays[i]->StrideB != 0) - brw->vb.info.varying |= 1 << i; - brw->vb.info.sizes[i/16] |= (brw->vb.inputs[i].glarray->Size - 1) << ((i%16) * 2); } - /* Raise statechanges if input sizes and varying have changed: - */ + /* Raise statechanges if input sizes have changed. */ if (memcmp(brw->vb.info.sizes, old.sizes, sizeof(old.sizes)) != 0) brw->state.dirty.brw |= BRW_NEW_INPUT_DIMENSIONS; - - if (brw->vb.info.varying != old.varying) - brw->state.dirty.brw |= BRW_NEW_INPUT_VARYING; } /* XXX: could split the primitive list to fallback only on the @@ -416,6 +410,8 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx, out: UNLOCK_HARDWARE(intel); + brw_state_cache_check_size(brw); + if (warn) fprintf(stderr, "i965: Single primitive emit potentially exceeded " "available aperture space\n"); diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 1b8bcc14ec0..c29f1dd5c03 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -512,7 +512,19 @@ static void brw_emit_vertices(struct brw_context *brw) OUT_RELOC(input->bo, I915_GEM_DOMAIN_VERTEX, 0, input->offset); - OUT_BATCH(brw->vb.max_index); + if (BRW_IS_IGDNG(brw)) { + if (input->stride) { + OUT_RELOC(input->bo, + I915_GEM_DOMAIN_VERTEX, 0, + input->offset + input->stride * input->count); + } else { + assert(input->count == 1); + OUT_RELOC(input->bo, + I915_GEM_DOMAIN_VERTEX, 0, + input->offset + input->element_size); + } + } else + OUT_BATCH(brw->vb.max_index); OUT_BATCH(0); /* Instance data step rate */ } ADVANCE_BATCH(); @@ -542,11 +554,18 @@ static void brw_emit_vertices(struct brw_context *brw) BRW_VE0_VALID | (format << BRW_VE0_FORMAT_SHIFT) | (0 << BRW_VE0_SRC_OFFSET_SHIFT)); - OUT_BATCH((comp0 << BRW_VE1_COMPONENT_0_SHIFT) | - (comp1 << BRW_VE1_COMPONENT_1_SHIFT) | - (comp2 << BRW_VE1_COMPONENT_2_SHIFT) | - (comp3 << BRW_VE1_COMPONENT_3_SHIFT) | - ((i * 4) << BRW_VE1_DST_OFFSET_SHIFT)); + + if (BRW_IS_IGDNG(brw)) + OUT_BATCH((comp0 << BRW_VE1_COMPONENT_0_SHIFT) | + (comp1 << BRW_VE1_COMPONENT_1_SHIFT) | + (comp2 << BRW_VE1_COMPONENT_2_SHIFT) | + (comp3 << BRW_VE1_COMPONENT_3_SHIFT)); + else + OUT_BATCH((comp0 << BRW_VE1_COMPONENT_0_SHIFT) | + (comp1 << BRW_VE1_COMPONENT_1_SHIFT) | + (comp2 << BRW_VE1_COMPONENT_2_SHIFT) | + (comp3 << BRW_VE1_COMPONENT_3_SHIFT) | + ((i * 4) << BRW_VE1_DST_OFFSET_SHIFT)); } ADVANCE_BATCH(); } @@ -635,7 +654,7 @@ static void brw_emit_indices(struct brw_context *brw) if (index_buffer == NULL) return; - ib_size = get_size(index_buffer->type) * index_buffer->count; + ib_size = get_size(index_buffer->type) * index_buffer->count - 1; /* Emit the indexbuffer packet: */ diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index bc7756ceab4..30603bdd0e6 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -171,9 +171,9 @@ static INLINE struct brw_reg brw_reg( GLuint file, { struct brw_reg reg; if (type == BRW_GENERAL_REGISTER_FILE) - assert(nr < 128); + assert(nr < BRW_MAX_GRF); else if (type == BRW_MESSAGE_REGISTER_FILE) - assert(nr < 9); + assert(nr < BRW_MAX_MRF); else if (type == BRW_ARCHITECTURE_REGISTER_FILE) assert(nr <= BRW_ARF_IP); @@ -538,6 +538,7 @@ static INLINE struct brw_reg brw_mask_reg( GLuint subnr ) static INLINE struct brw_reg brw_message_reg( GLuint nr ) { + assert(nr < BRW_MAX_MRF); return brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, nr, 0); @@ -815,6 +816,19 @@ void brw_urb_WRITE(struct brw_compile *p, GLuint offset, GLuint swizzle); +void brw_ff_sync(struct brw_compile *p, + struct brw_reg dest, + GLuint msg_reg_nr, + struct brw_reg src0, + GLboolean allocate, + GLboolean used, + GLuint msg_length, + GLuint response_length, + GLboolean eot, + GLboolean writes_complete, + GLuint offset, + GLuint swizzle); + void brw_fb_WRITE(struct brw_compile *p, struct brw_reg dest, GLuint msg_reg_nr, @@ -834,7 +848,9 @@ void brw_SAMPLE(struct brw_compile *p, GLuint msg_type, GLuint response_length, GLuint msg_length, - GLboolean eot); + GLboolean eot, + GLuint header_present, + GLuint simd_mode); void brw_math_16( struct brw_compile *p, struct brw_reg dest, @@ -855,12 +871,10 @@ void brw_math( struct brw_compile *p, void brw_dp_READ_16( struct brw_compile *p, struct brw_reg dest, - GLuint msg_reg_nr, GLuint scratch_offset ); void brw_dp_READ_4( struct brw_compile *p, struct brw_reg dest, - GLuint msg_reg_nr, GLboolean relAddr, GLuint location, GLuint bind_table_index ); @@ -875,7 +889,6 @@ void brw_dp_READ_4_vs( struct brw_compile *p, void brw_dp_WRITE_16( struct brw_compile *p, struct brw_reg src, - GLuint msg_reg_nr, GLuint scratch_offset ); /* If/else/endif. Works by manipulating the execution flags on each diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 60ea44f7a96..2412014248c 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -241,7 +241,8 @@ void brw_set_src1( struct brw_instruction *insn, -static void brw_set_math_message( struct brw_instruction *insn, +static void brw_set_math_message( struct brw_context *brw, + struct brw_instruction *insn, GLuint msg_length, GLuint response_length, GLuint function, @@ -252,18 +253,35 @@ static void brw_set_math_message( struct brw_instruction *insn, { brw_set_src1(insn, brw_imm_d(0)); - insn->bits3.math.function = function; - insn->bits3.math.int_type = integer_type; - insn->bits3.math.precision = low_precision; - insn->bits3.math.saturate = saturate; - insn->bits3.math.data_type = dataType; - insn->bits3.math.response_length = response_length; - insn->bits3.math.msg_length = msg_length; - insn->bits3.math.msg_target = BRW_MESSAGE_TARGET_MATH; - insn->bits3.math.end_of_thread = 0; + if (BRW_IS_IGDNG(brw)) { + insn->bits3.math_igdng.function = function; + insn->bits3.math_igdng.int_type = integer_type; + insn->bits3.math_igdng.precision = low_precision; + insn->bits3.math_igdng.saturate = saturate; + insn->bits3.math_igdng.data_type = dataType; + insn->bits3.math_igdng.snapshot = 0; + insn->bits3.math_igdng.header_present = 0; + insn->bits3.math_igdng.response_length = response_length; + insn->bits3.math_igdng.msg_length = msg_length; + insn->bits3.math_igdng.end_of_thread = 0; + insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_MATH; + insn->bits2.send_igdng.end_of_thread = 0; + } else { + insn->bits3.math.function = function; + insn->bits3.math.int_type = integer_type; + insn->bits3.math.precision = low_precision; + insn->bits3.math.saturate = saturate; + insn->bits3.math.data_type = dataType; + insn->bits3.math.response_length = response_length; + insn->bits3.math.msg_length = msg_length; + insn->bits3.math.msg_target = BRW_MESSAGE_TARGET_MATH; + insn->bits3.math.end_of_thread = 0; + } } -static void brw_set_urb_message( struct brw_instruction *insn, + +static void brw_set_ff_sync_message( struct brw_context *brw, + struct brw_instruction *insn, GLboolean allocate, GLboolean used, GLuint msg_length, @@ -273,21 +291,64 @@ static void brw_set_urb_message( struct brw_instruction *insn, GLuint offset, GLuint swizzle_control ) { - brw_set_src1(insn, brw_imm_d(0)); + brw_set_src1(insn, brw_imm_d(0)); + + insn->bits3.urb_igdng.opcode = 1; + insn->bits3.urb_igdng.offset = offset; + insn->bits3.urb_igdng.swizzle_control = swizzle_control; + insn->bits3.urb_igdng.allocate = allocate; + insn->bits3.urb_igdng.used = used; + insn->bits3.urb_igdng.complete = complete; + insn->bits3.urb_igdng.header_present = 1; + insn->bits3.urb_igdng.response_length = response_length; + insn->bits3.urb_igdng.msg_length = msg_length; + insn->bits3.urb_igdng.end_of_thread = end_of_thread; + insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_URB; + insn->bits2.send_igdng.end_of_thread = end_of_thread; +} - insn->bits3.urb.opcode = 0; /* ? */ - insn->bits3.urb.offset = offset; - insn->bits3.urb.swizzle_control = swizzle_control; - insn->bits3.urb.allocate = allocate; - insn->bits3.urb.used = used; /* ? */ - insn->bits3.urb.complete = complete; - insn->bits3.urb.response_length = response_length; - insn->bits3.urb.msg_length = msg_length; - insn->bits3.urb.msg_target = BRW_MESSAGE_TARGET_URB; - insn->bits3.urb.end_of_thread = end_of_thread; +static void brw_set_urb_message( struct brw_context *brw, + struct brw_instruction *insn, + GLboolean allocate, + GLboolean used, + GLuint msg_length, + GLuint response_length, + GLboolean end_of_thread, + GLboolean complete, + GLuint offset, + GLuint swizzle_control ) +{ + brw_set_src1(insn, brw_imm_d(0)); + + if (BRW_IS_IGDNG(brw)) { + insn->bits3.urb_igdng.opcode = 0; /* ? */ + insn->bits3.urb_igdng.offset = offset; + insn->bits3.urb_igdng.swizzle_control = swizzle_control; + insn->bits3.urb_igdng.allocate = allocate; + insn->bits3.urb_igdng.used = used; /* ? */ + insn->bits3.urb_igdng.complete = complete; + insn->bits3.urb_igdng.header_present = 1; + insn->bits3.urb_igdng.response_length = response_length; + insn->bits3.urb_igdng.msg_length = msg_length; + insn->bits3.urb_igdng.end_of_thread = end_of_thread; + insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_URB; + insn->bits2.send_igdng.end_of_thread = end_of_thread; + } else { + insn->bits3.urb.opcode = 0; /* ? */ + insn->bits3.urb.offset = offset; + insn->bits3.urb.swizzle_control = swizzle_control; + insn->bits3.urb.allocate = allocate; + insn->bits3.urb.used = used; /* ? */ + insn->bits3.urb.complete = complete; + insn->bits3.urb.response_length = response_length; + insn->bits3.urb.msg_length = msg_length; + insn->bits3.urb.msg_target = BRW_MESSAGE_TARGET_URB; + insn->bits3.urb.end_of_thread = end_of_thread; + } } -static void brw_set_dp_write_message( struct brw_instruction *insn, +static void brw_set_dp_write_message( struct brw_context *brw, + struct brw_instruction *insn, GLuint binding_table_index, GLuint msg_control, GLuint msg_type, @@ -298,18 +359,33 @@ static void brw_set_dp_write_message( struct brw_instruction *insn, { brw_set_src1(insn, brw_imm_d(0)); - insn->bits3.dp_write.binding_table_index = binding_table_index; - insn->bits3.dp_write.msg_control = msg_control; - insn->bits3.dp_write.pixel_scoreboard_clear = pixel_scoreboard_clear; - insn->bits3.dp_write.msg_type = msg_type; - insn->bits3.dp_write.send_commit_msg = 0; - insn->bits3.dp_write.response_length = response_length; - insn->bits3.dp_write.msg_length = msg_length; - insn->bits3.dp_write.msg_target = BRW_MESSAGE_TARGET_DATAPORT_WRITE; - insn->bits3.urb.end_of_thread = end_of_thread; + if (BRW_IS_IGDNG(brw)) { + insn->bits3.dp_write_igdng.binding_table_index = binding_table_index; + insn->bits3.dp_write_igdng.msg_control = msg_control; + insn->bits3.dp_write_igdng.pixel_scoreboard_clear = pixel_scoreboard_clear; + insn->bits3.dp_write_igdng.msg_type = msg_type; + insn->bits3.dp_write_igdng.send_commit_msg = 0; + insn->bits3.dp_write_igdng.header_present = 1; + insn->bits3.dp_write_igdng.response_length = response_length; + insn->bits3.dp_write_igdng.msg_length = msg_length; + insn->bits3.dp_write_igdng.end_of_thread = end_of_thread; + insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_DATAPORT_WRITE; + insn->bits2.send_igdng.end_of_thread = end_of_thread; + } else { + insn->bits3.dp_write.binding_table_index = binding_table_index; + insn->bits3.dp_write.msg_control = msg_control; + insn->bits3.dp_write.pixel_scoreboard_clear = pixel_scoreboard_clear; + insn->bits3.dp_write.msg_type = msg_type; + insn->bits3.dp_write.send_commit_msg = 0; + insn->bits3.dp_write.response_length = response_length; + insn->bits3.dp_write.msg_length = msg_length; + insn->bits3.dp_write.msg_target = BRW_MESSAGE_TARGET_DATAPORT_WRITE; + insn->bits3.dp_write.end_of_thread = end_of_thread; + } } -static void brw_set_dp_read_message( struct brw_instruction *insn, +static void brw_set_dp_read_message( struct brw_context *brw, + struct brw_instruction *insn, GLuint binding_table_index, GLuint msg_control, GLuint msg_type, @@ -320,15 +396,29 @@ static void brw_set_dp_read_message( struct brw_instruction *insn, { brw_set_src1(insn, brw_imm_d(0)); - insn->bits3.dp_read.binding_table_index = binding_table_index; /*0:7*/ - insn->bits3.dp_read.msg_control = msg_control; /*8:11*/ - insn->bits3.dp_read.msg_type = msg_type; /*12:13*/ - insn->bits3.dp_read.target_cache = target_cache; /*14:15*/ - insn->bits3.dp_read.response_length = response_length; /*16:19*/ - insn->bits3.dp_read.msg_length = msg_length; /*20:23*/ - insn->bits3.dp_read.msg_target = BRW_MESSAGE_TARGET_DATAPORT_READ; /*24:27*/ - insn->bits3.dp_read.pad1 = 0; /*28:30*/ - insn->bits3.dp_read.end_of_thread = end_of_thread; /*31*/ + if (BRW_IS_IGDNG(brw)) { + insn->bits3.dp_read_igdng.binding_table_index = binding_table_index; + insn->bits3.dp_read_igdng.msg_control = msg_control; + insn->bits3.dp_read_igdng.msg_type = msg_type; + insn->bits3.dp_read_igdng.target_cache = target_cache; + insn->bits3.dp_read_igdng.header_present = 1; + insn->bits3.dp_read_igdng.response_length = response_length; + insn->bits3.dp_read_igdng.msg_length = msg_length; + insn->bits3.dp_read_igdng.pad1 = 0; + insn->bits3.dp_read_igdng.end_of_thread = end_of_thread; + insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_DATAPORT_READ; + insn->bits2.send_igdng.end_of_thread = end_of_thread; + } else { + insn->bits3.dp_read.binding_table_index = binding_table_index; /*0:7*/ + insn->bits3.dp_read.msg_control = msg_control; /*8:11*/ + insn->bits3.dp_read.msg_type = msg_type; /*12:13*/ + insn->bits3.dp_read.target_cache = target_cache; /*14:15*/ + insn->bits3.dp_read.response_length = response_length; /*16:19*/ + insn->bits3.dp_read.msg_length = msg_length; /*20:23*/ + insn->bits3.dp_read.msg_target = BRW_MESSAGE_TARGET_DATAPORT_READ; /*24:27*/ + insn->bits3.dp_read.pad1 = 0; /*28:30*/ + insn->bits3.dp_read.end_of_thread = end_of_thread; /*31*/ + } } static void brw_set_sampler_message(struct brw_context *brw, @@ -338,11 +428,25 @@ static void brw_set_sampler_message(struct brw_context *brw, GLuint msg_type, GLuint response_length, GLuint msg_length, - GLboolean eot) + GLboolean eot, + GLuint header_present, + GLuint simd_mode) { + assert(eot == 0); brw_set_src1(insn, brw_imm_d(0)); - if (BRW_IS_G4X(brw)) { + if (BRW_IS_IGDNG(brw)) { + insn->bits3.sampler_igdng.binding_table_index = binding_table_index; + insn->bits3.sampler_igdng.sampler = sampler; + insn->bits3.sampler_igdng.msg_type = msg_type; + insn->bits3.sampler_igdng.simd_mode = simd_mode; + insn->bits3.sampler_igdng.header_present = header_present; + insn->bits3.sampler_igdng.response_length = response_length; + insn->bits3.sampler_igdng.msg_length = msg_length; + insn->bits3.sampler_igdng.end_of_thread = eot; + insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_SAMPLER; + insn->bits2.send_igdng.end_of_thread = eot; + } else if (BRW_IS_G4X(brw)) { insn->bits3.sampler_g4x.binding_table_index = binding_table_index; insn->bits3.sampler_g4x.sampler = sampler; insn->bits3.sampler_g4x.msg_type = msg_type; @@ -484,6 +588,10 @@ struct brw_instruction *brw_JMPI(struct brw_compile *p, { struct brw_instruction *insn = brw_alu2(p, BRW_OPCODE_JMPI, dest, src0, src1); + insn->header.execution_size = 1; + insn->header.compression_control = BRW_COMPRESSION_NONE; + insn->header.mask_control = BRW_MASK_DISABLE; + p->current->header.predicate_control = BRW_PREDICATE_NONE; return insn; @@ -540,6 +648,10 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, struct brw_instruction *if_insn) { struct brw_instruction *insn; + GLuint br = 1; + + if (BRW_IS_IGDNG(p->brw)) + br = 2; if (p->single_program_flow) { insn = next_insn(p, BRW_OPCODE_ADD); @@ -566,7 +678,7 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, } else { assert(if_insn->header.opcode == BRW_OPCODE_IF); - if_insn->bits3.if_else.jump_count = insn - if_insn; + if_insn->bits3.if_else.jump_count = br * (insn - if_insn); if_insn->bits3.if_else.pop_count = 1; if_insn->bits3.if_else.pad0 = 0; } @@ -577,6 +689,11 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, void brw_ENDIF(struct brw_compile *p, struct brw_instruction *patch_insn) { + GLuint br = 1; + + if (BRW_IS_IGDNG(p->brw)) + br = 2; + if (p->single_program_flow) { /* In single program flow mode, there's no need to execute an ENDIF, * since we don't need to do any stack operations, and if we're executing @@ -608,11 +725,11 @@ void brw_ENDIF(struct brw_compile *p, /* Automagically turn it into an IFF: */ patch_insn->header.opcode = BRW_OPCODE_IFF; - patch_insn->bits3.if_else.jump_count = insn - patch_insn + 1; + patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); patch_insn->bits3.if_else.pop_count = 0; patch_insn->bits3.if_else.pad0 = 0; } else if (patch_insn->header.opcode == BRW_OPCODE_ELSE) { - patch_insn->bits3.if_else.jump_count = insn - patch_insn + 1; + patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); patch_insn->bits3.if_else.pop_count = 1; patch_insn->bits3.if_else.pad0 = 0; } else { @@ -686,6 +803,10 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p, struct brw_instruction *do_insn) { struct brw_instruction *insn; + GLuint br = 1; + + if (BRW_IS_IGDNG(p->brw)) + br = 2; if (p->single_program_flow) insn = next_insn(p, BRW_OPCODE_ADD); @@ -706,7 +827,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p, insn->header.execution_size = do_insn->header.execution_size; assert(do_insn->header.opcode == BRW_OPCODE_DO); - insn->bits3.if_else.jump_count = do_insn - insn + 1; + insn->bits3.if_else.jump_count = br * (do_insn - insn + 1); insn->bits3.if_else.pop_count = 0; insn->bits3.if_else.pad0 = 0; } @@ -725,11 +846,15 @@ void brw_land_fwd_jump(struct brw_compile *p, struct brw_instruction *jmp_insn) { struct brw_instruction *landing = &p->store[p->nr_insn]; + GLuint jmpi = 1; + + if (BRW_IS_IGDNG(p->brw)) + jmpi = 2; assert(jmp_insn->header.opcode == BRW_OPCODE_JMPI); assert(jmp_insn->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE); - jmp_insn->bits3.ud = (landing - jmp_insn) - 1; + jmp_insn->bits3.ud = jmpi * ((landing - jmp_insn) - 1); } @@ -794,7 +919,8 @@ void brw_math( struct brw_compile *p, brw_set_dest(insn, dest); brw_set_src0(insn, src); - brw_set_math_message(insn, + brw_set_math_message(p->brw, + insn, msg_length, response_length, function, BRW_MATH_INTEGER_UNSIGNED, @@ -830,7 +956,8 @@ void brw_math_16( struct brw_compile *p, brw_set_dest(insn, dest); brw_set_src0(insn, src); - brw_set_math_message(insn, + brw_set_math_message(p->brw, + insn, msg_length, response_length, function, BRW_MATH_INTEGER_UNSIGNED, @@ -846,7 +973,8 @@ void brw_math_16( struct brw_compile *p, brw_set_dest(insn, offset(dest,1)); brw_set_src0(insn, src); - brw_set_math_message(insn, + brw_set_math_message(p->brw, + insn, msg_length, response_length, function, BRW_MATH_INTEGER_UNSIGNED, @@ -865,9 +993,9 @@ void brw_math_16( struct brw_compile *p, */ void brw_dp_WRITE_16( struct brw_compile *p, struct brw_reg src, - GLuint msg_reg_nr, GLuint scratch_offset ) { + GLuint msg_reg_nr = 1; { brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); @@ -877,7 +1005,7 @@ void brw_dp_WRITE_16( struct brw_compile *p, brw_MOV(p, retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D), brw_imm_d(scratch_offset)); - + brw_pop_insn_state(p); } @@ -893,7 +1021,8 @@ void brw_dp_WRITE_16( struct brw_compile *p, brw_set_dest(insn, dest); brw_set_src0(insn, src); - brw_set_dp_write_message(insn, + brw_set_dp_write_message(p->brw, + insn, 255, /* binding table index (255=stateless) */ BRW_DATAPORT_OWORD_BLOCK_4_OWORDS, /* msg_control */ BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE, /* msg_type */ @@ -912,9 +1041,9 @@ void brw_dp_WRITE_16( struct brw_compile *p, */ void brw_dp_READ_16( struct brw_compile *p, struct brw_reg dest, - GLuint msg_reg_nr, GLuint scratch_offset ) { + GLuint msg_reg_nr = 1; { brw_push_insn_state(p); brw_set_compression_control(p, BRW_COMPRESSION_NONE); @@ -924,7 +1053,7 @@ void brw_dp_READ_16( struct brw_compile *p, brw_MOV(p, retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D), brw_imm_d(scratch_offset)); - + brw_pop_insn_state(p); } @@ -938,7 +1067,8 @@ void brw_dp_READ_16( struct brw_compile *p, brw_set_dest(insn, dest); /* UW? */ brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW)); - brw_set_dp_read_message(insn, + brw_set_dp_read_message(p->brw, + insn, 255, /* binding table index (255=stateless) */ 3, /* msg_control (3 means 4 Owords) */ BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ @@ -958,21 +1088,26 @@ void brw_dp_READ_16( struct brw_compile *p, */ void brw_dp_READ_4( struct brw_compile *p, struct brw_reg dest, - GLuint msg_reg_nr, GLboolean relAddr, GLuint location, GLuint bind_table_index ) { + /* XXX: relAddr not implemented */ + GLuint msg_reg_nr = 1; { + struct brw_reg b; brw_push_insn_state(p); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_set_mask_control(p, BRW_MASK_DISABLE); - /* set message header global offset field (reg 0, element 2) */ - /* Note that grf[0] will be copied to mrf[1] implicitly by the SEND instr */ - brw_MOV(p, - retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_UD), - brw_imm_d(location)); + /* Setup MRF[1] with location/offset into const buffer */ + b = brw_message_reg(msg_reg_nr); + b = retype(b, BRW_REGISTER_TYPE_UD); + /* XXX I think we're setting all the dwords of MRF[1] to 'location'. + * when the docs say only dword[2] should be set. Hmmm. But it works. + */ + brw_MOV(p, b, brw_imm_ud(location)); brw_pop_insn_state(p); } @@ -988,9 +1123,10 @@ void brw_dp_READ_4( struct brw_compile *p, dest = retype(vec8(dest), BRW_REGISTER_TYPE_UW); brw_set_dest(insn, dest); - brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW)); + brw_set_src0(insn, brw_null_reg()); - brw_set_dp_read_message(insn, + brw_set_dp_read_message(p->brw, + insn, bind_table_index, 0, /* msg_control (0 means 1 Oword) */ BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ @@ -1061,7 +1197,8 @@ void brw_dp_READ_4_vs(struct brw_compile *p, brw_set_dest(insn, dest); brw_set_src0(insn, brw_null_reg()); - brw_set_dp_read_message(insn, + brw_set_dp_read_message(p->brw, + insn, bind_table_index, oword, /* 0 = lower Oword, 1 = upper Oword */ BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ @@ -1091,7 +1228,8 @@ void brw_fb_WRITE(struct brw_compile *p, brw_set_dest(insn, dest); brw_set_src0(insn, src0); - brw_set_dp_write_message(insn, + brw_set_dp_write_message(p->brw, + insn, binding_table_index, BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE, /* msg_control */ BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE, /* msg_type */ @@ -1117,7 +1255,9 @@ void brw_SAMPLE(struct brw_compile *p, GLuint msg_type, GLuint response_length, GLuint msg_length, - GLboolean eot) + GLboolean eot, + GLuint header_present, + GLuint simd_mode) { GLboolean need_stall = 0; @@ -1192,7 +1332,9 @@ void brw_SAMPLE(struct brw_compile *p, msg_type, response_length, msg_length, - eot); + eot, + header_present, + simd_mode); } if (need_stall) { @@ -1227,7 +1369,7 @@ void brw_urb_WRITE(struct brw_compile *p, { struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); - assert(msg_length < 16); + assert(msg_length < BRW_MAX_MRF); brw_set_dest(insn, dest); brw_set_src0(insn, src0); @@ -1235,7 +1377,8 @@ void brw_urb_WRITE(struct brw_compile *p, insn->header.destreg__conditonalmod = msg_reg_nr; - brw_set_urb_message(insn, + brw_set_urb_message(p->brw, + insn, allocate, used, msg_length, @@ -1246,3 +1389,37 @@ void brw_urb_WRITE(struct brw_compile *p, swizzle); } +void brw_ff_sync(struct brw_compile *p, + struct brw_reg dest, + GLuint msg_reg_nr, + struct brw_reg src0, + GLboolean allocate, + GLboolean used, + GLuint msg_length, + GLuint response_length, + GLboolean eot, + GLboolean writes_complete, + GLuint offset, + GLuint swizzle) +{ + struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); + + assert(msg_length < 16); + + brw_set_dest(insn, dest); + brw_set_src0(insn, src0); + brw_set_src1(insn, brw_imm_d(0)); + + insn->header.destreg__conditonalmod = msg_reg_nr; + + brw_set_ff_sync_message(p->brw, + insn, + allocate, + used, + msg_length, + response_length, + eot, + writes_complete, + offset, + swizzle); +} diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index 299357409ce..d27c6c24ca5 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -37,6 +37,9 @@ #include "tnl/tnl.h" #include "brw_context.h" #include "brw_fallback.h" +#include "intel_chipset.h" +#include "intel_fbo.h" +#include "intel_regions.h" #include "glapi/glapi.h" @@ -44,6 +47,7 @@ static GLboolean do_check_fallback(struct brw_context *brw) { + struct intel_context *intel = &brw->intel; GLcontext *ctx = &brw->intel.ctx; GLuint i; @@ -81,6 +85,33 @@ static GLboolean do_check_fallback(struct brw_context *brw) return GL_TRUE; } + /* _NEW_BUFFERS */ + if (IS_965(intel->intelScreen->deviceID) && + !IS_G4X(intel->intelScreen->deviceID)) { + for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i]; + struct intel_renderbuffer *irb = intel_renderbuffer(rb); + + /* The original gen4 hardware couldn't set up WM surfaces pointing + * at an offset within a tile, which can happen when rendering to + * anything but the base level of a texture or the +X face/0 depth. + * This was fixed with the 4 Series hardware. + * + * For these original chips, you would have to make the depth and + * color destination surfaces include information on the texture + * type, LOD, face, and various limits to use them as a destination. + * I would have done this, but there's also a nasty requirement that + * the depth and the color surfaces all be of the same LOD, which + * may be a worse requirement than this alignment. (Also, we may + * want to just demote the texture to untiled, instead). + */ + if (irb->region && irb->region->tiling != I915_TILING_NONE && + (irb->region->draw_offset & 4095)) { + DBG("FALLBACK: non-tile-aligned destination for tiled FBO\n"); + return GL_TRUE; + } + } + } return GL_FALSE; } diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index a8b74a0afe6..48c2b9a41ce 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -54,12 +54,17 @@ static void compile_gs_prog( struct brw_context *brw, memset(&c, 0, sizeof(c)); c.key = *key; - + c.need_ff_sync = BRW_IS_IGDNG(brw); /* Need to locate the two positions present in vertex + header. * These are currently hardcoded: */ c.nr_attrs = brw_count_bits(c.key.attrs); - c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */ + + if (BRW_IS_IGDNG(brw)) + c.nr_regs = (c.nr_attrs + 1) / 2 + 3; /* are vertices packed, or reg-aligned? */ + else + c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */ + c.nr_bytes = c.nr_regs * REG_SIZE; diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h index 18a4537c323..bbb991ea2e5 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.h +++ b/src/mesa/drivers/dri/i965/brw_gs.h @@ -62,6 +62,7 @@ struct brw_gs_compile { GLuint nr_attrs; GLuint nr_regs; GLuint nr_bytes; + GLboolean need_ff_sync; }; #define ATTR_SIZE (4*4) diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c index 22e0d25c2e7..980eac7646d 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c @@ -101,6 +101,23 @@ static void brw_gs_emit_vue(struct brw_gs_compile *c, BRW_URB_SWIZZLE_NONE); } +void brw_gs_ff_sync(struct brw_gs_compile *c, int num_prim) +{ + struct brw_compile *p = &c->func; + brw_MOV(p, get_element_ud(c->reg.R0, 1), brw_imm_ud(num_prim)); + brw_ff_sync(p, + c->reg.R0, + 0, + c->reg.R0, + 1, + 1, /* used */ + 1, /* msg length */ + 1, /* response length */ + 0, /* eot */ + 1, /* write compelete */ + 0, /* urb offset */ + BRW_URB_SWIZZLE_NONE); +} void brw_gs_quads( struct brw_gs_compile *c ) @@ -110,6 +127,8 @@ void brw_gs_quads( struct brw_gs_compile *c ) /* Use polygons for correct edgeflag behaviour. Note that vertex 3 * is the PV for quads, but vertex 0 for polygons: */ + if (c->need_ff_sync) + brw_gs_ff_sync(c, 1); brw_gs_emit_vue(c, c->reg.vertex[3], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2)); brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_POLYGON << 2)); @@ -120,6 +139,8 @@ void brw_gs_quad_strip( struct brw_gs_compile *c ) { brw_gs_alloc_regs(c, 4); + if (c->need_ff_sync) + brw_gs_ff_sync(c, 1); brw_gs_emit_vue(c, c->reg.vertex[2], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); brw_gs_emit_vue(c, c->reg.vertex[3], 0, (_3DPRIM_POLYGON << 2)); brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2)); @@ -129,6 +150,9 @@ void brw_gs_quad_strip( struct brw_gs_compile *c ) void brw_gs_tris( struct brw_gs_compile *c ) { brw_gs_alloc_regs(c, 3); + + if (c->need_ff_sync) + brw_gs_ff_sync(c, 1); brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_TRILIST << 2) | R02_PRIM_START)); brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_TRILIST << 2)); brw_gs_emit_vue(c, c->reg.vertex[2], 1, ((_3DPRIM_TRILIST << 2) | R02_PRIM_END)); @@ -137,6 +161,9 @@ void brw_gs_tris( struct brw_gs_compile *c ) void brw_gs_lines( struct brw_gs_compile *c ) { brw_gs_alloc_regs(c, 2); + + if (c->need_ff_sync) + brw_gs_ff_sync(c, 1); brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_START)); brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_END)); } @@ -144,6 +171,9 @@ void brw_gs_lines( struct brw_gs_compile *c ) void brw_gs_points( struct brw_gs_compile *c ) { brw_gs_alloc_regs(c, 1); + + if (c->need_ff_sync) + brw_gs_ff_sync(c, 1); brw_gs_emit_vue(c, c->reg.vertex[0], 1, ((_3DPRIM_POINTLIST << 2) | R02_PRIM_START | R02_PRIM_END)); } diff --git a/src/mesa/drivers/dri/i965/brw_gs_state.c b/src/mesa/drivers/dri/i965/brw_gs_state.c index 27023cf0344..a761c03153c 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_state.c +++ b/src/mesa/drivers/dri/i965/brw_gs_state.c @@ -95,6 +95,9 @@ gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key) gs.thread4.max_threads = 0; /* Hardware requirement */ + if (BRW_IS_IGDNG(brw)) + gs.thread4.rendering_enable = 1; + if (INTEL_DEBUG & DEBUG_STATS) gs.thread4.stats_enable = 1; diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 4784254bc7d..85a7706404f 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -211,7 +211,7 @@ static void emit_depthbuffer(struct brw_context *brw) { struct intel_context *intel = &brw->intel; struct intel_region *region = brw->state.depth_region; - unsigned int len = BRW_IS_G4X(brw) ? 6 : 5; + unsigned int len = (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw)) ? 6 : 5; if (region == NULL) { BEGIN_BATCH(len, IGNORE_CLIPRECTS); @@ -222,7 +222,7 @@ static void emit_depthbuffer(struct brw_context *brw) OUT_BATCH(0); OUT_BATCH(0); - if (BRW_IS_G4X(brw)) + if (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw)) OUT_BATCH(0); ADVANCE_BATCH(); @@ -244,6 +244,8 @@ static void emit_depthbuffer(struct brw_context *brw) return; } + assert(region->tiling != I915_TILING_X); + BEGIN_BATCH(len, IGNORE_CLIPRECTS); OUT_BATCH(CMD_DEPTH_BUFFER << 16 | (len - 2)); OUT_BATCH(((region->pitch * region->cpp) - 1) | @@ -259,7 +261,7 @@ static void emit_depthbuffer(struct brw_context *brw) ((region->height - 1) << 19)); OUT_BATCH(0); - if (BRW_IS_G4X(brw)) + if (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw)) OUT_BATCH(0); ADVANCE_BATCH(); @@ -372,7 +374,7 @@ static void upload_aa_line_parameters(struct brw_context *brw) { struct brw_aa_line_parameters balp; - if (!BRW_IS_G4X(brw)) + if (BRW_IS_965(brw)) return; /* use legacy aa line coverage computation */ @@ -509,14 +511,27 @@ static void upload_state_base_address( struct brw_context *brw ) /* Output the structure (brw_state_base_address) directly to the * batchbuffer, so we can emit relocations inline. */ - BEGIN_BATCH(6, IGNORE_CLIPRECTS); - OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (6 - 2)); - OUT_BATCH(1); /* General state base address */ - OUT_BATCH(1); /* Surface state base address */ - OUT_BATCH(1); /* Indirect object base address */ - OUT_BATCH(1); /* General state upper bound */ - OUT_BATCH(1); /* Indirect object upper bound */ - ADVANCE_BATCH(); + if (BRW_IS_IGDNG(brw)) { + BEGIN_BATCH(8, IGNORE_CLIPRECTS); + OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (8 - 2)); + OUT_BATCH(1); /* General state base address */ + OUT_BATCH(1); /* Surface state base address */ + OUT_BATCH(1); /* Indirect object base address */ + OUT_BATCH(1); /* Instruction base address */ + OUT_BATCH(1); /* General state upper bound */ + OUT_BATCH(1); /* Indirect object upper bound */ + OUT_BATCH(1); /* Instruction access upper bound */ + ADVANCE_BATCH(); + } else { + BEGIN_BATCH(6, IGNORE_CLIPRECTS); + OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (6 - 2)); + OUT_BATCH(1); /* General state base address */ + OUT_BATCH(1); /* Surface state base address */ + OUT_BATCH(1); /* Indirect object base address */ + OUT_BATCH(1); /* General state upper bound */ + OUT_BATCH(1); /* Indirect object upper bound */ + ADVANCE_BATCH(); + } } const struct brw_tracked_state brw_state_base_address = { diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index c3c85978f4d..e1c2c7777b5 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -166,6 +166,9 @@ static void upload_sf_prog(struct brw_context *brw) key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT); key.do_twoside_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide); + /* _NEW_HINT */ + key.linear_color = (ctx->Hint.PerspectiveCorrection == GL_FASTEST); + /* _NEW_POLYGON */ if (key.do_twoside_color) { /* If we're rendering to a FBO, we have to invert the polygon @@ -188,7 +191,7 @@ static void upload_sf_prog(struct brw_context *brw) const struct brw_tracked_state brw_sf_prog = { .dirty = { - .mesa = (_NEW_LIGHT|_NEW_POLYGON|_NEW_POINT), + .mesa = (_NEW_HINT | _NEW_LIGHT | _NEW_POLYGON | _NEW_POINT), .brw = (BRW_NEW_REDUCED_PRIMITIVE), .cache = CACHE_NEW_VS_PROG }, diff --git a/src/mesa/drivers/dri/i965/brw_sf.h b/src/mesa/drivers/dri/i965/brw_sf.h index 1c0fb70fe06..6426b6df9ff 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.h +++ b/src/mesa/drivers/dri/i965/brw_sf.h @@ -51,7 +51,8 @@ struct brw_sf_prog_key { GLuint do_flat_shading:1; GLuint frontface_ccw:1; GLuint do_point_sprite:1; - GLuint pad:10; + GLuint linear_color:1; /**< linear interp vs. perspective interp */ + GLuint pad:25; GLenum SpriteOrigin; }; diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c index 862835f157a..ca8f97f9f9e 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_emit.c +++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c @@ -151,6 +151,8 @@ static void do_flatshade_triangle( struct brw_sf_compile *c ) struct brw_compile *p = &c->func; struct brw_reg ip = brw_ip_reg(); GLuint nr = brw_count_bits(c->key.attrs & VERT_RESULT_COLOR_BITS); + GLuint jmpi = 1; + if (!nr) return; @@ -159,18 +161,21 @@ static void do_flatshade_triangle( struct brw_sf_compile *c ) if (c->key.primitive == SF_UNFILLED_TRIS) return; + if (BRW_IS_IGDNG(p->brw)) + jmpi = 2; + brw_push_insn_state(p); - brw_MUL(p, c->pv, c->pv, brw_imm_ud(nr*2+1)); + brw_MUL(p, c->pv, c->pv, brw_imm_d(jmpi*(nr*2+1))); brw_JMPI(p, ip, ip, c->pv); copy_colors(c, c->vert[1], c->vert[0]); copy_colors(c, c->vert[2], c->vert[0]); - brw_JMPI(p, ip, ip, brw_imm_ud(nr*4+1)); + brw_JMPI(p, ip, ip, brw_imm_d(jmpi*(nr*4+1))); copy_colors(c, c->vert[0], c->vert[1]); copy_colors(c, c->vert[2], c->vert[1]); - brw_JMPI(p, ip, ip, brw_imm_ud(nr*2)); + brw_JMPI(p, ip, ip, brw_imm_d(jmpi*nr*2)); copy_colors(c, c->vert[0], c->vert[2]); copy_colors(c, c->vert[1], c->vert[2]); @@ -184,7 +189,8 @@ static void do_flatshade_line( struct brw_sf_compile *c ) struct brw_compile *p = &c->func; struct brw_reg ip = brw_ip_reg(); GLuint nr = brw_count_bits(c->key.attrs & VERT_RESULT_COLOR_BITS); - + GLuint jmpi = 1; + if (!nr) return; @@ -193,13 +199,16 @@ static void do_flatshade_line( struct brw_sf_compile *c ) if (c->key.primitive == SF_UNFILLED_TRIS) return; + if (BRW_IS_IGDNG(p->brw)) + jmpi = 2; + brw_push_insn_state(p); - brw_MUL(p, c->pv, c->pv, brw_imm_ud(nr+1)); + brw_MUL(p, c->pv, c->pv, brw_imm_d(jmpi*(nr+1))); brw_JMPI(p, ip, ip, c->pv); copy_colors(c, c->vert[1], c->vert[0]); - brw_JMPI(p, ip, ip, brw_imm_ud(nr)); + brw_JMPI(p, ip, ip, brw_imm_ud(jmpi*nr)); copy_colors(c, c->vert[0], c->vert[1]); brw_pop_insn_state(p); @@ -218,7 +227,7 @@ static void alloc_regs( struct brw_sf_compile *c ) /* Values computed by fixed function unit: */ - c->pv = retype(brw_vec1_grf(1, 1), BRW_REGISTER_TYPE_UD); + c->pv = retype(brw_vec1_grf(1, 1), BRW_REGISTER_TYPE_D); c->det = brw_vec1_grf(1, 2); c->dx0 = brw_vec1_grf(1, 3); c->dx2 = brw_vec1_grf(1, 4); @@ -295,9 +304,6 @@ static void invert_det( struct brw_sf_compile *c) } -#define NON_PERPECTIVE_ATTRS (FRAG_BIT_WPOS | \ - FRAG_BIT_COL0 | \ - FRAG_BIT_COL1) static GLboolean calculate_masks( struct brw_sf_compile *c, GLuint reg, @@ -306,9 +312,16 @@ static GLboolean calculate_masks( struct brw_sf_compile *c, GLushort *pc_linear) { GLboolean is_last_attr = (reg == c->nr_setup_regs - 1); - GLuint persp_mask = c->key.attrs & ~NON_PERPECTIVE_ATTRS; + GLuint persp_mask; GLuint linear_mask; + if (c->key.do_flat_shading || c->key.linear_color) + persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS | + FRAG_BIT_COL0 | + FRAG_BIT_COL1); + else + persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS); + if (c->key.do_flat_shading) linear_mask = c->key.attrs & ~(FRAG_BIT_COL0|FRAG_BIT_COL1); else @@ -674,7 +687,7 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) (1<<_3DPRIM_POLYGON) | (1<<_3DPRIM_RECTLIST) | (1<<_3DPRIM_TRIFAN_NOSTIPPLE))); - jmp = brw_JMPI(p, ip, ip, brw_imm_w(0)); + jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)); { saveflag = p->flag_value; brw_push_insn_state(p); @@ -695,7 +708,7 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) (1<<_3DPRIM_LINESTRIP_CONT) | (1<<_3DPRIM_LINESTRIP_BF) | (1<<_3DPRIM_LINESTRIP_CONT_BF))); - jmp = brw_JMPI(p, ip, ip, brw_imm_w(0)); + jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)); { saveflag = p->flag_value; brw_push_insn_state(p); @@ -708,7 +721,7 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) brw_set_conditionalmod(p, BRW_CONDITIONAL_Z); brw_AND(p, v1_null_ud, payload_attr, brw_imm_ud(1<<BRW_SPRITE_POINT_ENABLE)); - jmp = brw_JMPI(p, ip, ip, brw_imm_w(0)); + jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)); { saveflag = p->flag_value; brw_push_insn_state(p); diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index c99918724b3..e73e57a1c83 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -162,7 +162,7 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key, { struct brw_sf_unit_state sf; dri_bo *bo; - + int chipset_max_threads; memset(&sf, 0, sizeof(sf)); sf.thread0.grf_reg_count = ALIGN(key->total_grf, 16) / 16 - 1; @@ -171,13 +171,26 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key, sf.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754; sf.thread3.dispatch_grf_start_reg = 3; - sf.thread3.urb_entry_read_offset = 1; + + if (BRW_IS_IGDNG(brw)) + sf.thread3.urb_entry_read_offset = 3; + else + sf.thread3.urb_entry_read_offset = 1; + sf.thread3.urb_entry_read_length = key->urb_entry_read_length; sf.thread4.nr_urb_entries = key->nr_urb_entries; sf.thread4.urb_entry_allocation_size = key->sfsize - 1; - /* Each SF thread produces 1 PUE, and there can be up to 24 threads */ - sf.thread4.max_threads = MIN2(24, key->nr_urb_entries) - 1; + + /* Each SF thread produces 1 PUE, and there can be up to 24(Pre-IGDNG) or + * 48(IGDNG) threads + */ + if (BRW_IS_IGDNG(brw)) + chipset_max_threads = 48; + else + chipset_max_threads = 24; + + sf.thread4.max_threads = MIN2(chipset_max_threads, key->nr_urb_entries) - 1; if (INTEL_DEBUG & DEBUG_SINGLE_THREAD) sf.thread4.max_threads = 0; diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index a7132622696..e94fa7d2b4c 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -126,6 +126,8 @@ static void dump_wm_surface_state(struct brw_context *brw) surf->ss3.pitch + 1, surf->ss3.tiled_surface ? "" : "not "); state_out(name, surf, surfoff, 4, "mip base %d\n", surf->ss4.min_lod); + state_out(name, surf, surfoff, 5, "x,y offset: %d,%d\n", + surf->ss5.x_offset, surf->ss5.y_offset); dri_bo_unmap(surf_bo); } diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index c6dfea4743c..38d9dd8991e 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -205,7 +205,6 @@ static struct dirty_bit_map brw_bits[] = { DEFINE_BIT(BRW_NEW_PRIMITIVE), DEFINE_BIT(BRW_NEW_CONTEXT), DEFINE_BIT(BRW_NEW_WM_INPUT_DIMENSIONS), - DEFINE_BIT(BRW_NEW_INPUT_VARYING), DEFINE_BIT(BRW_NEW_PSP), DEFINE_BIT(BRW_NEW_FENCE), DEFINE_BIT(BRW_NEW_INDICES), diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index 89e29812034..8ba7eb27b36 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -33,6 +33,14 @@ #ifndef BRW_STRUCTS_H #define BRW_STRUCTS_H + +/** Number of general purpose registers (VS, WM, etc) */ +#define BRW_MAX_GRF 128 + +/** Number of message register file registers */ +#define BRW_MAX_MRF 16 + + /* Command packets: */ struct header @@ -815,7 +823,9 @@ struct brw_gs_unit_state struct { - GLuint pad0:10; + GLuint pad0:8; + GLuint rendering_enable:1; /* for IGDNG */ + GLuint pad4:1; GLuint stats_enable:1; GLuint nr_urb_entries:7; GLuint pad1:1; @@ -923,6 +933,28 @@ struct brw_wm_unit_state GLfloat global_depth_offset_constant; GLfloat global_depth_offset_scale; + + /* for IGDNG only */ + struct { + GLuint pad0:1; + GLuint grf_reg_count_1:3; + GLuint pad1:2; + GLuint kernel_start_pointer_1:26; + } wm8; + + struct { + GLuint pad0:1; + GLuint grf_reg_count_2:3; + GLuint pad1:2; + GLuint kernel_start_pointer_2:26; + } wm9; + + struct { + GLuint pad0:1; + GLuint grf_reg_count_3:3; + GLuint pad1:2; + GLuint kernel_start_pointer_3:26; + } wm10; }; struct brw_sampler_default_color { @@ -1075,7 +1107,7 @@ struct brw_surface_state GLuint y_offset:4; GLuint pad0:1; GLuint x_offset:7; - } ss5; /* NEW in Integrated Graphics Device */ + } ss5; /* New in G4X */ }; @@ -1298,6 +1330,14 @@ struct brw_instruction GLuint pad1:6; } ia16; + struct + { + GLuint pad:26; + GLuint end_of_thread:1; + GLuint pad1:1; + GLuint sfid:4; + } send_igdng; /* for IGDNG only */ + } bits2; union @@ -1385,6 +1425,21 @@ struct brw_instruction } math; struct { + GLuint function:4; + GLuint int_type:1; + GLuint precision:1; + GLuint saturate:1; + GLuint data_type:1; + GLuint snapshot:1; + GLuint pad0:10; + GLuint header_present:1; + GLuint response_length:5; + GLuint msg_length:4; + GLuint pad1:2; + GLuint end_of_thread:1; + } math_igdng; + + struct { GLuint binding_table_index:8; GLuint sampler:4; GLuint return_format:2; @@ -1407,9 +1462,38 @@ struct brw_instruction GLuint end_of_thread:1; } sampler_g4x; + struct { + GLuint binding_table_index:8; + GLuint sampler:4; + GLuint msg_type:4; + GLuint simd_mode:2; + GLuint pad0:1; + GLuint header_present:1; + GLuint response_length:5; + GLuint msg_length:4; + GLuint pad1:2; + GLuint end_of_thread:1; + } sampler_igdng; + struct brw_urb_immediate urb; struct { + GLuint opcode:4; + GLuint offset:6; + GLuint swizzle_control:2; + GLuint pad:1; + GLuint allocate:1; + GLuint used:1; + GLuint complete:1; + GLuint pad0:3; + GLuint header_present:1; + GLuint response_length:5; + GLuint msg_length:4; + GLuint pad1:2; + GLuint end_of_thread:1; + } urb_igdng; + + struct { GLuint binding_table_index:8; GLuint msg_control:4; GLuint msg_type:2; @@ -1423,6 +1507,19 @@ struct brw_instruction struct { GLuint binding_table_index:8; + GLuint msg_control:3; + GLuint msg_type:3; + GLuint target_cache:2; + GLuint pad0:3; + GLuint header_present:1; + GLuint response_length:5; + GLuint msg_length:4; + GLuint pad1:2; + GLuint end_of_thread:1; + } dp_read_igdng; + + struct { + GLuint binding_table_index:8; GLuint msg_control:3; GLuint pixel_scoreboard_clear:1; GLuint msg_type:3; @@ -1435,6 +1532,20 @@ struct brw_instruction } dp_write; struct { + GLuint binding_table_index:8; + GLuint msg_control:3; + GLuint pixel_scoreboard_clear:1; + GLuint msg_type:3; + GLuint send_commit_msg:1; + GLuint pad0:3; + GLuint header_present:1; + GLuint response_length:5; + GLuint msg_length:4; + GLuint pad1:2; + GLuint end_of_thread:1; + } dp_write_igdng; + + struct { GLuint pad:16; GLuint response_length:4; GLuint msg_length:4; @@ -1443,6 +1554,15 @@ struct brw_instruction GLuint end_of_thread:1; } generic; + struct { + GLuint pad:19; + GLuint header_present:1; + GLuint response_length:5; + GLuint msg_length:4; + GLuint pad1:2; + GLuint end_of_thread:1; + } generic_igdng; + GLint d; GLuint ud; } bits3; diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index 5c5455813a4..7f9b2535340 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -36,6 +36,7 @@ #include "intel_tex_layout.h" #include "intel_context.h" #include "main/macros.h" +#include "intel_chipset.h" #define FILE_DEBUG_FLAG DEBUG_MIPTREE @@ -48,6 +49,77 @@ GLboolean brw_miptree_layout(struct intel_context *intel, switch (mt->target) { case GL_TEXTURE_CUBE_MAP: + if (IS_IGDNG(intel->intelScreen->deviceID)) { + GLuint align_h = 2, align_w = 4; + GLuint level; + GLuint x = 0; + GLuint y = 0; + GLuint width = mt->width0; + GLuint height = mt->height0; + GLuint qpitch = 0; + GLuint y_pitch = 0; + + mt->pitch = mt->width0; + intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h); + y_pitch = ALIGN(height, align_h); + + if (mt->compressed) { + mt->pitch = ALIGN(mt->width0, align_w); + qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4 * mt->pitch * mt->cpp; + mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4 * 6; + } else { + qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) * mt->pitch * mt->cpp; + mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) * 6; + } + + if (mt->first_level != mt->last_level) { + GLuint mip1_width; + + if (mt->compressed) { + mip1_width = ALIGN(minify(mt->width0), align_w) + + ALIGN(minify(minify(mt->width0)), align_w); + } else { + mip1_width = ALIGN(minify(mt->width0), align_w) + + minify(minify(mt->width0)); + } + + if (mip1_width > mt->pitch) { + mt->pitch = mip1_width; + } + } + + mt->pitch = intel_miptree_pitch_align(intel, mt, tiling, mt->pitch); + + for (level = mt->first_level; level <= mt->last_level; level++) { + GLuint img_height; + GLuint nr_images = 6; + GLuint q = 0; + + intel_miptree_set_level_info(mt, level, nr_images, x, y, width, + height, 1); + + for (q = 0; q < nr_images; q++) + intel_miptree_set_image_offset_ex(mt, level, q, x, y, q * qpitch); + + if (mt->compressed) + img_height = MAX2(1, height/4); + else + img_height = ALIGN(height, align_h); + + if (level == mt->first_level + 1) { + x += ALIGN(width, align_w); + } + else { + y += img_height; + } + + width = minify(width); + height = minify(height); + } + + break; + } + case GL_TEXTURE_3D: { GLuint width = mt->width0; GLuint height = mt->height0; @@ -59,9 +131,9 @@ GLboolean brw_miptree_layout(struct intel_context *intel, GLuint align_w = 4; mt->total_height = 0; + intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h); if (mt->compressed) { - align_w = intel_compressed_alignment(mt->internal_format); mt->pitch = ALIGN(width, align_w); pack_y_pitch = (height + 3) / 4; } else { @@ -69,7 +141,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel, pack_y_pitch = ALIGN(mt->height0, align_h); } - pack_x_pitch = mt->pitch; + pack_x_pitch = width; pack_x_nr = 1; for (level = mt->first_level ; level <= mt->last_level ; level++) { diff --git a/src/mesa/drivers/dri/i965/brw_urb.c b/src/mesa/drivers/dri/i965/brw_urb.c index 7673dd36eb9..8c6f4355a6e 100644 --- a/src/mesa/drivers/dri/i965/brw_urb.c +++ b/src/mesa/drivers/dri/i965/brw_urb.c @@ -143,7 +143,29 @@ static void recalculate_urb_fence( struct brw_context *brw ) brw->urb.nr_clip_entries = limits[CLP].preferred_nr_entries; brw->urb.nr_sf_entries = limits[SF].preferred_nr_entries; brw->urb.nr_cs_entries = limits[CS].preferred_nr_entries; - + + brw->urb.constrained = 0; + + if (BRW_IS_IGDNG(brw)) { + brw->urb.nr_vs_entries = 128; + brw->urb.nr_sf_entries = 48; + if (check_urb_layout(brw)) { + goto done; + } else { + brw->urb.constrained = 1; + brw->urb.nr_vs_entries = limits[VS].preferred_nr_entries; + brw->urb.nr_sf_entries = limits[SF].preferred_nr_entries; + } + } else if (BRW_IS_G4X(brw)) { + brw->urb.nr_vs_entries = 64; + if (check_urb_layout(brw)) { + goto done; + } else { + brw->urb.constrained = 1; + brw->urb.nr_vs_entries = limits[VS].preferred_nr_entries; + } + } + if (!check_urb_layout(brw)) { brw->urb.nr_vs_entries = limits[VS].min_nr_entries; brw->urb.nr_gs_entries = limits[GS].min_nr_entries; @@ -169,9 +191,8 @@ static void recalculate_urb_fence( struct brw_context *brw ) if (INTEL_DEBUG & (DEBUG_URB|DEBUG_FALLBACKS)) _mesa_printf("URB CONSTRAINED\n"); } - else - brw->urb.constrained = 0; +done: if (INTEL_DEBUG & DEBUG_URB) _mesa_printf("URB fence: %d ..VS.. %d ..GS.. %d ..CLP.. %d ..SF.. %d ..CS.. %d\n", brw->urb.vs_start, diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index 1e4f66091e3..4a591365c98 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -58,6 +58,7 @@ struct brw_vs_compile { GLuint first_output; GLuint nr_outputs; + GLuint first_overflow_output; /**< VERT_ATTRIB_x */ GLuint first_tmp; GLuint last_tmp; diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c index 2637344b482..249a800bf4b 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_constval.c +++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c @@ -39,8 +39,8 @@ */ struct tracker { GLboolean twoside; - GLubyte active[PROGRAM_OUTPUT+1][128]; - GLuint size_masks[4]; + GLubyte active[PROGRAM_OUTPUT+1][MAX_PROGRAM_TEMPS]; + GLbitfield size_masks[4]; /**< one bit per fragment program input attrib */ }; @@ -53,8 +53,10 @@ static void set_active_component( struct tracker *t, case PROGRAM_TEMPORARY: case PROGRAM_INPUT: case PROGRAM_OUTPUT: + assert(file < PROGRAM_OUTPUT + 1); + assert(index < Elements(t->active[0])); t->active[file][index] |= active; - + break; default: break; } @@ -108,10 +110,15 @@ static GLubyte get_active( struct tracker *t, return active; } +/** + * Return the size (1,2,3 or 4) of the output/result for VERT_RESULT_idx. + */ static GLubyte get_output_size( struct tracker *t, GLuint idx ) { - GLubyte active = t->active[PROGRAM_OUTPUT][idx]; + GLubyte active; + assert(idx < VERT_RESULT_MAX); + active = t->active[PROGRAM_OUTPUT][idx]; if (active & (1<<3)) return 4; if (active & (1<<2)) return 3; if (active & (1<<1)) return 2; @@ -123,7 +130,7 @@ static GLubyte get_output_size( struct tracker *t, */ static void calc_sizes( struct tracker *t ) { - GLuint i; + GLint vertRes; if (t->twoside) { t->active[PROGRAM_OUTPUT][VERT_RESULT_COL0] |= @@ -133,12 +140,27 @@ static void calc_sizes( struct tracker *t ) t->active[PROGRAM_OUTPUT][VERT_RESULT_BFC1]; } - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { - switch (get_output_size(t, i)) { - case 4: t->size_masks[4-1] |= 1<<i; - case 3: t->size_masks[3-1] |= 1<<i; - case 2: t->size_masks[2-1] |= 1<<i; - case 1: t->size_masks[1-1] |= 1<<i; + /* Examine vertex program output sizes to set the size_masks[] info + * which describes the fragment program input sizes. + */ + for (vertRes = VERT_RESULT_TEX0; vertRes < VERT_RESULT_MAX; vertRes++) { + GLint fragAttrib; + + /* map vertex program output index to fragment program input index */ + if (vertRes <= VERT_RESULT_TEX7) + fragAttrib = FRAG_ATTRIB_TEX0 + vertRes - VERT_RESULT_TEX0; + else if (vertRes >= VERT_RESULT_VAR0) + fragAttrib = FRAG_ATTRIB_VAR0 + vertRes - VERT_RESULT_VAR0; + else + continue; + assert(fragAttrib >= FRAG_ATTRIB_TEX0); + assert(fragAttrib <= FRAG_ATTRIB_MAX); + + switch (get_output_size(t, vertRes)) { + case 4: t->size_masks[4-1] |= 1 << fragAttrib; + case 3: t->size_masks[3-1] |= 1 << fragAttrib; + case 2: t->size_masks[2-1] |= 1 << fragAttrib; + case 1: t->size_masks[1-1] |= 1 << fragAttrib; break; } } diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index d7f75e3685e..514f15d5e3a 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -129,15 +129,21 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) } } - /* Allocate outputs: TODO: could organize the non-position outputs - * to go straight into message regs. + /* Allocate outputs. The non-position outputs go straight into message regs. */ c->nr_outputs = 0; c->first_output = reg; - mrf = 4; + c->first_overflow_output = 0; + + if (BRW_IS_IGDNG(c->func.brw)) + mrf = 8; + else + mrf = 4; + for (i = 0; i < VERT_RESULT_MAX; i++) { if (c->prog_data.outputs_written & (1 << i)) { c->nr_outputs++; + assert(i < Elements(c->regs[PROGRAM_OUTPUT])); if (i == VERT_RESULT_HPOS) { c->regs[PROGRAM_OUTPUT][i] = brw_vec8_grf(reg, 0); reg++; @@ -148,8 +154,17 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) mrf++; /* just a placeholder? XXX fix later stages & remove this */ } else { - c->regs[PROGRAM_OUTPUT][i] = brw_message_reg(mrf); - mrf++; + if (mrf < 16) { + c->regs[PROGRAM_OUTPUT][i] = brw_message_reg(mrf); + mrf++; + } + else { + /* too many vertex results to fit in MRF, use GRF for overflow */ + if (!c->first_overflow_output) + c->first_overflow_output = i; + c->regs[PROGRAM_OUTPUT][i] = brw_vec8_grf(reg, 0); + reg++; + } } } } @@ -206,7 +221,11 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) */ c->prog_data.urb_read_length = (c->nr_inputs + 1) / 2; - c->prog_data.urb_entry_size = (c->nr_outputs + 2 + 3) / 4; + if (BRW_IS_IGDNG(c->func.brw)) + c->prog_data.urb_entry_size = (c->nr_outputs + 6 + 3) / 4; + else + c->prog_data.urb_entry_size = (c->nr_outputs + 2 + 3) / 4; + c->prog_data.total_grf = reg; if (INTEL_DEBUG & DEBUG_VS) { @@ -1067,6 +1086,8 @@ static void emit_vertex_write( struct brw_vs_compile *c) struct brw_reg m0 = brw_message_reg(0); struct brw_reg pos = c->regs[PROGRAM_OUTPUT][VERT_RESULT_HPOS]; struct brw_reg ndc; + int eot; + GLuint len_vertext_header = 2; if (c->key.copy_edgeflag) { brw_MOV(p, @@ -1076,14 +1097,16 @@ static void emit_vertex_write( struct brw_vs_compile *c) /* Build ndc coords */ ndc = get_tmp(c); + /* ndc = 1.0 / pos.w */ emit_math1(c, BRW_MATH_FUNCTION_INV, ndc, brw_swizzle1(pos, 3), BRW_MATH_PRECISION_FULL); + /* ndc.xyz = pos * ndc */ brw_MUL(p, brw_writemask(ndc, WRITEMASK_XYZ), pos, ndc); /* Update the header for point size, user clipping flags, and -ve rhw * workaround. */ if ((c->prog_data.outputs_written & (1<<VERT_RESULT_PSIZ)) || - c->key.nr_userclip || !BRW_IS_G4X(p->brw)) + c->key.nr_userclip || BRW_IS_965(p->brw)) { struct brw_reg header1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD); GLuint i; @@ -1114,7 +1137,7 @@ static void emit_vertex_write( struct brw_vs_compile *c) * Later, clipping will detect ucp[6] and ensure the primitive is * clipped against all fixed planes. */ - if (!BRW_IS_G4X(p->brw)) { + if (BRW_IS_965(p->brw)) { brw_CMP(p, vec8(brw_null_reg()), BRW_CONDITIONAL_L, @@ -1141,7 +1164,23 @@ static void emit_vertex_write( struct brw_vs_compile *c) */ brw_set_access_mode(p, BRW_ALIGN_1); brw_MOV(p, offset(m0, 2), ndc); - brw_MOV(p, offset(m0, 3), pos); + + if (BRW_IS_IGDNG(p->brw)) { + /* There are 20 DWs (D0-D19) in VUE vertex header on IGDNG */ + brw_MOV(p, offset(m0, 3), pos); /* a portion of vertex header */ + /* m4, m5 contain the distances from vertex to the user clip planeXXX. + * Seems it is useless for us. + * m6 is used for aligning, so that the remainder of vertex element is + * reg-aligned. + */ + brw_MOV(p, offset(m0, 7), pos); /* the remainder of vertex element */ + len_vertext_header = 6; + } else { + brw_MOV(p, offset(m0, 3), pos); + len_vertext_header = 2; + } + + eot = (c->first_overflow_output == 0); brw_urb_WRITE(p, brw_null_reg(), /* dest */ @@ -1149,12 +1188,43 @@ static void emit_vertex_write( struct brw_vs_compile *c) c->r0, /* src */ 0, /* allocate */ 1, /* used */ - c->nr_outputs + 3, /* msg len */ + MIN2(c->nr_outputs + 1 + len_vertext_header, (BRW_MAX_MRF-1)), /* msg len */ 0, /* response len */ - 1, /* eot */ + eot, /* eot */ 1, /* writes complete */ 0, /* urb destination offset */ BRW_URB_SWIZZLE_INTERLEAVE); + + if (c->first_overflow_output > 0) { + /* Not all of the vertex outputs/results fit into the MRF. + * Move the overflowed attributes from the GRF to the MRF and + * issue another brw_urb_WRITE(). + */ + /* XXX I'm not 100% sure about which MRF regs to use here. Starting + * at mrf[4] atm... + */ + GLuint i, mrf = 0; + for (i = c->first_overflow_output; i < VERT_RESULT_MAX; i++) { + if (c->prog_data.outputs_written & (1 << i)) { + /* move from GRF to MRF */ + brw_MOV(p, brw_message_reg(4+mrf), c->regs[PROGRAM_OUTPUT][i]); + mrf++; + } + } + + brw_urb_WRITE(p, + brw_null_reg(), /* dest */ + 4, /* starting mrf reg nr */ + c->r0, /* src */ + 0, /* allocate */ + 1, /* used */ + mrf+1, /* msg len */ + 0, /* response len */ + 1, /* eot */ + 1, /* writes complete */ + BRW_MAX_MRF-1, /* urb destination offset */ + BRW_URB_SWIZZLE_INTERLEAVE); + } } @@ -1183,15 +1253,15 @@ post_vs_emit( struct brw_vs_compile *c, */ void brw_vs_emit(struct brw_vs_compile *c ) { -#define MAX_IFSN 32 +#define MAX_IF_DEPTH 32 +#define MAX_LOOP_DEPTH 32 struct brw_compile *p = &c->func; - GLuint nr_insns = c->vp->program.Base.NumInstructions; - GLuint insn, if_insn = 0; + const GLuint nr_insns = c->vp->program.Base.NumInstructions; + GLuint insn, if_depth = 0, loop_depth = 0; GLuint end_offset = 0; struct brw_instruction *end_inst, *last_inst; - struct brw_instruction *if_inst[MAX_IFSN]; - struct brw_indirect stack_index = brw_indirect(0, 0); - + struct brw_instruction *if_inst[MAX_IF_DEPTH], *loop_inst[MAX_LOOP_DEPTH]; + const struct brw_indirect stack_index = brw_indirect(0, 0); GLuint index; GLuint file; @@ -1382,16 +1452,51 @@ void brw_vs_emit(struct brw_vs_compile *c ) emit_xpd(p, dst, args[0], args[1]); break; case OPCODE_IF: - assert(if_insn < MAX_IFSN); - if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8); + assert(if_depth < MAX_IF_DEPTH); + if_inst[if_depth++] = brw_IF(p, BRW_EXECUTE_8); break; case OPCODE_ELSE: - if_inst[if_insn-1] = brw_ELSE(p, if_inst[if_insn-1]); + if_inst[if_depth-1] = brw_ELSE(p, if_inst[if_depth-1]); break; case OPCODE_ENDIF: - assert(if_insn > 0); - brw_ENDIF(p, if_inst[--if_insn]); + assert(if_depth > 0); + brw_ENDIF(p, if_inst[--if_depth]); break; +#if 0 + case OPCODE_BGNLOOP: + loop_inst[loop_depth++] = brw_DO(p, BRW_EXECUTE_8); + break; + case OPCODE_BRK: + brw_BREAK(p); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + break; + case OPCODE_CONT: + brw_CONT(p); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + break; + case OPCODE_ENDLOOP: + { + struct brw_instruction *inst0, *inst1; + loop_depth--; + inst0 = inst1 = brw_WHILE(p, loop_inst[loop_depth]); + /* patch all the BREAK/CONT instructions from last BEGINLOOP */ + while (inst0 > loop_inst[loop_depth]) { + inst0--; + if (inst0->header.opcode == BRW_OPCODE_BREAK) { + inst0->bits3.if_else.jump_count = inst1 - inst0 + 1; + inst0->bits3.if_else.pop_count = 0; + } + else if (inst0->header.opcode == BRW_OPCODE_CONTINUE) { + inst0->bits3.if_else.jump_count = inst1 - inst0; + inst0->bits3.if_else.pop_count = 0; + } + } + } + break; +#else + (void) loop_inst; + (void) loop_depth; +#endif case OPCODE_BRA: brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index 3d295388437..d790ab65553 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -97,7 +97,11 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key) * brw_urb_WRITE() results. */ vs.thread1.single_program_flow = 0; - vs.thread1.binding_table_entry_count = key->nr_surfaces; + + if (BRW_IS_IGDNG(brw)) + vs.thread1.binding_table_entry_count = 0; /* hardware requirement */ + else + vs.thread1.binding_table_entry_count = key->nr_surfaces; vs.thread3.urb_entry_read_length = key->urb_entry_read_length; vs.thread3.const_urb_entry_read_length = key->curb_entry_read_length; @@ -105,10 +109,16 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key) vs.thread3.urb_entry_read_offset = 0; vs.thread3.const_urb_entry_read_offset = key->curbe_offset * 2; - vs.thread4.nr_urb_entries = key->nr_urb_entries; + if (BRW_IS_IGDNG(brw)) + vs.thread4.nr_urb_entries = key->nr_urb_entries >> 2; + else + vs.thread4.nr_urb_entries = key->nr_urb_entries; + vs.thread4.urb_entry_allocation_size = key->urb_size - 1; - if (BRW_IS_G4X(brw)) + if (BRW_IS_IGDNG(brw)) + chipset_max_threads = 72; + else if (BRW_IS_G4X(brw)) chipset_max_threads = 32; else chipset_max_threads = 16; @@ -120,6 +130,8 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key) /* No samplers for ARB_vp programs: */ + /* It has to be set to 0 for IGDNG + */ vs.vs5.sampler_count = 0; if (INTEL_DEBUG & DEBUG_STATS) diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index ba03afd6c13..ac117901515 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -177,14 +177,6 @@ static void brw_note_fence( struct intel_context *intel, GLuint fence ) brw_context(&intel->ctx)->state.dirty.brw |= BRW_NEW_FENCE; } - -static void brw_note_unlock( struct intel_context *intel ) -{ - struct brw_context *brw = brw_context(&intel->ctx); - brw_state_cache_check_size(brw); -} - - /* called from intelWaitForIdle() and intelFlush() * * For now, just flush everything. Could be smarter later. @@ -194,7 +186,7 @@ static GLuint brw_flush_cmd( void ) struct brw_mi_flush flush; flush.opcode = CMD_MI_FLUSH; flush.pad = 0; - flush.flags = BRW_FLUSH_READ_CACHE | BRW_FLUSH_STATE_CACHE; + flush.flags = BRW_FLUSH_STATE_CACHE; return *(GLuint *)&flush; } @@ -215,7 +207,6 @@ void brwInitVtbl( struct brw_context *brw ) brw->intel.vtbl.invalidate_state = brw_invalidate_state; brw->intel.vtbl.note_fence = brw_note_fence; - brw->intel.vtbl.note_unlock = brw_note_unlock; brw->intel.vtbl.new_batch = brw_new_batch; brw->intel.vtbl.finish_batch = brw_finish_batch; brw->intel.vtbl.destroy = brw_destroy_context; diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 3e476fd3be5..14e05be4f6c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -267,11 +267,14 @@ static void brw_wm_populate_key( struct brw_context *brw, /* BRW_NEW_WM_INPUT_DIMENSIONS */ - key->projtex_mask = brw->wm.input_size_masks[4-1] >> (FRAG_ATTRIB_TEX0 - FRAG_ATTRIB_WPOS); + key->proj_attrib_mask = brw->wm.input_size_masks[4-1]; /* _NEW_LIGHT */ key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT); + /* _NEW_HINT */ + key->linear_color = (ctx->Hint.PerspectiveCorrection == GL_FASTEST); + /* _NEW_TEXTURE */ for (i = 0; i < BRW_MAX_TEX_UNIT; i++) { const struct gl_texture_unit *unit = &ctx->Texture.Unit[i]; @@ -351,6 +354,7 @@ const struct brw_tracked_state brw_wm_prog = { .dirty = { .mesa = (_NEW_COLOR | _NEW_DEPTH | + _NEW_HINT | _NEW_STENCIL | _NEW_POLYGON | _NEW_LINE | diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index fb15c03e83d..ba497432c60 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -63,9 +63,10 @@ struct brw_wm_prog_key { GLuint computes_depth:1; /* could be derived from program string */ GLuint source_depth_to_render_target:1; GLuint flat_shade:1; + GLuint linear_color:1; /**< linear interpolation vs perspective interp */ GLuint runtime_check_aads_emit:1; - GLuint projtex_mask:16; + GLbitfield proj_attrib_mask; /**< one bit per fragment program attribute */ GLuint shadowtex_mask:16; GLuint yuvtex_mask:16; GLuint yuvtex_swap_mask:16; /* UV swaped */ diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 14ab9042de7..9f82916c025 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -714,6 +714,7 @@ static void emit_tex( struct brw_wm_compile *c, GLuint msgLength, responseLength; GLuint i, nr; GLuint emit; + GLuint msg_type; /* How many input regs are there? */ @@ -751,6 +752,18 @@ static void emit_tex( struct brw_wm_compile *c, responseLength = 8; /* always */ + if (BRW_IS_IGDNG(p->brw)) { + if (inst->tex_shadow) + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE_IGDNG; + else + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_IGDNG; + } else { + if (inst->tex_shadow) + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE; + else + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE; + } + brw_SAMPLE(p, retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW), 1, @@ -758,12 +771,12 @@ static void emit_tex( struct brw_wm_compile *c, SURF_INDEX_TEXTURE(inst->tex_unit), inst->tex_unit, /* sampler */ inst->writemask, - (inst->tex_shadow ? - BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE : - BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE), + msg_type, responseLength, msgLength, - 0); + 0, + 1, + BRW_SAMPLER_SIMD_MODE_SIMD16); } @@ -775,7 +788,7 @@ static void emit_txb( struct brw_wm_compile *c, { struct brw_compile *p = &c->func; GLuint msgLength; - + GLuint msg_type; /* Shadow ignored for txb. */ switch (inst->tex_idx) { @@ -800,6 +813,11 @@ static void emit_txb( struct brw_wm_compile *c, brw_MOV(p, brw_message_reg(8), arg[3]); msgLength = 9; + if (BRW_IS_IGDNG(p->brw)) + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS_IGDNG; + else + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; + brw_SAMPLE(p, retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW), 1, @@ -807,10 +825,12 @@ static void emit_txb( struct brw_wm_compile *c, SURF_INDEX_TEXTURE(inst->tex_unit), inst->tex_unit, /* sampler */ inst->writemask, - BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS, + msg_type, 8, /* responseLength */ msgLength, - 0); + 0, + 1, + BRW_SAMPLER_SIMD_MODE_SIMD16); } @@ -1022,7 +1042,7 @@ static void emit_fb_write( struct brw_wm_compile *c, get_element_ud(brw_vec8_grf(1,0), 6), brw_imm_ud(1<<26)); - jmp = brw_JMPI(p, ip, ip, brw_imm_w(0)); + jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)); { emit_aa(c, arg1, 2); fire_fb_write(c, 0, nr, target, eot); @@ -1057,7 +1077,6 @@ static void emit_spill( struct brw_wm_compile *c, */ brw_dp_WRITE_16(p, retype(vec16(brw_vec8_grf(0, 0)), BRW_REGISTER_TYPE_UW), - 1, slot); } @@ -1085,7 +1104,6 @@ static void emit_unspill( struct brw_wm_compile *c, brw_dp_READ_16(p, retype(vec16(reg), BRW_REGISTER_TYPE_UW), - 1, slot); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 1798d842c79..b9e8dd2e96e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -354,13 +354,25 @@ static void emit_interp( struct brw_wm_compile *c, src_undef()); } else { - emit_op(c, - WM_LINTERP, - dst, - 0, - interp, - deltas, - src_undef()); + if (c->key.linear_color) { + emit_op(c, + WM_LINTERP, + dst, + 0, + interp, + deltas, + src_undef()); + } + else { + /* perspective-corrected color interpolation */ + emit_op(c, + WM_PINTERP, + dst, + 0, + interp, + deltas, + get_pixel_w(c)); + } } break; case FRAG_ATTRIB_FOGC: @@ -834,10 +846,16 @@ static void precalc_tex( struct brw_wm_compile *c, } +/** + * Check if the given TXP instruction really needs the divide-by-W step. + */ static GLboolean projtex( struct brw_wm_compile *c, const struct prog_instruction *inst ) { - struct prog_src_register src = inst->SrcReg[0]; + const struct prog_src_register src = inst->SrcReg[0]; + GLboolean retVal; + + assert(inst->Opcode == OPCODE_TXP); /* Only try to detect the simplest cases. Could detect (later) * cases where we are trying to emit code like RCP {1.0}, MUL x, @@ -847,16 +865,21 @@ static GLboolean projtex( struct brw_wm_compile *c, * user-provided fragment programs anyway: */ if (inst->TexSrcTarget == TEXTURE_CUBE_INDEX) - return 0; /* ut2004 gun rendering !?! */ + retVal = GL_FALSE; /* ut2004 gun rendering !?! */ else if (src.File == PROGRAM_INPUT && GET_SWZ(src.Swizzle, W) == W && - (c->key.projtex_mask & (1<<(src.Index + FRAG_ATTRIB_WPOS - FRAG_ATTRIB_TEX0))) == 0) - return 0; + (c->key.proj_attrib_mask & (1 << src.Index)) == 0) + retVal = GL_FALSE; else - return 1; + retVal = GL_TRUE; + + return retVal; } +/** + * Emit code for TXP. + */ static void precalc_txp( struct brw_wm_compile *c, const struct prog_instruction *inst ) { diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 0e6a2f8ef09..19f777fe32e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -446,7 +446,6 @@ static void fetch_constants(struct brw_wm_compile *c, /* need to fetch the constant now */ brw_dp_READ_4(p, c->current_const[i].reg, /* writeback dest */ - 1, /* msg_reg */ src->RelAddr, /* relative indexing? */ 16 * src->Index, /* byte offset */ SURF_INDEX_FRAG_CONST_BUFFER/* binding table index */ @@ -2626,6 +2625,7 @@ static void emit_txb(struct brw_wm_compile *c, struct brw_reg dst[4], src[4], payload_reg; GLuint unit = c->fp->program.Base.SamplerUnits[inst->TexSrcUnit]; GLuint i; + GLuint msg_type; payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); @@ -2654,6 +2654,14 @@ static void emit_txb(struct brw_wm_compile *c, } brw_MOV(p, brw_message_reg(5), src[3]); /* bias */ brw_MOV(p, brw_message_reg(6), brw_imm_f(0)); /* ref (unused?) */ + + if (BRW_IS_IGDNG(p->brw)) { + msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_BIAS_IGDNG; + } else { + /* Does it work well on SIMD8? */ + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; + } + brw_SAMPLE(p, retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), /* dest */ 1, /* msg_reg_nr */ @@ -2661,10 +2669,12 @@ static void emit_txb(struct brw_wm_compile *c, SURF_INDEX_TEXTURE(unit), unit, /* sampler */ inst->DstReg.WriteMask, /* writemask */ - BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS, /* msg_type */ + msg_type, /* msg_type */ 4, /* response_length */ 4, /* msg_length */ - 0); /* eot */ + 0, /* eot */ + 1, + BRW_SAMPLER_SIMD_MODE_SIMD8); } @@ -2678,6 +2688,7 @@ static void emit_tex(struct brw_wm_compile *c, GLuint i, nr; GLuint emit; GLboolean shadow = (c->key.shadowtex_mask & (1<<unit)) ? 1 : 0; + GLuint msg_type; payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); @@ -2718,6 +2729,16 @@ static void emit_tex(struct brw_wm_compile *c, brw_MOV(p, brw_message_reg(6), src[2]); /* ref value / R coord */ } + if (BRW_IS_IGDNG(p->brw)) { + if (shadow) + msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_COMPARE_IGDNG; + else + msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_IGDNG; + } else { + /* Does it work for shadow on SIMD8 ? */ + msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE; + } + brw_SAMPLE(p, retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), /* dest */ 1, /* msg_reg_nr */ @@ -2725,10 +2746,12 @@ static void emit_tex(struct brw_wm_compile *c, SURF_INDEX_TEXTURE(unit), unit, /* sampler */ inst->DstReg.WriteMask, /* writemask */ - BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE, /* msg_type */ + msg_type, /* msg_type */ 4, /* response_length */ shadow ? 6 : 4, /* msg_length */ - 0); /* eot */ + 0, /* eot */ + 1, + BRW_SAMPLER_SIMD_MODE_SIMD8); if (shadow) brw_MOV(p, dst[3], brw_imm_f(1.0)); @@ -2745,11 +2768,10 @@ static void post_wm_emit( struct brw_wm_compile *c ) static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) { -#define MAX_IFSN 32 +#define MAX_IF_DEPTH 32 #define MAX_LOOP_DEPTH 32 - struct brw_instruction *if_inst[MAX_IFSN], *loop_inst[MAX_LOOP_DEPTH]; - struct brw_instruction *inst0, *inst1; - int i, if_insn = 0, loop_insn = 0; + struct brw_instruction *if_inst[MAX_IF_DEPTH], *loop_inst[MAX_LOOP_DEPTH]; + GLuint i, if_depth = 0, loop_depth = 0; struct brw_compile *p = &c->func; struct brw_indirect stack_index = brw_indirect(0, 0); @@ -2831,6 +2853,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_trunc(c, inst); break; case OPCODE_MOV: + case OPCODE_SWZ: emit_mov(c, inst); break; case OPCODE_DP3: @@ -2922,15 +2945,15 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_kil(c); break; case OPCODE_IF: - assert(if_insn < MAX_IFSN); - if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8); + assert(if_depth < MAX_IF_DEPTH); + if_inst[if_depth++] = brw_IF(p, BRW_EXECUTE_8); break; case OPCODE_ELSE: - if_inst[if_insn-1] = brw_ELSE(p, if_inst[if_insn-1]); + if_inst[if_depth-1] = brw_ELSE(p, if_inst[if_depth-1]); break; case OPCODE_ENDIF: - assert(if_insn > 0); - brw_ENDIF(p, if_inst[--if_insn]); + assert(if_depth > 0); + brw_ENDIF(p, if_inst[--if_depth]); break; case OPCODE_BGNSUB: brw_save_label(p, inst->Comment, p->nr_insn); @@ -2964,7 +2987,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) break; case OPCODE_BGNLOOP: /* XXX may need to invalidate the current_constant regs */ - loop_inst[loop_insn++] = brw_DO(p, BRW_EXECUTE_8); + loop_inst[loop_depth++] = brw_DO(p, BRW_EXECUTE_8); break; case OPCODE_BRK: brw_BREAK(p); @@ -2975,21 +2998,29 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; case OPCODE_ENDLOOP: - loop_insn--; - inst0 = inst1 = brw_WHILE(p, loop_inst[loop_insn]); - /* patch all the BREAK instructions from - last BEGINLOOP */ - while (inst0 > loop_inst[loop_insn]) { - inst0--; - if (inst0->header.opcode == BRW_OPCODE_BREAK) { - inst0->bits3.if_else.jump_count = inst1 - inst0 + 1; + { + struct brw_instruction *inst0, *inst1; + GLuint br = 1; + + if (BRW_IS_IGDNG(brw)) + br = 2; + + loop_depth--; + inst0 = inst1 = brw_WHILE(p, loop_inst[loop_depth]); + /* patch all the BREAK/CONT instructions from last BEGINLOOP */ + while (inst0 > loop_inst[loop_depth]) { + inst0--; + if (inst0->header.opcode == BRW_OPCODE_BREAK) { + inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1); inst0->bits3.if_else.pop_count = 0; - } else if (inst0->header.opcode == BRW_OPCODE_CONTINUE) { - inst0->bits3.if_else.jump_count = inst1 - inst0; + } + else if (inst0->header.opcode == BRW_OPCODE_CONTINUE) { + inst0->bits3.if_else.jump_count = br * (inst1 - inst0); inst0->bits3.if_else.pop_count = 0; - } - } - break; + } + } + } + break; default: _mesa_printf("unsupported IR in fragment shader %d\n", inst->Opcode); diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 67b41173fb2..39f8c6d522b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -71,7 +71,9 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) key->max_threads = 1; else { /* WM maximum threads is number of EUs times number of threads per EU. */ - if (BRW_IS_G4X(brw)) + if (BRW_IS_IGDNG(brw)) + key->max_threads = 12 * 6; + else if (BRW_IS_G4X(brw)) key->max_threads = 10 * 5; else key->max_threads = 8 * 4; @@ -141,7 +143,11 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key, wm.thread0.kernel_start_pointer = brw->wm.prog_bo->offset >> 6; /* reloc */ wm.thread1.depth_coef_urb_read_offset = 1; wm.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754; - wm.thread1.binding_table_entry_count = key->nr_surfaces; + + if (BRW_IS_IGDNG(brw)) + wm.thread1.binding_table_entry_count = 0; /* hardware requirement */ + else + wm.thread1.binding_table_entry_count = key->nr_surfaces; if (key->total_scratch != 0) { wm.thread2.scratch_space_base_pointer = @@ -158,7 +164,11 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key, wm.thread3.const_urb_entry_read_length = key->curb_entry_read_length; wm.thread3.const_urb_entry_read_offset = key->curbe_offset * 2; - wm.wm4.sampler_count = (key->sampler_count + 1) / 4; + if (BRW_IS_IGDNG(brw)) + wm.wm4.sampler_count = 0; /* hardware requirement */ + else + wm.wm4.sampler_count = (key->sampler_count + 1) / 4; + if (brw->wm.sampler_bo != NULL) { /* reloc */ wm.wm4.sampler_state_pointer = brw->wm.sampler_bo->offset >> 5; diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index c49a5f6b4ec..096f74394eb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -578,7 +578,27 @@ brw_update_renderbuffer_surface(struct brw_context *brw, surf.ss0.surface_format = key.surface_format; surf.ss0.surface_type = key.surface_type; - surf.ss1.base_addr = key.draw_offset; + if (key.tiling == I915_TILING_NONE) { + surf.ss1.base_addr = key.draw_offset; + } else { + uint32_t tile_offset = key.draw_offset % 4096; + + surf.ss1.base_addr = key.draw_offset - tile_offset; + + assert(BRW_IS_G4X(brw) || tile_offset == 0); + if (BRW_IS_G4X(brw)) { + if (key.tiling == I915_TILING_X) { + /* Note that the low bits of these fields are missing, so + * there's the possibility of getting in trouble. + */ + surf.ss5.x_offset = (tile_offset % 512) / key.cpp / 4; + surf.ss5.y_offset = tile_offset / 512 / 2; + } else { + surf.ss5.x_offset = (tile_offset % 128) / key.cpp / 4; + surf.ss5.y_offset = tile_offset / 128 / 2; + } + } + } if (region_bo != NULL) surf.ss1.base_addr += region_bo->offset; /* reloc */ @@ -609,7 +629,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, drm_intel_bo_emit_reloc(brw->wm.surf_bo[unit], offsetof(struct brw_surface_state, ss1), region_bo, - key.draw_offset, + surf.ss1.base_addr, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER); } diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c new file mode 120000 index 00000000000..cc4589f4d42 --- /dev/null +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c @@ -0,0 +1 @@ +../intel/intel_pixel_read.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 29dc05c518e..0f87fc46a44 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -195,7 +195,6 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, { struct intel_context *intel = batch->intel; GLuint used = batch->ptr - batch->map; - GLboolean was_locked = intel->locked; if (used == 0) { batch->cliprect_mode = IGNORE_CLIPRECTS; @@ -243,13 +242,9 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, /* TODO: Just pass the relocation list and dma buffer up to the * kernel. */ - if (!was_locked) - LOCK_HARDWARE(intel); - + LOCK_HARDWARE(intel); do_flush_locked(batch, used, GL_FALSE); - - if (!was_locked) - UNLOCK_HARDWARE(intel); + UNLOCK_HARDWARE(intel); if (INTEL_DEBUG & DEBUG_SYNC) { fprintf(stderr, "waiting for idle\n"); diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 49198281316..2e95bd1013f 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -108,6 +108,8 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; } + assert(src->tiling != I915_TILING_Y); + assert(dst->tiling != I915_TILING_Y); #ifndef I915 if (src->tiling != I915_TILING_NONE) { CMD |= XY_SRC_TILED; @@ -175,66 +177,6 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, UNLOCK_HARDWARE(intel); } - - - -void -intelEmitFillBlit(struct intel_context *intel, - GLuint cpp, - GLshort dst_pitch, - dri_bo *dst_buffer, - GLuint dst_offset, - uint32_t dst_tiling, - GLshort x, GLshort y, - GLshort w, GLshort h, - GLuint color) -{ - GLuint BR13, CMD; - BATCH_LOCALS; - - dst_pitch *= cpp; - - switch (cpp) { - case 1: - BR13 = (0xF0 << 16); - CMD = XY_COLOR_BLT_CMD; - break; - case 2: - BR13 = (0xF0 << 16) | BR13_565; - CMD = XY_COLOR_BLT_CMD; - break; - case 4: - BR13 = (0xF0 << 16) | BR13_8888; - CMD = XY_COLOR_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; - break; - default: - return; - } -#ifndef I915 - if (dst_tiling != I915_TILING_NONE) { - CMD |= XY_DST_TILED; - dst_pitch /= 4; - } -#endif - - DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", - __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h); - - assert(w > 0); - assert(h > 0); - - BEGIN_BATCH(6, NO_LOOP_CLIPRECTS); - OUT_BATCH(CMD); - OUT_BATCH(BR13 | dst_pitch); - OUT_BATCH((y << 16) | x); - OUT_BATCH(((y + h) << 16) | (x + w)); - OUT_RELOC(dst_buffer, - I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, - dst_offset); - OUT_BATCH(color); - ADVANCE_BATCH(); -} - static GLuint translate_raster_op(GLenum logicop) { switch(logicop) { @@ -261,7 +203,7 @@ static GLuint translate_raster_op(GLenum logicop) /* Copy BitBlt */ -void +GLboolean intelEmitCopyBlit(struct intel_context *intel, GLuint cpp, GLshort src_pitch, @@ -283,6 +225,19 @@ intelEmitCopyBlit(struct intel_context *intel, dri_bo *aper_array[3]; BATCH_LOCALS; + if (dst_tiling != I915_TILING_NONE) { + if (dst_offset & 4095) + return GL_FALSE; + if (dst_tiling == I915_TILING_Y) + return GL_FALSE; + } + if (src_tiling != I915_TILING_NONE) { + if (src_offset & 4095) + return GL_FALSE; + if (src_tiling == I915_TILING_Y) + return GL_FALSE; + } + /* do space/cliprects check before going any further */ do { aper_array[0] = intel->batch->buf; @@ -297,12 +252,7 @@ intelEmitCopyBlit(struct intel_context *intel, } while (pass < 2); if (pass >= 2) { - GLboolean locked = GL_FALSE; - if (!intel->locked) { - LOCK_HARDWARE(intel); - locked = GL_TRUE; - } - + LOCK_HARDWARE(intel); dri_bo_map(dst_buffer, GL_TRUE); dri_bo_map(src_buffer, GL_FALSE); _mesa_copy_rect((GLubyte *)dst_buffer->virtual + dst_offset, @@ -316,11 +266,9 @@ intelEmitCopyBlit(struct intel_context *intel, dri_bo_unmap(src_buffer); dri_bo_unmap(dst_buffer); - - if (locked) - UNLOCK_HARDWARE(intel); + UNLOCK_HARDWARE(intel); - return; + return GL_TRUE; } intel_batchbuffer_require_space(intel->batch, 8 * 4, NO_LOOP_CLIPRECTS); @@ -347,7 +295,7 @@ intelEmitCopyBlit(struct intel_context *intel, CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; break; default: - return; + return GL_FALSE; } #ifndef I915 @@ -362,7 +310,7 @@ intelEmitCopyBlit(struct intel_context *intel, #endif if (dst_y2 <= dst_y || dst_x2 <= dst_x) { - return; + return GL_TRUE; } assert(dst_x < dst_x2); @@ -384,6 +332,8 @@ intelEmitCopyBlit(struct intel_context *intel, ADVANCE_BATCH(); intel_batchbuffer_emit_mi_flush(intel->batch); + + return GL_TRUE; } @@ -596,7 +546,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) UNLOCK_HARDWARE(intel); } -void +GLboolean intelEmitImmediateColorExpandBlit(struct intel_context *intel, GLuint cpp, GLubyte *src_bits, GLuint src_size, @@ -612,11 +562,18 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, int dwords = ALIGN(src_size, 8) / 4; uint32_t opcode, br13, blit_cmd; + if (dst_tiling != I915_TILING_NONE) { + if (dst_offset & 4095) + return GL_FALSE; + if (dst_tiling == I915_TILING_Y) + return GL_FALSE; + } + assert( logic_op - GL_CLEAR >= 0 ); assert( logic_op - GL_CLEAR < 0x10 ); if (w < 0 || h < 0) - return; + return GL_TRUE; dst_pitch *= cpp; @@ -673,4 +630,6 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, REFERENCES_CLIPRECTS ); intel_batchbuffer_emit_mi_flush(intel->batch); + + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/intel/intel_blit.h b/src/mesa/drivers/dri/intel/intel_blit.h index 52065b13ed7..152fa3f17bf 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.h +++ b/src/mesa/drivers/dri/intel/intel_blit.h @@ -35,7 +35,8 @@ extern void intelCopyBuffer(const __DRIdrawablePrivate * dpriv, extern void intelClearWithBlit(GLcontext * ctx, GLbitfield mask); -extern void intelEmitCopyBlit(struct intel_context *intel, +GLboolean +intelEmitCopyBlit(struct intel_context *intel, GLuint cpp, GLshort src_pitch, dri_bo *src_buffer, @@ -50,16 +51,7 @@ extern void intelEmitCopyBlit(struct intel_context *intel, GLshort w, GLshort h, GLenum logicop ); -extern void intelEmitFillBlit(struct intel_context *intel, - GLuint cpp, - GLshort dst_pitch, - dri_bo *dst_buffer, - GLuint dst_offset, - uint32_t dst_tiling, - GLshort x, GLshort y, - GLshort w, GLshort h, GLuint color); - -void +GLboolean intelEmitImmediateColorExpandBlit(struct intel_context *intel, GLuint cpp, GLubyte *src_bits, GLuint src_size, diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 23ba3b9ef67..9600557f2cc 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -243,6 +243,9 @@ intel_bufferobj_map(GLcontext * ctx, return obj->Pointer; } + if (!read_only) + intelFlush(ctx); + if (intel_obj->region) intel_bufferobj_cow(intel, intel_obj); @@ -274,7 +277,10 @@ intel_bufferobj_unmap(GLcontext * ctx, struct intel_buffer_object *intel_obj = intel_buffer_object(obj); assert(intel_obj); - if (intel_obj->buffer != NULL) { + if (intel_obj->sys_buffer != NULL) { + assert(obj->Pointer); + obj->Pointer = NULL; + } else if (intel_obj->buffer != NULL) { assert(obj->Pointer); if (intel_obj->mapped_gtt) { drm_intel_gem_bo_unmap_gtt(intel_obj->buffer); @@ -300,14 +306,19 @@ intel_bufferobj_buffer(struct intel_context *intel, } if (intel_obj->buffer == NULL) { + void *sys_buffer = intel_obj->sys_buffer; + + /* only one of buffer and sys_buffer could be non-NULL */ intel_bufferobj_alloc_buffer(intel, intel_obj); + intel_obj->sys_buffer = NULL; + intel_bufferobj_subdata(&intel->ctx, GL_ARRAY_BUFFER_ARB, 0, intel_obj->Base.Size, - intel_obj->sys_buffer, + sys_buffer, &intel_obj->Base); - _mesa_free(intel_obj->sys_buffer); + _mesa_free(sys_buffer); intel_obj->sys_buffer = NULL; } @@ -315,15 +326,13 @@ intel_bufferobj_buffer(struct intel_context *intel, } void -intel_bufferobj_init(struct intel_context *intel) +intelInitBufferObjectFuncs(struct dd_function_table *functions) { - GLcontext *ctx = &intel->ctx; - - ctx->Driver.NewBufferObject = intel_bufferobj_alloc; - ctx->Driver.DeleteBuffer = intel_bufferobj_free; - ctx->Driver.BufferData = intel_bufferobj_data; - ctx->Driver.BufferSubData = intel_bufferobj_subdata; - ctx->Driver.GetBufferSubData = intel_bufferobj_get_subdata; - ctx->Driver.MapBuffer = intel_bufferobj_map; - ctx->Driver.UnmapBuffer = intel_bufferobj_unmap; + functions->NewBufferObject = intel_bufferobj_alloc; + functions->DeleteBuffer = intel_bufferobj_free; + functions->BufferData = intel_bufferobj_data; + functions->BufferSubData = intel_bufferobj_subdata; + functions->GetBufferSubData = intel_bufferobj_get_subdata; + functions->MapBuffer = intel_bufferobj_map; + functions->UnmapBuffer = intel_bufferobj_unmap; } diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.h b/src/mesa/drivers/dri/intel/intel_buffer_objects.h index 04310156319..8164407f079 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.h +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.h @@ -60,7 +60,7 @@ dri_bo *intel_bufferobj_buffer(struct intel_context *intel, /* Hook the bufferobject implementation into mesa: */ -void intel_bufferobj_init(struct intel_context *intel); +void intelInitBufferObjectFuncs(struct dd_function_table *functions); @@ -72,10 +72,7 @@ void intel_bufferobj_init(struct intel_context *intel); static INLINE struct intel_buffer_object * intel_buffer_object(struct gl_buffer_object *obj) { - if (obj->Name) - return (struct intel_buffer_object *) obj; - else - return NULL; + return (struct intel_buffer_object *) obj; } /* Helpers for zerocopy image uploads. See also intel_regions.h: diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index df5c3fc1766..e7357e78c53 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -345,6 +345,23 @@ intelDrawBuffer(GLcontext * ctx, GLenum mode) static void intelReadBuffer(GLcontext * ctx, GLenum mode) { + if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { + struct intel_context *const intel = intel_context(ctx); + const GLboolean was_front_buffer_reading = + intel->is_front_buffer_reading; + + intel->is_front_buffer_reading = (mode == GL_FRONT_LEFT) + || (mode == GL_FRONT); + + /* If we weren't front-buffer reading before but we are now, make sure + * that the front-buffer has actually been allocated. + */ + if (!was_front_buffer_reading && intel->is_front_buffer_reading) { + intel_update_renderbuffers(intel->driContext, + intel->driContext->driDrawablePriv); + } + } + if (ctx->ReadBuffer == ctx->DrawBuffer) { /* This will update FBO completeness status. * A framebuffer will be incomplete if the GL_READ_BUFFER setting diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h index 4593d90df3d..3c38f1676c9 100644 --- a/src/mesa/drivers/dri/intel/intel_chipset.h +++ b/src/mesa/drivers/dri/intel/intel_chipset.h @@ -67,13 +67,18 @@ #define PCI_CHIP_G45_G 0x2E22 #define PCI_CHIP_G41_G 0x2E32 +#define PCI_CHIP_ILD_G 0x0042 +#define PCI_CHIP_ILM_G 0x0046 + #define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \ devid == PCI_CHIP_I915_GM || \ devid == PCI_CHIP_I945_GM || \ devid == PCI_CHIP_I945_GME || \ devid == PCI_CHIP_I965_GM || \ devid == PCI_CHIP_I965_GME || \ - devid == PCI_CHIP_GM45_GM || IS_IGD(devid)) + devid == PCI_CHIP_GM45_GM || \ + IS_IGD(devid) || \ + devid == PCI_CHIP_ILM_G) #define IS_G45(devid) (devid == PCI_CHIP_IGD_E_G || \ devid == PCI_CHIP_Q45_G || \ @@ -82,6 +87,10 @@ #define IS_GM45(devid) (devid == PCI_CHIP_GM45_GM) #define IS_G4X(devid) (IS_G45(devid) || IS_GM45(devid)) +#define IS_ILD(devid) (devid == PCI_CHIP_ILD_G) +#define IS_ILM(devid) (devid == PCI_CHIP_ILM_G) +#define IS_IGDNG(devid) (IS_ILD(devid) || IS_ILM(devid)) + #define IS_915(devid) (devid == PCI_CHIP_I915_G || \ devid == PCI_CHIP_E7221_G || \ devid == PCI_CHIP_I915_GM) @@ -99,7 +108,8 @@ devid == PCI_CHIP_I965_GM || \ devid == PCI_CHIP_I965_GME || \ devid == PCI_CHIP_I946_GZ || \ - IS_G4X(devid)) + IS_G4X(devid) || \ + IS_IGDNG(devid)) #define IS_9XX(devid) (IS_915(devid) || \ IS_945(devid) || \ diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 309ac1923bc..cfddabd3182 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -57,237 +57,6 @@ #define FILE_DEBUG_FLAG DEBUG_BLIT -#define TRI_CLEAR_COLOR_BITS (BUFFER_BIT_BACK_LEFT | \ - BUFFER_BIT_FRONT_LEFT | \ - BUFFER_BIT_COLOR0 | \ - BUFFER_BIT_COLOR1 | \ - BUFFER_BIT_COLOR2 | \ - BUFFER_BIT_COLOR3 | \ - BUFFER_BIT_COLOR4 | \ - BUFFER_BIT_COLOR5 | \ - BUFFER_BIT_COLOR6 | \ - BUFFER_BIT_COLOR7) - - -/** - * Per-context one-time init of things for intl_clear_tris(). - * Basically set up a private array object for vertex/color arrays. - */ -static void -init_clear(GLcontext *ctx) -{ - struct intel_context *intel = intel_context(ctx); - struct gl_array_object *arraySave = NULL; - const GLuint arrayBuffer = ctx->Array.ArrayBufferObj->Name; - const GLuint elementBuffer = ctx->Array.ElementArrayBufferObj->Name; - - /* create new array object */ - intel->clear.arrayObj = _mesa_new_array_object(ctx, ~0); - - /* save current array object, bind new one */ - _mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj); - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, intel->clear.arrayObj); - - /* one-time setup of vertex arrays (pos, color) */ - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - _mesa_ColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), intel->clear.color); - _mesa_VertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), intel->clear.vertices); - _mesa_Enable(GL_COLOR_ARRAY); - _mesa_Enable(GL_VERTEX_ARRAY); - - /* restore original array object */ - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave); - _mesa_reference_array_object(ctx, &arraySave, NULL); - - /* restore original buffer objects */ - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, arrayBuffer); - _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementBuffer); -} - - - -/** - * Perform glClear where mask contains only color, depth, and/or stencil. - * - * The implementation is based on calling into Mesa to set GL state and - * performing normal triangle rendering. The intent of this path is to - * have as generic a path as possible, so that any driver could make use of - * it. - */ -void -intel_clear_tris(GLcontext *ctx, GLbitfield mask) -{ - struct intel_context *intel = intel_context(ctx); - GLfloat dst_z; - struct gl_framebuffer *fb = ctx->DrawBuffer; - int i; - GLboolean saved_fp_enable = GL_FALSE, saved_vp_enable = GL_FALSE; - GLuint saved_shader_program = 0; - unsigned int saved_active_texture; - struct gl_array_object *arraySave = NULL; - - if (!intel->clear.arrayObj) - init_clear(ctx); - - assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH | - BUFFER_BIT_STENCIL)) == 0); - - _mesa_PushAttrib(GL_COLOR_BUFFER_BIT | - GL_CURRENT_BIT | - GL_DEPTH_BUFFER_BIT | - GL_ENABLE_BIT | - GL_POLYGON_BIT | - GL_STENCIL_BUFFER_BIT | - GL_TRANSFORM_BIT | - GL_CURRENT_BIT); - saved_active_texture = ctx->Texture.CurrentUnit; - - /* Disable existing GL state we don't want to apply to a clear. */ - _mesa_Disable(GL_ALPHA_TEST); - _mesa_Disable(GL_BLEND); - _mesa_Disable(GL_CULL_FACE); - _mesa_Disable(GL_FOG); - _mesa_Disable(GL_POLYGON_SMOOTH); - _mesa_Disable(GL_POLYGON_STIPPLE); - _mesa_Disable(GL_POLYGON_OFFSET_FILL); - _mesa_Disable(GL_LIGHTING); - _mesa_Disable(GL_CLIP_PLANE0); - _mesa_Disable(GL_CLIP_PLANE1); - _mesa_Disable(GL_CLIP_PLANE2); - _mesa_Disable(GL_CLIP_PLANE3); - _mesa_Disable(GL_CLIP_PLANE4); - _mesa_Disable(GL_CLIP_PLANE5); - _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); - if (ctx->Extensions.ARB_fragment_program && ctx->FragmentProgram.Enabled) { - saved_fp_enable = GL_TRUE; - _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); - } - if (ctx->Extensions.ARB_vertex_program && ctx->VertexProgram.Enabled) { - saved_vp_enable = GL_TRUE; - _mesa_Disable(GL_VERTEX_PROGRAM_ARB); - } - if (ctx->Extensions.ARB_shader_objects && ctx->Shader.CurrentProgram) { - saved_shader_program = ctx->Shader.CurrentProgram->Name; - _mesa_UseProgramObjectARB(0); - } - - if (ctx->Texture._EnabledUnits != 0) { - int i; - - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - _mesa_ActiveTextureARB(GL_TEXTURE0 + i); - _mesa_Disable(GL_TEXTURE_1D); - _mesa_Disable(GL_TEXTURE_2D); - _mesa_Disable(GL_TEXTURE_3D); - if (ctx->Extensions.ARB_texture_cube_map) - _mesa_Disable(GL_TEXTURE_CUBE_MAP_ARB); - if (ctx->Extensions.NV_texture_rectangle) - _mesa_Disable(GL_TEXTURE_RECTANGLE_NV); - if (ctx->Extensions.MESA_texture_array) { - _mesa_Disable(GL_TEXTURE_1D_ARRAY_EXT); - _mesa_Disable(GL_TEXTURE_2D_ARRAY_EXT); - } - } - } - - /* save current array object, bind our private one */ - _mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj); - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, intel->clear.arrayObj); - - intel_meta_set_passthrough_transform(intel); - - for (i = 0; i < 4; i++) { - COPY_4FV(intel->clear.color[i], ctx->Color.ClearColor); - } - - /* convert clear Z from [0,1] to NDC coord in [-1,1] */ - dst_z = -1.0 + 2.0 * ctx->Depth.Clear; - - /* Prepare the vertices, which are the same regardless of which buffer we're - * drawing to. - */ - intel->clear.vertices[0][0] = fb->_Xmin; - intel->clear.vertices[0][1] = fb->_Ymin; - intel->clear.vertices[0][2] = dst_z; - intel->clear.vertices[1][0] = fb->_Xmax; - intel->clear.vertices[1][1] = fb->_Ymin; - intel->clear.vertices[1][2] = dst_z; - intel->clear.vertices[2][0] = fb->_Xmax; - intel->clear.vertices[2][1] = fb->_Ymax; - intel->clear.vertices[2][2] = dst_z; - intel->clear.vertices[3][0] = fb->_Xmin; - intel->clear.vertices[3][1] = fb->_Ymax; - intel->clear.vertices[3][2] = dst_z; - - while (mask != 0) { - GLuint this_mask = 0; - GLuint color_bit; - - color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS); - if (color_bit != 0) - this_mask |= (1 << (color_bit - 1)); - - /* Clear depth/stencil in the same pass as color. */ - this_mask |= (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)); - - /* Select the current color buffer and use the color write mask if - * we have one, otherwise don't write any color channels. - */ - if (this_mask & BUFFER_BIT_FRONT_LEFT) - _mesa_DrawBuffer(GL_FRONT_LEFT); - else if (this_mask & BUFFER_BIT_BACK_LEFT) - _mesa_DrawBuffer(GL_BACK_LEFT); - else if (color_bit != 0) - _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0 + - (color_bit - BUFFER_COLOR0 - 1)); - else - _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - - /* Control writing of the depth clear value to depth. */ - if (this_mask & BUFFER_BIT_DEPTH) { - _mesa_DepthFunc(GL_ALWAYS); - _mesa_Enable(GL_DEPTH_TEST); - } else { - _mesa_Disable(GL_DEPTH_TEST); - _mesa_DepthMask(GL_FALSE); - } - - /* Control writing of the stencil clear value to stencil. */ - if (this_mask & BUFFER_BIT_STENCIL) { - _mesa_Enable(GL_STENCIL_TEST); - _mesa_StencilOpSeparate(GL_FRONT_AND_BACK, - GL_REPLACE, GL_REPLACE, GL_REPLACE); - _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, - ctx->Stencil.Clear, - ctx->Stencil.WriteMask[0]); - } else { - _mesa_Disable(GL_STENCIL_TEST); - } - - CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); - - mask &= ~this_mask; - } - - intel_meta_restore_transform(intel); - - _mesa_ActiveTextureARB(GL_TEXTURE0 + saved_active_texture); - if (saved_fp_enable) - _mesa_Enable(GL_FRAGMENT_PROGRAM_ARB); - if (saved_vp_enable) - _mesa_Enable(GL_VERTEX_PROGRAM_ARB); - - if (saved_shader_program) - _mesa_UseProgramObjectARB(saved_shader_program); - - _mesa_PopAttrib(); - - /* restore current array object */ - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave); - _mesa_reference_array_object(ctx, &arraySave, NULL); -} - static const char *buffer_names[] = { [BUFFER_FRONT_LEFT] = "front", [BUFFER_BACK_LEFT] = "back", @@ -313,6 +82,7 @@ static const char *buffer_names[] = { static void intelClear(GLcontext *ctx, GLbitfield mask) { + struct intel_context *intel = intel_context(ctx); const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask); GLbitfield tri_mask = 0; GLbitfield blit_mask = 0; @@ -412,7 +182,7 @@ intelClear(GLcontext *ctx, GLbitfield mask) } DBG("\n"); } - intel_clear_tris(ctx, tri_mask); + meta_clear_tris(&intel->meta, tri_mask); } if (swrast_mask) { diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index f88b37d0f3a..4abb525f78e 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -67,10 +67,12 @@ int INTEL_DEBUG = (0); #endif -#define DRIVER_DATE "20090114" +#define DRIVER_DATE "20090712 2009Q2 RC3" #define DRIVER_DATE_GEM "GEM " DRIVER_DATE +static void intel_flush(GLcontext *ctx, GLboolean needs_mi_flush); + static const GLubyte * intelGetString(GLcontext * ctx, GLenum name) { @@ -159,6 +161,12 @@ intelGetString(GLcontext * ctx, GLenum name) case PCI_CHIP_G41_G: chipset = "Intel(R) G41"; break; + case PCI_CHIP_ILD_G: + chipset = "Intel(R) IGDNG_D"; + break; + case PCI_CHIP_ILM_G: + chipset = "Intel(R) IGDNG_M"; + break; default: chipset = "Unknown Intel Chipset"; break; @@ -218,7 +226,9 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) struct intel_renderbuffer *stencil_rb; i = 0; - if ((intel->is_front_buffer_rendering || !intel_fb->color_rb[1]) + if ((intel->is_front_buffer_rendering || + intel->is_front_buffer_reading || + !intel_fb->color_rb[1]) && intel_fb->color_rb[0]) { attachments[i++] = __DRI_BUFFER_FRONT_LEFT; attachments[i++] = intel_bits_per_pixel(intel_fb->color_rb[0]); @@ -394,7 +404,16 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) if (!driContext->driScreenPriv->dri2.enabled) return; - if (!intel->internal_viewport_call && ctx->DrawBuffer->Name == 0) { + if (!intel->meta.internal_viewport_call && ctx->DrawBuffer->Name == 0) { + /* If we're rendering to the fake front buffer, make sure all the pending + * drawing has landed on the real front buffer. Otherwise when we + * eventually get to DRI2GetBuffersWithFormat the stale real front + * buffer contents will get copied to the new fake front buffer. + */ + if (intel->is_front_buffer_rendering) { + intel_flush(ctx, GL_FALSE); + } + intel_update_renderbuffers(driContext, driContext->driDrawablePriv); if (driContext->driDrawablePriv != driContext->driReadablePriv) intel_update_renderbuffers(driContext, driContext->driReadablePriv); @@ -526,7 +545,7 @@ intelFinish(GLcontext * ctx) irb = intel_renderbuffer(fb->_ColorDrawBuffers[i]); - if (irb->region) + if (irb && irb->region) dri_bo_wait_rendering(irb->region->buffer); } if (fb->_DepthBuffer) { @@ -557,6 +576,7 @@ intelInitDriverFunctions(struct dd_function_table *functions) intelInitClearFuncs(functions); intelInitBufferFuncs(functions); intelInitPixelFuncs(functions); + intelInitBufferObjectFuncs(functions); } @@ -652,6 +672,7 @@ intelInitContext(struct intel_context *intel, */ _mesa_init_point(ctx); + meta_init_metaops(ctx, &intel->meta); ctx->Const.MaxColorAttachments = 4; /* XXX FBO: review this */ if (IS_965(intelScreen->deviceID)) { if (MAX_WIDTH > 8192) @@ -717,7 +738,6 @@ intelInitContext(struct intel_context *intel, intel->batch = intel_batchbuffer_alloc(intel); - intel_bufferobj_init(intel); intel_fbo_init(intel); if (intel->ctx.Mesa_DXTn) { @@ -729,6 +749,12 @@ intelInitContext(struct intel_context *intel, } intel->use_texture_tiling = driQueryOptionb(&intel->optionCache, "texture_tiling"); + if (intel->use_texture_tiling && + !intel->intelScreen->kernel_exec_fencing) { + fprintf(stderr, "No kernel support for execution fencing, " + "disabling texture tiling"); + intel->use_texture_tiling = GL_FALSE; + } intel->use_early_z = driQueryOptionb(&intel->optionCache, "early_z"); intel->prim.primitive = ~0; @@ -769,8 +795,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) INTEL_FIREVERTICES(intel); - if (intel->clear.arrayObj) - _mesa_delete_array_object(&intel->ctx, intel->clear.arrayObj); + meta_destroy_metaops(&intel->meta); intel->vtbl.destroy(intel); @@ -858,7 +883,8 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) /* free the Mesa context */ _mesa_free_context_data(&intel->ctx); - + FREE(intel); + driContextPriv->driverPrivate = NULL; } } @@ -975,7 +1001,6 @@ intelContendedLock(struct intel_context *intel, GLuint flags) int me = intel->hHWContext; drmGetLock(intel->driFd, intel->hHWContext, flags); - intel->locked = 1; if (INTEL_DEBUG & DEBUG_LOCK) _mesa_printf("%s - got contended lock\n", __progname); @@ -1032,9 +1057,12 @@ void LOCK_HARDWARE( struct intel_context *intel ) struct intel_framebuffer *intel_fb = NULL; struct intel_renderbuffer *intel_rb = NULL; - _glthread_LOCK_MUTEX(lockMutex); - assert(!intel->locked); - intel->locked = 1; + intel->locked++; + if (intel->locked >= 2) + return; + + if (!sPriv->dri2.enabled) + _glthread_LOCK_MUTEX(lockMutex); if (intel->driDrawable) { intel_fb = intel->driDrawable->driverPrivate; @@ -1081,13 +1109,16 @@ void UNLOCK_HARDWARE( struct intel_context *intel ) { __DRIscreen *sPriv = intel->driScreen; - intel->vtbl.note_unlock( intel ); - intel->locked = 0; + intel->locked--; + if (intel->locked > 0) + return; - if (!sPriv->dri2.enabled) - DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext); + assert(intel->locked == 0); - _glthread_UNLOCK_MUTEX(lockMutex); + if (!sPriv->dri2.enabled) { + DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext); + _glthread_UNLOCK_MUTEX(lockMutex); + } if (INTEL_DEBUG & DEBUG_LOCK) _mesa_printf("%s - unlocked\n", __progname); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 7d3c80bb21c..08bea88c958 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -33,6 +33,7 @@ #include "main/mtypes.h" #include "main/mm.h" #include "texmem.h" +#include "dri_metaops.h" #include "drm.h" #include "intel_bufmgr.h" @@ -91,7 +92,6 @@ struct intel_context void (*new_batch) (struct intel_context * intel); void (*emit_invarient_state) (struct intel_context * intel); void (*note_fence) (struct intel_context *intel, GLuint fence); - void (*note_unlock) (struct intel_context *intel); void (*update_texture_state) (struct intel_context * intel); void (*render_start) (struct intel_context * intel); @@ -158,29 +158,7 @@ struct intel_context void (*debug_batch)(struct intel_context *intel); } vtbl; - struct { - struct gl_fragment_program *bitmap_fp; - struct gl_vertex_program *passthrough_vp; - struct gl_buffer_object *texcoord_vbo; - - struct gl_fragment_program *saved_fp; - GLboolean saved_fp_enable; - struct gl_vertex_program *saved_vp; - GLboolean saved_vp_enable; - - struct gl_fragment_program *tex2d_fp; - - GLboolean saved_texcoord_enable; - struct gl_buffer_object *saved_array_vbo, *saved_texcoord_vbo; - GLenum saved_texcoord_type; - GLsizei saved_texcoord_size, saved_texcoord_stride; - const void *saved_texcoord_ptr; - int saved_active_texture; - - GLint saved_vp_x, saved_vp_y; - GLsizei saved_vp_width, saved_vp_height; - GLenum saved_matrix_mode; - } meta; + struct dri_metaops meta; GLint refcount; GLuint Fallback; @@ -192,7 +170,6 @@ struct intel_context struct intel_region *front_region; struct intel_region *back_region; struct intel_region *depth_region; - GLboolean internal_viewport_call; /** * This value indicates that the kernel memory manager is being used @@ -225,13 +202,6 @@ struct intel_context GLuint ClearColor565; GLuint ClearColor8888; - /* info for intel_clear_tris() */ - struct - { - struct gl_array_object *arrayObj; - GLfloat vertices[4][3]; - GLfloat color[4][4]; - } clear; /* Offsets of fields within the current vertex: */ @@ -304,6 +274,14 @@ struct intel_context * easily. */ GLboolean is_front_buffer_rendering; + /** + * Track whether front-buffer is the current read target. + * + * This is closely associated with is_front_buffer_rendering, but may + * be set separately. The DRI2 fake front buffer must be referenced + * either way. + */ + GLboolean is_front_buffer_reading; GLboolean use_texture_tiling; GLboolean use_early_z; diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 1e8b1878abe..7742609d242 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -34,6 +34,7 @@ #define need_GL_ARB_occlusion_query #define need_GL_ARB_point_parameters #define need_GL_ARB_shader_objects +#define need_GL_ARB_vertex_array_object #define need_GL_ARB_vertex_program #define need_GL_ARB_vertex_shader #define need_GL_ARB_window_pos @@ -45,6 +46,7 @@ #define need_GL_EXT_fog_coord #define need_GL_EXT_framebuffer_object #define need_GL_EXT_framebuffer_blit +#define need_GL_EXT_gpu_program_parameters #define need_GL_EXT_point_parameters #define need_GL_EXT_secondary_color #define need_GL_EXT_stencil_two_side @@ -66,6 +68,7 @@ * i965_dri. */ static const struct dri_extension card_extensions[] = { + { "GL_ARB_half_float_pixel", NULL }, { "GL_ARB_multitexture", NULL }, { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions }, { "GL_ARB_texture_border_clamp", NULL }, @@ -76,6 +79,7 @@ static const struct dri_extension card_extensions[] = { { "GL_ARB_texture_env_dot3", NULL }, { "GL_ARB_texture_mirrored_repeat", NULL }, { "GL_ARB_texture_rectangle", NULL }, + { "GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions}, { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, { "GL_ARB_window_pos", GL_ARB_window_pos_functions }, { "GL_EXT_blend_color", GL_EXT_blend_color_functions }, @@ -86,6 +90,7 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_blend_subtract", NULL }, { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions }, { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, + { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, { "GL_EXT_packed_depth_stencil", NULL }, { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions }, { "GL_EXT_stencil_wrap", NULL }, diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 0ea413aee1d..666893596e1 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -516,6 +516,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->Base.BlueBits = texImage->TexFormat->BlueBits; irb->Base.AlphaBits = texImage->TexFormat->AlphaBits; irb->Base.DepthBits = texImage->TexFormat->DepthBits; + irb->Base.StencilBits = texImage->TexFormat->StencilBits; irb->Base.Delete = intel_delete_renderbuffer; irb->Base.AllocStorage = intel_nop_alloc_storage; diff --git a/src/mesa/drivers/dri/intel/intel_generatemipmap.c b/src/mesa/drivers/dri/intel/intel_generatemipmap.c index 1060fbd9e59..fe986092db6 100644 --- a/src/mesa/drivers/dri/intel/intel_generatemipmap.c +++ b/src/mesa/drivers/dri/intel/intel_generatemipmap.c @@ -88,7 +88,7 @@ intel_generate_mipmap_level(GLcontext *ctx, GLuint tex_name, if (status != GL_FRAMEBUFFER_COMPLETE_EXT) return GL_FALSE; - intel_meta_set_passthrough_transform(intel); + meta_set_passthrough_transform(&intel->meta); /* XXX: Doing it right would involve setting up the transformation to do * 0-1 mapping or something, and not changing the vertex data. @@ -104,12 +104,12 @@ intel_generate_mipmap_level(GLcontext *ctx, GLuint tex_name, _mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices); _mesa_Enable(GL_VERTEX_ARRAY); - intel_meta_set_default_texrect(intel); + meta_set_default_texrect(&intel->meta); - CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - intel_meta_restore_texcoords(intel); - intel_meta_restore_transform(intel); + meta_restore_texcoords(&intel->meta); + meta_restore_transform(&intel->meta); return GL_TRUE; } @@ -153,9 +153,9 @@ intel_generate_mipmap_2d(GLcontext *ctx, _mesa_GenFramebuffersEXT(1, &fb_name); _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_name); - intel_meta_set_fragment_program(intel, &intel->meta.tex2d_fp, - intel_fp_tex2d); - intel_meta_set_passthrough_vertex_program(intel); + meta_set_fragment_program(&intel->meta, &intel->meta.tex2d_fp, + intel_fp_tex2d); + meta_set_passthrough_vertex_program(&intel->meta); max_levels = _mesa_max_texture_levels(ctx, texObj->Target); start_level = texObj->BaseLevel; @@ -202,8 +202,8 @@ intel_generate_mipmap_2d(GLcontext *ctx, success = GL_TRUE; fail: - intel_meta_restore_fragment_program(intel); - intel_meta_restore_vertex_program(intel); + meta_restore_fragment_program(&intel->meta); + meta_restore_vertex_program(&intel->meta); _mesa_DeleteFramebuffersEXT(1, &fb_name); _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 0d34f28311e..c985da5aa25 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -101,6 +101,7 @@ intel_miptree_create_internal(struct intel_context *intel, struct intel_mipmap_tree * intel_miptree_create(struct intel_context *intel, GLenum target, + GLenum base_format, GLenum internal_format, GLuint first_level, GLuint last_level, @@ -113,9 +114,14 @@ intel_miptree_create(struct intel_context *intel, uint32_t tiling; if (intel->use_texture_tiling && compress_byte == 0 && - intel->intelScreen->kernel_exec_fencing) - tiling = I915_TILING_X; - else + intel->intelScreen->kernel_exec_fencing) { + if (IS_965(intel->intelScreen->deviceID) && + (base_format == GL_DEPTH_COMPONENT || + base_format == GL_DEPTH_STENCIL_EXT)) + tiling = I915_TILING_Y; + else + tiling = I915_TILING_X; + } else tiling = I915_TILING_NONE; mt = intel_miptree_create_internal(intel, target, internal_format, @@ -347,23 +353,31 @@ intel_miptree_set_level_info(struct intel_mipmap_tree *mt, } - void -intel_miptree_set_image_offset(struct intel_mipmap_tree *mt, - GLuint level, GLuint img, - GLuint x, GLuint y) +intel_miptree_set_image_offset_ex(struct intel_mipmap_tree *mt, + GLuint level, GLuint img, + GLuint x, GLuint y, + GLuint offset) { if (img == 0 && level == 0) assert(x == 0 && y == 0); assert(img < mt->level[level].nr_images); - mt->level[level].image_offset[img] = (x + y * mt->pitch) * mt->cpp; + mt->level[level].image_offset[img] = (x + y * mt->pitch) * mt->cpp + offset; DBG("%s level %d img %d pos %d,%d image_offset %x\n", __FUNCTION__, level, img, x, y, mt->level[level].image_offset[img]); } +void +intel_miptree_set_image_offset(struct intel_mipmap_tree *mt, + GLuint level, GLuint img, + GLuint x, GLuint y) +{ + intel_miptree_set_image_offset_ex(mt, level, img, x, y, 0); +} + /* Although we use the image_offset[] array to store relative offsets * to cube faces, Mesa doesn't know anything about this and expects @@ -473,11 +487,11 @@ intel_miptree_image_data(struct intel_context *intel, 0, 0, /* source x, y */ dst->level[level].width, height); /* width, height */ - src += src_image_pitch * dst->cpp; + src = (char *)src + src_image_pitch * dst->cpp; } } -extern GLuint intel_compressed_alignment(GLenum); +extern void intel_get_texture_alignment_unit(GLenum, GLuint *, GLuint *); /* Copy mipmap image between trees */ void @@ -494,20 +508,37 @@ intel_miptree_image_copy(struct intel_context *intel, const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level); const GLuint *src_depth_offset = intel_miptree_depth_offsets(src, level); GLuint i; + GLboolean success; if (dst->compressed) { - GLuint alignment = intel_compressed_alignment(dst->internal_format); + GLuint align_w, align_h; + + intel_get_texture_alignment_unit(dst->internal_format, &align_w, &align_h); height = (height + 3) / 4; - width = ((width + alignment - 1) & ~(alignment - 1)); + width = ALIGN(width, align_w); } for (i = 0; i < depth; i++) { - intel_region_copy(intel, - dst->region, dst_offset + dst_depth_offset[i], - 0, - 0, - src->region, src_offset + src_depth_offset[i], - 0, 0, width, height); + success = intel_region_copy(intel, + dst->region, dst_offset + dst_depth_offset[i], + 0, 0, + src->region, src_offset + src_depth_offset[i], + 0, 0, width, height, GL_COPY); + if (!success) { + GLubyte *src_ptr, *dst_ptr; + + src_ptr = intel_region_map(intel, src->region); + dst_ptr = intel_region_map(intel, dst->region); + + _mesa_copy_rect(dst_ptr + dst_offset + dst_depth_offset[i], + dst->cpp, + dst->pitch, + 0, 0, width, height, + src_ptr + src_offset + src_depth_offset[i], + src->pitch, + 0, 0); + intel_region_unmap(intel, src->region); + intel_region_unmap(intel, dst->region); + } } - } diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index 3af9966827f..c890b2a0d04 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -126,6 +126,7 @@ struct intel_mipmap_tree struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel, GLenum target, + GLenum base_format, GLenum internal_format, GLuint first_level, GLuint last_level, @@ -195,6 +196,11 @@ void intel_miptree_set_level_info(struct intel_mipmap_tree *mt, GLuint x, GLuint y, GLuint w, GLuint h, GLuint d); +void intel_miptree_set_image_offset_ex(struct intel_mipmap_tree *mt, + GLuint level, + GLuint img, GLuint x, GLuint y, + GLuint offset); + void intel_miptree_set_image_offset(struct intel_mipmap_tree *mt, GLuint level, GLuint img, GLuint x, GLuint y); diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index 36a684b3b85..a3001416559 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -177,246 +177,6 @@ intel_check_blit_format(struct intel_region * region, } void -intel_meta_set_passthrough_transform(struct intel_context *intel) -{ - GLcontext *ctx = &intel->ctx; - - intel->meta.saved_vp_x = ctx->Viewport.X; - intel->meta.saved_vp_y = ctx->Viewport.Y; - intel->meta.saved_vp_width = ctx->Viewport.Width; - intel->meta.saved_vp_height = ctx->Viewport.Height; - intel->meta.saved_matrix_mode = ctx->Transform.MatrixMode; - - intel->internal_viewport_call = GL_TRUE; - _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); - intel->internal_viewport_call = GL_FALSE; - - _mesa_MatrixMode(GL_PROJECTION); - _mesa_PushMatrix(); - _mesa_LoadIdentity(); - _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1); - - _mesa_MatrixMode(GL_MODELVIEW); - _mesa_PushMatrix(); - _mesa_LoadIdentity(); -} - -void -intel_meta_restore_transform(struct intel_context *intel) -{ - _mesa_MatrixMode(GL_PROJECTION); - _mesa_PopMatrix(); - _mesa_MatrixMode(GL_MODELVIEW); - _mesa_PopMatrix(); - - _mesa_MatrixMode(intel->meta.saved_matrix_mode); - - intel->internal_viewport_call = GL_TRUE; - _mesa_Viewport(intel->meta.saved_vp_x, intel->meta.saved_vp_y, - intel->meta.saved_vp_width, intel->meta.saved_vp_height); - intel->internal_viewport_call = GL_FALSE; -} - -/** - * Set up a vertex program to pass through the position and first texcoord - * for pixel path. - */ -void -intel_meta_set_passthrough_vertex_program(struct intel_context *intel) -{ - GLcontext *ctx = &intel->ctx; - static const char *vp = - "!!ARBvp1.0\n" - "TEMP vertexClip;\n" - "DP4 vertexClip.x, state.matrix.mvp.row[0], vertex.position;\n" - "DP4 vertexClip.y, state.matrix.mvp.row[1], vertex.position;\n" - "DP4 vertexClip.z, state.matrix.mvp.row[2], vertex.position;\n" - "DP4 vertexClip.w, state.matrix.mvp.row[3], vertex.position;\n" - "MOV result.position, vertexClip;\n" - "MOV result.texcoord[0], vertex.texcoord[0];\n" - "MOV result.color, vertex.color;\n" - "END\n"; - - assert(intel->meta.saved_vp == NULL); - - _mesa_reference_vertprog(ctx, &intel->meta.saved_vp, - ctx->VertexProgram.Current); - if (intel->meta.passthrough_vp == NULL) { - GLuint prog_name; - _mesa_GenPrograms(1, &prog_name); - _mesa_BindProgram(GL_VERTEX_PROGRAM_ARB, prog_name); - _mesa_ProgramStringARB(GL_VERTEX_PROGRAM_ARB, - GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(vp), (const GLubyte *)vp); - _mesa_reference_vertprog(ctx, &intel->meta.passthrough_vp, - ctx->VertexProgram.Current); - _mesa_DeletePrograms(1, &prog_name); - } - - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, - intel->meta.passthrough_vp); - ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, - &intel->meta.passthrough_vp->Base); - - intel->meta.saved_vp_enable = ctx->VertexProgram.Enabled; - _mesa_Enable(GL_VERTEX_PROGRAM_ARB); -} - -/** - * Restores the previous vertex program after - * intel_meta_set_passthrough_vertex_program() - */ -void -intel_meta_restore_vertex_program(struct intel_context *intel) -{ - GLcontext *ctx = &intel->ctx; - - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, - intel->meta.saved_vp); - _mesa_reference_vertprog(ctx, &intel->meta.saved_vp, NULL); - ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, - &ctx->VertexProgram.Current->Base); - - if (!intel->meta.saved_vp_enable) - _mesa_Disable(GL_VERTEX_PROGRAM_ARB); -} - -/** - * Binds the given program string to GL_FRAGMENT_PROGRAM_ARB, caching the - * program object. - */ -void -intel_meta_set_fragment_program(struct intel_context *intel, - struct gl_fragment_program **prog, - const char *prog_string) -{ - GLcontext *ctx = &intel->ctx; - assert(intel->meta.saved_fp == NULL); - - _mesa_reference_fragprog(ctx, &intel->meta.saved_fp, - ctx->FragmentProgram.Current); - if (*prog == NULL) { - GLuint prog_name; - _mesa_GenPrograms(1, &prog_name); - _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, prog_name); - _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, - GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog_string), (const GLubyte *)prog_string); - _mesa_reference_fragprog(ctx, prog, ctx->FragmentProgram.Current); - /* Note that DeletePrograms unbinds the program on us */ - _mesa_DeletePrograms(1, &prog_name); - } - - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, *prog); - ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, &((*prog)->Base)); - - intel->meta.saved_fp_enable = ctx->FragmentProgram.Enabled; - _mesa_Enable(GL_FRAGMENT_PROGRAM_ARB); -} - -/** - * Restores the previous fragment program after - * intel_meta_set_fragment_program() - */ -void -intel_meta_restore_fragment_program(struct intel_context *intel) -{ - GLcontext *ctx = &intel->ctx; - - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, - intel->meta.saved_fp); - _mesa_reference_fragprog(ctx, &intel->meta.saved_fp, NULL); - ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, - &ctx->FragmentProgram.Current->Base); - - if (!intel->meta.saved_fp_enable) - _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); -} - -static const float default_texcoords[4][2] = { { 0.0, 0.0 }, - { 1.0, 0.0 }, - { 1.0, 1.0 }, - { 0.0, 1.0 } }; - -void -intel_meta_set_default_texrect(struct intel_context *intel) -{ - GLcontext *ctx = &intel->ctx; - struct gl_client_array *old_texcoord_array; - - intel->meta.saved_active_texture = ctx->Texture.CurrentUnit; - if (intel->meta.saved_array_vbo == NULL) { - _mesa_reference_buffer_object(ctx, &intel->meta.saved_array_vbo, - ctx->Array.ArrayBufferObj); - } - - old_texcoord_array = &ctx->Array.ArrayObj->TexCoord[0]; - intel->meta.saved_texcoord_type = old_texcoord_array->Type; - intel->meta.saved_texcoord_size = old_texcoord_array->Size; - intel->meta.saved_texcoord_stride = old_texcoord_array->Stride; - intel->meta.saved_texcoord_enable = old_texcoord_array->Enabled; - intel->meta.saved_texcoord_ptr = old_texcoord_array->Ptr; - _mesa_reference_buffer_object(ctx, &intel->meta.saved_texcoord_vbo, - old_texcoord_array->BufferObj); - - _mesa_ClientActiveTextureARB(GL_TEXTURE0); - - if (intel->meta.texcoord_vbo == NULL) { - GLuint vbo_name; - - _mesa_GenBuffersARB(1, &vbo_name); - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo_name); - _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(default_texcoords), - default_texcoords, GL_STATIC_DRAW_ARB); - _mesa_reference_buffer_object(ctx, &intel->meta.texcoord_vbo, - ctx->Array.ArrayBufferObj); - } else { - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, - intel->meta.texcoord_vbo->Name); - } - _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), NULL); - - _mesa_Enable(GL_TEXTURE_COORD_ARRAY); -} - -void -intel_meta_restore_texcoords(struct intel_context *intel) -{ - GLcontext *ctx = &intel->ctx; - - /* Restore the old TexCoordPointer */ - if (intel->meta.saved_texcoord_vbo) { - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, - intel->meta.saved_texcoord_vbo->Name); - _mesa_reference_buffer_object(ctx, &intel->meta.saved_texcoord_vbo, NULL); - } else { - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - } - - _mesa_TexCoordPointer(intel->meta.saved_texcoord_size, - intel->meta.saved_texcoord_type, - intel->meta.saved_texcoord_stride, - intel->meta.saved_texcoord_ptr); - if (!intel->meta.saved_texcoord_enable) - _mesa_Disable(GL_TEXTURE_COORD_ARRAY); - - _mesa_ClientActiveTextureARB(GL_TEXTURE0 + - intel->meta.saved_active_texture); - - if (intel->meta.saved_array_vbo) { - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, - intel->meta.saved_array_vbo->Name); - _mesa_reference_buffer_object(ctx, &intel->meta.saved_array_vbo, NULL); - } else { - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - } -} - -void intelInitPixelFuncs(struct dd_function_table *functions) { functions->Accum = _swrast_Accum; @@ -424,20 +184,7 @@ intelInitPixelFuncs(struct dd_function_table *functions) functions->Bitmap = intelBitmap; functions->CopyPixels = intelCopyPixels; functions->DrawPixels = intelDrawPixels; -#ifdef I915 - functions->ReadPixels = intelReadPixels; -#endif } -} - -void -intel_free_pixel_state(struct intel_context *intel) -{ - GLcontext *ctx = &intel->ctx; - - _mesa_reference_vertprog(ctx, &intel->meta.passthrough_vp, NULL); - _mesa_reference_fragprog(ctx, &intel->meta.bitmap_fp, NULL); - _mesa_reference_fragprog(ctx, &intel->meta.tex2d_fp, NULL); - _mesa_reference_buffer_object(ctx, &intel->meta.texcoord_vbo, NULL); + functions->ReadPixels = intelReadPixels; } diff --git a/src/mesa/drivers/dri/intel/intel_pixel.h b/src/mesa/drivers/dri/intel/intel_pixel.h index 6acf0813c8c..96a6dd17b25 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.h +++ b/src/mesa/drivers/dri/intel/intel_pixel.h @@ -31,19 +31,6 @@ #include "main/mtypes.h" void intelInitPixelFuncs(struct dd_function_table *functions); -void intel_meta_set_passthrough_transform(struct intel_context *intel); -void intel_meta_restore_transform(struct intel_context *intel); -void intel_meta_set_passthrough_vertex_program(struct intel_context *intel); -void intel_meta_restore_vertex_program(struct intel_context *intel); -void intel_meta_set_fragment_program(struct intel_context *intel, - struct gl_fragment_program **prog, - const char *prog_string); -void intel_meta_restore_fragment_program(struct intel_context *intel); -void intel_free_pixel_state(struct intel_context *intel); -void intel_meta_set_default_texrect(struct intel_context *intel); -void intel_meta_set_default_texrect(struct intel_context *intel); -void intel_meta_restore_texcoords(struct intel_context *intel); - GLboolean intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one); @@ -79,6 +66,4 @@ void intelBitmap(GLcontext * ctx, const struct gl_pixelstore_attrib *unpack, const GLubyte * pixels); -void intel_clear_tris(GLcontext *ctx, GLbitfield mask); - #endif diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 80d3239189c..540e7620a9d 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -42,6 +42,7 @@ #include "main/varray.h" #include "main/attrib.h" #include "main/enable.h" +#include "main/viewport.h" #include "shader/arbprogram.h" #include "glapi/dispatch.h" #include "swrast/swrast.h" @@ -194,7 +195,7 @@ do_blit_bitmap( GLcontext *ctx, struct gl_framebuffer *fb = ctx->DrawBuffer; GLfloat tmpColor[4]; GLubyte ubcolor[4]; - GLuint color8888, color565; + GLuint color; unsigned int num_cliprects; drm_clip_rect_t *cliprects; int x_off, y_off; @@ -232,8 +233,11 @@ do_blit_bitmap( GLcontext *ctx, UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[2], tmpColor[2]); UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[3], tmpColor[3]); - color8888 = INTEL_PACKCOLOR8888(ubcolor[0], ubcolor[1], ubcolor[2], ubcolor[3]); - color565 = INTEL_PACKCOLOR565(ubcolor[0], ubcolor[1], ubcolor[2]); + if (dst->cpp == 2) + color = INTEL_PACKCOLOR565(ubcolor[0], ubcolor[1], ubcolor[2]); + else + color = INTEL_PACKCOLOR8888(ubcolor[0], ubcolor[1], + ubcolor[2], ubcolor[3]); if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F)) return GL_FALSE; @@ -307,21 +311,21 @@ do_blit_bitmap( GLcontext *ctx, fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0) continue; - /* - */ - intelEmitImmediateColorExpandBlit( intel, - dst->cpp, - (GLubyte *)stipple, - sz, - (dst->cpp == 2) ? color565 : color8888, - dst->pitch, - dst->buffer, - 0, - dst->tiling, - box_x + px, - box_y + py, - w, h, - logic_op); + if (!intelEmitImmediateColorExpandBlit(intel, + dst->cpp, + (GLubyte *)stipple, + sz, + color, + dst->pitch, + dst->buffer, + 0, + dst->tiling, + box_x + px, + box_y + py, + w, h, + logic_op)) { + return GL_FALSE; + } } } } @@ -408,6 +412,12 @@ intel_texture_bitmap(GLcontext * ctx, return GL_FALSE; } + if (ctx->Fog.Enabled) { + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, "glBitmap() fallback: fog\n"); + return GL_FALSE; + } + /* Check that we can load in a texture this big. */ if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) || height > (1 << (ctx->Const.MaxTextureLevels - 1))) { @@ -466,15 +476,18 @@ intel_texture_bitmap(GLcontext * ctx, GL_ALPHA, GL_UNSIGNED_BYTE, a8_bitmap); _mesa_free(a8_bitmap); - intel_meta_set_fragment_program(intel, &intel->meta.bitmap_fp, fp); + meta_set_fragment_program(&intel->meta, &intel->meta.bitmap_fp, fp); _mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, ctx->Current.RasterColor); - intel_meta_set_passthrough_vertex_program(intel); - intel_meta_set_passthrough_transform(intel); + meta_set_passthrough_vertex_program(&intel->meta); + meta_set_passthrough_transform(&intel->meta); /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */ dst_z = -1.0 + 2.0 * ctx->Current.RasterPos[2]; + /* RasterPos[2] already takes into account the DepthRange mapping. */ + _mesa_DepthRange(0.0, 1.0); + vertices[0][0] = dst_x; vertices[0][1] = dst_y; vertices[0][2] = dst_z; @@ -494,13 +507,13 @@ intel_texture_bitmap(GLcontext * ctx, _mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices); _mesa_Enable(GL_VERTEX_ARRAY); - intel_meta_set_default_texrect(intel); - CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); + meta_set_default_texrect(&intel->meta); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - intel_meta_restore_texcoords(intel); - intel_meta_restore_transform(intel); - intel_meta_restore_fragment_program(intel); - intel_meta_restore_vertex_program(intel); + meta_restore_texcoords(&intel->meta); + meta_restore_transform(&intel->meta); + meta_restore_fragment_program(&intel->meta); + meta_restore_vertex_program(&intel->meta); _mesa_PopClientAttrib(); _mesa_Disable(GL_TEXTURE_2D); /* asserted that it was disabled at entry */ diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index d50dd68092d..5d52335dee3 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -272,6 +272,12 @@ do_blit_copypixels(GLcontext * ctx, drm_clip_rect_t *cliprects; int x_off, y_off; + if (type == GL_DEPTH || type == GL_STENCIL) { + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, "glCopyPixels() fallback: GL_DEPTH || GL_STENCIL\n"); + return GL_FALSE; + } + /* Update draw buffer bounds */ _mesa_update_state(ctx); @@ -362,14 +368,16 @@ do_blit_copypixels(GLcontext * ctx, &clip_x, &clip_y, &clip_w, &clip_h)) continue; - intelEmitCopyBlit(intel, dst->cpp, - src->pitch, src->buffer, 0, src->tiling, - dst->pitch, dst->buffer, 0, dst->tiling, - clip_x + delta_x, clip_y + delta_y, /* srcx, srcy */ - clip_x, clip_y, /* dstx, dsty */ - clip_w, clip_h, - ctx->Color.ColorLogicOpEnabled ? - ctx->Color.LogicOp : GL_COPY); + if (!intel_region_copy(intel, + dst, 0, clip_x, clip_y, + src, 0, clip_x + delta_x, clip_y + delta_y, + clip_w, clip_h, + ctx->Color.ColorLogicOpEnabled ? + ctx->Color.LogicOp : GL_COPY)) { + DBG("%s: blit failure\n", __FUNCTION__); + UNLOCK_HARDWARE(intel); + return GL_FALSE; + } } } out: diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 46d27f1a93a..a6b6824164a 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -45,6 +45,7 @@ #include "main/depth.h" #include "main/hash.h" #include "main/blend.h" +#include "main/viewport.h" #include "glapi/dispatch.h" #include "swrast/swrast.h" @@ -128,7 +129,7 @@ intel_texture_drawpixels(GLcontext * ctx, } _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | - GL_CURRENT_BIT); + GL_CURRENT_BIT | GL_VIEWPORT_BIT); _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); /* XXX: pixel store stuff */ @@ -149,11 +150,14 @@ intel_texture_drawpixels(GLcontext * ctx, _mesa_TexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, pixels); - intel_meta_set_passthrough_transform(intel); + meta_set_passthrough_transform(&intel->meta); /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */ z = -1.0 + 2.0 * ctx->Current.RasterPos[2]; + /* RasterPos[2] already takes into account the DepthRange mapping. */ + _mesa_DepthRange(0.0, 1.0); + /* Create the vertex buffer based on the current raster pos. The x and y * we're handed are ctx->Current.RasterPos[0,1] rounded to integers. * We also apply the depth. However, the W component is already multiplied @@ -178,12 +182,12 @@ intel_texture_drawpixels(GLcontext * ctx, _mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices); _mesa_Enable(GL_VERTEX_ARRAY); - intel_meta_set_default_texrect(intel); + meta_set_default_texrect(&intel->meta); - CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - intel_meta_restore_texcoords(intel); - intel_meta_restore_transform(intel); + meta_restore_texcoords(&intel->meta); + meta_restore_transform(&intel->meta); _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); _mesa_PopClientAttrib(); @@ -211,8 +215,9 @@ intel_stencil_drawpixels(GLcontext * ctx, struct gl_renderbuffer *rb; struct gl_pixelstore_attrib old_unpack; GLstencil *stencil_pixels; - int row; + int row, y1, y2; GLint old_active_texture; + GLboolean rendering_to_fbo = ctx->DrawBuffer->Name != 0; if (format != GL_STENCIL_INDEX) return GL_FALSE; @@ -347,24 +352,35 @@ intel_stencil_drawpixels(GLcontext * ctx, ctx->Unpack = old_unpack; _mesa_free(stencil_pixels); - intel_meta_set_passthrough_transform(intel); + meta_set_passthrough_transform(&intel->meta); + + /* Since we're rendering to the framebuffer as if it was an FBO, + * if it's the window system we have to flip the coordinates. + */ + if (rendering_to_fbo) { + y1 = y; + y2 = y + height * ctx->Pixel.ZoomY; + } else { + y1 = irb->Base.Height - (y + height * ctx->Pixel.ZoomY); + y2 = irb->Base.Height - y; + } vertices[0][0] = x; - vertices[0][1] = y; + vertices[0][1] = y1; vertices[1][0] = x + width * ctx->Pixel.ZoomX; - vertices[1][1] = y; + vertices[1][1] = y1; vertices[2][0] = x + width * ctx->Pixel.ZoomX; - vertices[2][1] = y + height * ctx->Pixel.ZoomY; + vertices[2][1] = y2; vertices[3][0] = x; - vertices[3][1] = y + height * ctx->Pixel.ZoomY; + vertices[3][1] = y2; _mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices); _mesa_Enable(GL_VERTEX_ARRAY); - intel_meta_set_default_texrect(intel); + meta_set_default_texrect(&intel->meta); - CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - intel_meta_restore_texcoords(intel); - intel_meta_restore_transform(intel); + meta_restore_texcoords(&intel->meta); + meta_restore_transform(&intel->meta); _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, old_fb_name); diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c new file mode 100644 index 00000000000..8713463ace2 --- /dev/null +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -0,0 +1,324 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * 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 TUNGSTEN GRAPHICS 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/glheader.h" +#include "main/enums.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/image.h" +#include "main/bufferobj.h" +#include "main/state.h" +#include "swrast/swrast.h" + +#include "intel_screen.h" +#include "intel_context.h" +#include "intel_batchbuffer.h" +#include "intel_blit.h" +#include "intel_buffers.h" +#include "intel_regions.h" +#include "intel_pixel.h" +#include "intel_buffer_objects.h" + +/* For many applications, the new ability to pull the source buffers + * back out of the GTT and then do the packing/conversion operations + * in software will be as much of an improvement as trying to get the + * blitter and/or texture engine to do the work. + * + * This step is gated on private backbuffers. + * + * Obviously the frontbuffer can't be pulled back, so that is either + * an argument for blit/texture readpixels, or for blitting to a + * temporary and then pulling that back. + * + * When the destination is a pbo, however, it's not clear if it is + * ever going to be pulled to main memory (though the access param + * will be a good hint). So it sounds like we do want to be able to + * choose between blit/texture implementation on the gpu and pullback + * and cpu-based copying. + * + * Unless you can magically turn client memory into a PBO for the + * duration of this call, there will be a cpu-based copying step in + * any case. + */ + + +static GLboolean +do_texture_readpixels(GLcontext * ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *pack, + struct intel_region *dest_region) +{ +#if 0 + struct intel_context *intel = intel_context(ctx); + intelScreenPrivate *screen = intel->intelScreen; + GLint pitch = pack->RowLength ? pack->RowLength : width; + __DRIdrawablePrivate *dPriv = intel->driDrawable; + int textureFormat; + GLenum glTextureFormat; + int destFormat, depthFormat, destPitch; + drm_clip_rect_t tmp; + + if (INTEL_DEBUG & DEBUG_PIXEL) + fprintf(stderr, "%s\n", __FUNCTION__); + + + if (ctx->_ImageTransferState || + pack->SwapBytes || pack->LsbFirst || !pack->Invert) { + if (INTEL_DEBUG & DEBUG_PIXEL) + fprintf(stderr, "%s: check_color failed\n", __FUNCTION__); + return GL_FALSE; + } + + intel->vtbl.meta_texrect_source(intel, intel_readbuf_region(intel)); + + if (!intel->vtbl.meta_render_dest(intel, dest_region, type, format)) { + if (INTEL_DEBUG & DEBUG_PIXEL) + fprintf(stderr, "%s: couldn't set dest %s/%s\n", + __FUNCTION__, + _mesa_lookup_enum_by_nr(type), + _mesa_lookup_enum_by_nr(format)); + return GL_FALSE; + } + + LOCK_HARDWARE(intel); + + if (intel->driDrawable->numClipRects) { + intel->vtbl.install_meta_state(intel); + intel->vtbl.meta_no_depth_write(intel); + intel->vtbl.meta_no_stencil_write(intel); + + if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) { + UNLOCK_HARDWARE(intel); + SET_STATE(i830, state); + if (INTEL_DEBUG & DEBUG_PIXEL) + fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__); + return GL_TRUE; + } + + y = dPriv->h - y - height; + x += dPriv->x; + y += dPriv->y; + + + /* Set the frontbuffer up as a large rectangular texture. + */ + intel->vtbl.meta_tex_rect_source(intel, src_region, textureFormat); + + + intel->vtbl.meta_texture_blend_replace(i830, glTextureFormat); + + + /* Set the 3d engine to draw into the destination region: + */ + + intel->vtbl.meta_draw_region(intel, dest_region); + intel->vtbl.meta_draw_format(intel, destFormat, depthFormat); /* ?? */ + + + /* Draw a single quad, no cliprects: + */ + intel->vtbl.meta_disable_cliprects(intel); + + intel->vtbl.draw_quad(intel, + 0, width, 0, height, + 0x00ff00ff, x, x + width, y, y + height); + + intel->vtbl.leave_meta_state(intel); + } + UNLOCK_HARDWARE(intel); + + intel_region_wait_fence(ctx, dest_region); /* required by GL */ + return GL_TRUE; +#endif + + return GL_FALSE; +} + + + + +static GLboolean +do_blit_readpixels(GLcontext * ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *pack, GLvoid * pixels) +{ + struct intel_context *intel = intel_context(ctx); + struct intel_region *src = intel_readbuf_region(intel); + struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj); + GLuint dst_offset; + GLuint rowLength; + + if (INTEL_DEBUG & DEBUG_PIXEL) + _mesa_printf("%s\n", __FUNCTION__); + + if (!src) + return GL_FALSE; + + if (pack->BufferObj->Name) { + /* XXX This validation should be done by core mesa: + */ + if (!_mesa_validate_pbo_access(2, pack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels"); + return GL_TRUE; + } + } + else { + /* PBO only for now: + */ + if (INTEL_DEBUG & DEBUG_PIXEL) + _mesa_printf("%s - not PBO\n", __FUNCTION__); + return GL_FALSE; + } + + + if (ctx->_ImageTransferState || + !intel_check_blit_format(src, format, type)) { + if (INTEL_DEBUG & DEBUG_PIXEL) + _mesa_printf("%s - bad format for blit\n", __FUNCTION__); + return GL_FALSE; + } + + if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) { + if (INTEL_DEBUG & DEBUG_PIXEL) + _mesa_printf("%s: bad packing params\n", __FUNCTION__); + return GL_FALSE; + } + + if (pack->RowLength > 0) + rowLength = pack->RowLength; + else + rowLength = width; + + if (pack->Invert) { + if (INTEL_DEBUG & DEBUG_PIXEL) + _mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__); + return GL_FALSE; + } + else { + rowLength = -rowLength; + } + + /* XXX 64-bit cast? */ + dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height, + format, type, 0, 0, 0); + + + /* Although the blits go on the command buffer, need to do this and + * fire with lock held to guarentee cliprects are correct. + */ + intelFlush(&intel->ctx); + LOCK_HARDWARE(intel); + + if (intel->driDrawable->numClipRects) { + GLboolean all = (width * height * src->cpp == dst->Base.Size && + x == 0 && dst_offset == 0); + + dri_bo *dst_buffer = intel_bufferobj_buffer(intel, dst, + all ? INTEL_WRITE_FULL : + INTEL_WRITE_PART); + __DRIdrawablePrivate *dPriv = intel->driDrawable; + int nbox = dPriv->numClipRects; + drm_clip_rect_t *box = dPriv->pClipRects; + drm_clip_rect_t rect; + drm_clip_rect_t src_rect; + int i; + + src_rect.x1 = dPriv->x + x; + src_rect.y1 = dPriv->y + dPriv->h - (y + height); + src_rect.x2 = src_rect.x1 + width; + src_rect.y2 = src_rect.y1 + height; + + + + for (i = 0; i < nbox; i++) { + if (!intel_intersect_cliprects(&rect, &src_rect, &box[i])) + continue; + + if (!intelEmitCopyBlit(intel, + src->cpp, + src->pitch, src->buffer, 0, src->tiling, + rowLength, dst_buffer, dst_offset, GL_FALSE, + rect.x1, + rect.y1, + rect.x1 - src_rect.x1, + rect.y2 - src_rect.y2, + rect.x2 - rect.x1, rect.y2 - rect.y1, + GL_COPY)) { + UNLOCK_HARDWARE(intel); + return GL_FALSE; + } + } + } + UNLOCK_HARDWARE(intel); + + if (INTEL_DEBUG & DEBUG_PIXEL) + _mesa_printf("%s - DONE\n", __FUNCTION__); + + return GL_TRUE; +} + +void +intelReadPixels(GLcontext * ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *pack, GLvoid * pixels) +{ + if (INTEL_DEBUG & DEBUG_PIXEL) + fprintf(stderr, "%s\n", __FUNCTION__); + + intelFlush(ctx); + +#ifdef I915 + if (do_blit_readpixels + (ctx, x, y, width, height, format, type, pack, pixels)) + return; + + if (do_texture_readpixels + (ctx, x, y, width, height, format, type, pack, pixels)) + return; +#else + (void)do_blit_readpixels; + (void)do_texture_readpixels; +#endif + + if (INTEL_DEBUG & DEBUG_PIXEL) + _mesa_printf("%s: fallback to swrast\n", __FUNCTION__); + + /* Update Mesa state before calling down into _swrast_ReadPixels, as + * the spans code requires the computed buffer states to be up to date, + * but _swrast_ReadPixels only updates Mesa state after setting up + * the spans code. + */ + + if (ctx->NewState) + _mesa_update_state(ctx); + + _swrast_ReadPixels(ctx, x, y, width, height, format, type, pack, pixels); +} diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 49bcb3c1ddd..7525cd9c4d7 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -111,12 +111,15 @@ debug_backtrace(void) GLubyte * intel_region_map(struct intel_context *intel, struct intel_region *region) { + intelFlush(&intel->ctx); + _DBG("%s %p\n", __FUNCTION__, region); if (!region->map_refcount++) { if (region->pbo) intel_region_cow(intel, region); - if (intel->intelScreen->kernel_exec_fencing) + if (region->tiling != I915_TILING_NONE && + intel->intelScreen->kernel_exec_fencing) drm_intel_gem_bo_map_gtt(region->buffer); else dri_bo_map(region->buffer, GL_TRUE); @@ -131,7 +134,8 @@ intel_region_unmap(struct intel_context *intel, struct intel_region *region) { _DBG("%s %p\n", __FUNCTION__, region); if (!--region->map_refcount) { - if (intel->intelScreen->kernel_exec_fencing) + if (region->tiling != I915_TILING_NONE && + intel->intelScreen->kernel_exec_fencing) drm_intel_gem_bo_unmap_gtt(region->buffer); else dri_bo_unmap(region->buffer); @@ -189,7 +193,7 @@ intel_region_alloc(struct intel_context *intel, pitch, buffer); if (tiling != I915_TILING_NONE) { - assert(((pitch * cpp) & 511) == 0); + assert(((pitch * cpp) & 127) == 0); drm_intel_bo_set_tiling(buffer, &tiling, pitch * cpp); drm_intel_bo_get_tiling(buffer, ®ion->tiling, ®ion->bit_6_swizzle); } @@ -323,8 +327,6 @@ intel_region_data(struct intel_context *intel, const void *src, GLuint src_pitch, GLuint srcx, GLuint srcy, GLuint width, GLuint height) { - GLboolean locked = GL_FALSE; - _DBG("%s\n", __FUNCTION__); if (intel == NULL) @@ -338,39 +340,33 @@ intel_region_data(struct intel_context *intel, intel_region_cow(intel, dst); } - if (!intel->locked) { - LOCK_HARDWARE(intel); - locked = GL_TRUE; - } - + LOCK_HARDWARE(intel); _mesa_copy_rect(intel_region_map(intel, dst) + dst_offset, dst->cpp, dst->pitch, dstx, dsty, width, height, src, src_pitch, srcx, srcy); intel_region_unmap(intel, dst); - - if (locked) - UNLOCK_HARDWARE(intel); - + UNLOCK_HARDWARE(intel); } /* Copy rectangular sub-regions. Need better logic about when to * push buffers into AGP - will currently do so whenever possible. */ -void +GLboolean intel_region_copy(struct intel_context *intel, struct intel_region *dst, GLuint dst_offset, GLuint dstx, GLuint dsty, struct intel_region *src, GLuint src_offset, - GLuint srcx, GLuint srcy, GLuint width, GLuint height) + GLuint srcx, GLuint srcy, GLuint width, GLuint height, + GLenum logicop) { _DBG("%s\n", __FUNCTION__); if (intel == NULL) - return; + return GL_FALSE; if (dst->pbo) { if (dstx == 0 && @@ -382,41 +378,12 @@ intel_region_copy(struct intel_context *intel, assert(src->cpp == dst->cpp); - intelEmitCopyBlit(intel, - dst->cpp, - src->pitch, src->buffer, src_offset, src->tiling, - dst->pitch, dst->buffer, dst_offset, dst->tiling, - srcx, srcy, dstx, dsty, width, height, - GL_COPY); -} - -/* Fill a rectangular sub-region. Need better logic about when to - * push buffers into AGP - will currently do so whenever possible. - */ -void -intel_region_fill(struct intel_context *intel, - struct intel_region *dst, - GLuint dst_offset, - GLuint dstx, GLuint dsty, - GLuint width, GLuint height, GLuint color) -{ - _DBG("%s\n", __FUNCTION__); - - if (intel == NULL) - return; - - if (dst->pbo) { - if (dstx == 0 && - dsty == 0 && width == dst->pitch && height == dst->height) - intel_region_release_pbo(intel, dst); - else - intel_region_cow(intel, dst); - } - - intelEmitFillBlit(intel, - dst->cpp, - dst->pitch, dst->buffer, dst_offset, dst->tiling, - dstx, dsty, width, height, color); + return intelEmitCopyBlit(intel, + dst->cpp, + src->pitch, src->buffer, src_offset, src->tiling, + dst->pitch, dst->buffer, dst_offset, dst->tiling, + srcx, srcy, dstx, dsty, width, height, + logicop); } /* Attach to a pbo, discarding our data. Effectively zero-copy upload @@ -427,6 +394,8 @@ intel_region_attach_pbo(struct intel_context *intel, struct intel_region *region, struct intel_buffer_object *pbo) { + dri_bo *buffer; + if (region->pbo == pbo) return; @@ -447,10 +416,13 @@ intel_region_attach_pbo(struct intel_context *intel, region->buffer = NULL; } + /* make sure pbo has a buffer of its own */ + buffer = intel_bufferobj_buffer(intel, pbo, INTEL_WRITE_FULL); + region->pbo = pbo; region->pbo->region = region; - dri_bo_reference(pbo->buffer); - region->buffer = pbo->buffer; + dri_bo_reference(buffer); + region->buffer = buffer; } @@ -480,10 +452,6 @@ void intel_region_cow(struct intel_context *intel, struct intel_region *region) { struct intel_buffer_object *pbo = region->pbo; - GLboolean was_locked = intel->locked; - - if (intel == NULL) - return; intel_region_release_pbo(intel, region); @@ -494,20 +462,15 @@ intel_region_cow(struct intel_context *intel, struct intel_region *region) /* Now blit from the texture buffer to the new buffer: */ - was_locked = intel->locked; - if (!was_locked) - LOCK_HARDWARE(intel); - - intelEmitCopyBlit(intel, - region->cpp, - region->pitch, region->buffer, 0, region->tiling, - region->pitch, pbo->buffer, 0, region->tiling, - 0, 0, 0, 0, - region->pitch, region->height, - GL_COPY); - - if (!was_locked) - UNLOCK_HARDWARE(intel); + LOCK_HARDWARE(intel); + assert(intelEmitCopyBlit(intel, + region->cpp, + region->pitch, pbo->buffer, 0, region->tiling, + region->pitch, region->buffer, 0, region->tiling, + 0, 0, 0, 0, + region->pitch, region->height, + GL_COPY)); + UNLOCK_HARDWARE(intel); } dri_bo * diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index bd3c8e7325b..0d379bdc6e2 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -110,21 +110,15 @@ void intel_region_data(struct intel_context *intel, /* Copy rectangular sub-regions */ -void intel_region_copy(struct intel_context *intel, - struct intel_region *dest, - GLuint dest_offset, - GLuint destx, GLuint desty, - struct intel_region *src, - GLuint src_offset, - GLuint srcx, GLuint srcy, GLuint width, GLuint height); - -/* Fill a rectangular sub-region - */ -void intel_region_fill(struct intel_context *intel, - struct intel_region *dest, - GLuint dest_offset, - GLuint destx, GLuint desty, - GLuint width, GLuint height, GLuint color); +GLboolean +intel_region_copy(struct intel_context *intel, + struct intel_region *dest, + GLuint dest_offset, + GLuint destx, GLuint desty, + struct intel_region *src, + GLuint src_offset, + GLuint srcx, GLuint srcy, GLuint width, GLuint height, + GLenum logicop); /* Helpers for zerocopy uploads, particularly texture image uploads: */ diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 8da96ede644..6bbc995c1e6 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -69,11 +69,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_DESC_END DRI_CONF_OPT_END -#ifdef I915 - DRI_CONF_TEXTURE_TILING(false) -#else - DRI_CONF_TEXTURE_TILING(true) -#endif + DRI_CONF_TEXTURE_TILING(false) DRI_CONF_OPT_BEGIN(early_z, bool, false) DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).") @@ -320,7 +316,7 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv) dri_bufmgr_destroy(intelScreen->bufmgr); intelUnmapScreenRegions(intelScreen); - driDestroyOptionCache(&intelScreen->optionCache); + driDestroyOptionInfo(&intelScreen->optionCache); FREE(intelScreen); sPriv->private = NULL; @@ -410,6 +406,30 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, static void intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv) { + struct intel_framebuffer *intel_fb = driDrawPriv->driverPrivate; + struct intel_renderbuffer *depth_rb; + struct intel_renderbuffer *stencil_rb; + + if (intel_fb) { + if (intel_fb->color_rb[0]) { + intel_renderbuffer_set_region(intel_fb->color_rb[0], NULL); + } + + if (intel_fb->color_rb[1]) { + intel_renderbuffer_set_region(intel_fb->color_rb[1], NULL); + } + + depth_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH); + if (depth_rb) { + intel_renderbuffer_set_region(depth_rb, NULL); + } + + stencil_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); + if (stencil_rb) { + intel_renderbuffer_set_region(stencil_rb, NULL); + } + } + _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } @@ -578,7 +598,7 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen) GLboolean gem_supported; struct drm_i915_getparam gp; __DRIscreenPrivate *spriv = intelScreen->driScrnPriv; - int num_fences; + int num_fences = 0; intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL; diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 260235b1eb1..028b49c14d3 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -73,11 +73,8 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat) return NULL; case GL_RGBA: case GL_RGBA8: - return intel_readbuf_region(intel); case GL_RGB: - if (intel->ctx.Visual.rgbBits == 16) - return intel_readbuf_region(intel); - return NULL; + return intel_readbuf_region(intel); default: return NULL; } @@ -99,14 +96,24 @@ do_copy_texsubimage(struct intel_context *intel, if (!intelImage->mt || !src) { if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "%s fail %p %p\n", - __FUNCTION__, intelImage->mt, src); + fprintf(stderr, "%s fail %p %p (0x%08x)\n", + __FUNCTION__, intelImage->mt, src, internalFormat); + return GL_FALSE; + } + + if (intelImage->mt->cpp != src->cpp) { + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, "%s fail %d vs %d cpp\n", + __FUNCTION__, intelImage->mt->cpp, src->cpp); return GL_FALSE; } intelFlush(ctx); LOCK_HARDWARE(intel); { + drm_intel_bo *dst_bo = intel_region_buffer(intel, + intelImage->mt->region, + INTEL_WRITE_PART); GLuint image_offset = intel_miptree_image_offset(intelImage->mt, intelImage->face, intelImage->level); @@ -144,18 +151,21 @@ do_copy_texsubimage(struct intel_context *intel, src_pitch = src->pitch; } - intelEmitCopyBlit(intel, - intelImage->mt->cpp, - src_pitch, - src->buffer, - 0, - src->tiling, - intelImage->mt->pitch, - intelImage->mt->region->buffer, - image_offset, - intelImage->mt->region->tiling, - x, y, dstx, dsty, width, height, - GL_COPY); + if (!intelEmitCopyBlit(intel, + intelImage->mt->cpp, + src_pitch, + src->buffer, + 0, + src->tiling, + intelImage->mt->pitch, + dst_bo, + image_offset, + intelImage->mt->region->tiling, + x, y, dstx, dsty, width, height, + GL_COPY)) { + UNLOCK_HARDWARE(intel); + return GL_FALSE; + } } UNLOCK_HARDWARE(intel); diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index e9a3823078a..c5f52208376 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -131,6 +131,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat); intelObj->mt = intel_miptree_create(intel, intelObj->base.Target, + intelImage->base._BaseFormat, intelImage->base.InternalFormat, firstLevel, lastLevel, @@ -205,7 +206,7 @@ try_pbo_upload(struct intel_context *intel, GLuint src_offset, src_stride; GLuint dst_offset, dst_stride; - if (!pbo || + if (unpack->BufferObj->Name == 0 || intel->ctx._ImageTransferState || unpack->SkipPixels || unpack->SkipRows) { DBG("%s: failure 1\n", __FUNCTION__); @@ -235,12 +236,15 @@ try_pbo_upload(struct intel_context *intel, INTEL_WRITE_FULL); - intelEmitCopyBlit(intel, - intelImage->mt->cpp, - src_stride, src_buffer, src_offset, GL_FALSE, - dst_stride, dst_buffer, dst_offset, GL_FALSE, - 0, 0, 0, 0, width, height, - GL_COPY); + if (!intelEmitCopyBlit(intel, + intelImage->mt->cpp, + src_stride, src_buffer, src_offset, GL_FALSE, + dst_stride, dst_buffer, dst_offset, GL_FALSE, + 0, 0, 0, 0, width, height, + GL_COPY)) { + UNLOCK_HARDWARE(intel); + return GL_FALSE; + } } UNLOCK_HARDWARE(intel); @@ -260,7 +264,7 @@ try_pbo_zcopy(struct intel_context *intel, GLuint src_offset, src_stride; GLuint dst_offset, dst_stride; - if (!pbo || + if (unpack->BufferObj->Name == 0 || intel->ctx._ImageTransferState || unpack->SkipPixels || unpack->SkipRows) { DBG("%s: failure 1\n", __FUNCTION__); @@ -409,7 +413,9 @@ intelTexImage(GLcontext * ctx, * a miptree, so create one just for our level and store it in the image. * It'll get moved into the object miptree at validate time. */ - intelImage->mt = intel_miptree_create(intel, target, internalFormat, + intelImage->mt = intel_miptree_create(intel, target, + intelImage->base.TexFormat->BaseFormat, + internalFormat, level, level, width, height, depth, intelImage->base.TexFormat->TexelBytes, @@ -421,7 +427,7 @@ intelTexImage(GLcontext * ctx, */ if (dims <= 2 && intelImage->mt && - intel_buffer_object(unpack->BufferObj) && + unpack->BufferObj->Name != 0 && check_pbo_format(internalFormat, format, type, intelImage->base.TexFormat)) { diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c b/src/mesa/drivers/dri/intel/intel_tex_layout.c index 2c1b722b7f5..7d69ea4484a 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c @@ -35,28 +35,39 @@ #include "intel_context.h" #include "main/macros.h" -GLuint intel_compressed_alignment(GLenum internalFormat) +void intel_get_texture_alignment_unit(GLenum internalFormat, GLuint *w, GLuint *h) { - GLuint alignment = 4; - switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: - alignment = 8; + *w = 8; + *h = 4; + break; + + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + *w = 4; + *h = 4; break; default: + *w = 4; + *h = 2; break; } - - return alignment; } void i945_miptree_layout_2d( struct intel_context *intel, struct intel_mipmap_tree *mt, uint32_t tiling ) { - GLint align_h = 2, align_w = 4; + GLuint align_h = 2, align_w = 4; GLuint level; GLuint x = 0; GLuint y = 0; @@ -64,9 +75,9 @@ void i945_miptree_layout_2d( struct intel_context *intel, GLuint height = mt->height0; mt->pitch = mt->width0; + intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h); if (mt->compressed) { - align_w = intel_compressed_alignment(mt->internal_format); mt->pitch = ALIGN(mt->width0, align_w); } diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.h b/src/mesa/drivers/dri/intel/intel_tex_layout.h index 7bc25b6bcb1..c9de9b56784 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.h +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.h @@ -41,4 +41,4 @@ static GLuint minify( GLuint d ) extern void i945_miptree_layout_2d(struct intel_context *intel, struct intel_mipmap_tree *mt, uint32_t tiling); -extern GLuint intel_compressed_alignment(GLenum); +extern void intel_get_texture_alignment_unit(GLenum, GLuint *, GLuint *); diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index b5cb7597d16..a284d5475f4 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -199,6 +199,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) if (!intelObj->mt) { intelObj->mt = intel_miptree_create(intel, intelObj->base.Target, + firstImage->base._BaseFormat, firstImage->base.InternalFormat, intelObj->firstLevel, intelObj->lastLevel, diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index 451dcd1b553..4ae7bf5b97d 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -771,6 +771,11 @@ static void r128DDLightModelfv( GLcontext *ctx, GLenum pname, FLUSH_BATCH( rmesa ); updateSpecularLighting(ctx); } + + if ( pname == GL_LIGHT_MODEL_TWO_SIDE ) { + FLUSH_BATCH( rmesa ); + r128ChooseRenderState( ctx ); + } } static void r128DDShadeModel( GLcontext *ctx, GLenum mode ) diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c index bcc9ffa651e..5b91271d740 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.c +++ b/src/mesa/drivers/dri/r128/r128_tris.c @@ -426,7 +426,7 @@ r128_fallback_point( r128ContextPtr rmesa, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) #define _R128_NEW_RENDER_STATE (ANY_FALLBACK_FLAGS | ANY_RASTER_FLAGS) -static void r128ChooseRenderState(GLcontext *ctx) +void r128ChooseRenderState(GLcontext *ctx) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; diff --git a/src/mesa/drivers/dri/r128/r128_tris.h b/src/mesa/drivers/dri/r128/r128_tris.h index d90ca31534e..c0667edb61f 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.h +++ b/src/mesa/drivers/dri/r128/r128_tris.h @@ -38,7 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/mtypes.h" extern void r128InitTriFuncs( GLcontext *ctx ); - +extern void r128ChooseRenderState( GLcontext *ctx ); extern void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) r128Fallback( rmesa->glCtx, bit, mode ) diff --git a/src/mesa/drivers/dri/r200/.gitignore b/src/mesa/drivers/dri/r200/.gitignore index 3773d8ea73f..2f9cd1a987b 100644 --- a/src/mesa/drivers/dri/r200/.gitignore +++ b/src/mesa/drivers/dri/r200/.gitignore @@ -1,3 +1,15 @@ +radeon_bocs_wrapper.h +radeon_bo_legacy.[ch] radeon_chipset.h -radeon_screen.* +radeon_cmdbuf.h +radeon_common.[ch] +radeon_common_context.[ch] +radeon_cs_legacy.[ch] +radeon_dma.[ch] +radeon_fbo.c +radeon_lock.[ch] +radeon_mipmap_tree.[ch] +radeon_screen.[ch] +radeon_span.[ch] +radeon_texture.[ch] server diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile index 6a246edf7cb..4686241957b 100644 --- a/src/mesa/drivers/dri/r200/Makefile +++ b/src/mesa/drivers/dri/r200/Makefile @@ -13,6 +13,10 @@ ifeq ($(USING_EGL), 1) EGL_SOURCES = server/radeon_egl.c endif +ifeq ($(RADEON_LDFLAGS),) +CS_SOURCES = radeon_cs_space_drm.c +endif + RADEON_COMMON_SOURCES = \ radeon_texture.c \ radeon_common_context.c \ @@ -42,7 +46,8 @@ DRIVER_SOURCES = r200_context.c \ r200_vertprog.c \ radeon_screen.c \ $(EGL_SOURCES) \ - $(RADEON_COMMON_SOURCES) + $(RADEON_COMMON_SOURCES) \ + $(CS_SOURCES) C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES) @@ -82,7 +87,8 @@ COMMON_SYMLINKS = \ radeon_texture.h \ radeon_dma.c \ radeon_dma.h \ - radeon_fbo.c + radeon_fbo.c \ + $(CS_SOURCES) DRI_LIB_DEPS += $(RADEON_LDFLAGS) diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index df9dd83344c..25e30eda522 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -225,6 +225,7 @@ GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa, GLuint min_nr ) { GLushort *retval; + int ret; if (R200_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s %d prim %x\n", __FUNCTION__, min_nr, primitive); @@ -239,10 +240,11 @@ GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa, rmesa->radeon.tcl.elt_dma_offset = 0; rmesa->tcl.elt_used = min_nr * 2; - radeon_validate_bo(&rmesa->radeon, rmesa->radeon.tcl.elt_dma_bo, - RADEON_GEM_DOMAIN_GTT, 0); - if (radeon_revalidate_bos(rmesa->radeon.glCtx) == GL_FALSE) + ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, rmesa->radeon.tcl.elt_dma_bo, + RADEON_GEM_DOMAIN_GTT, 0); + if (ret) { fprintf(stderr,"failure to revalidate BOs - badness\n"); + } radeon_bo_map(rmesa->radeon.tcl.elt_dma_bo, 1); retval = rmesa->radeon.tcl.elt_dma_bo->ptr + rmesa->radeon.tcl.elt_dma_offset; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 8924849d082..9a92a320797 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -357,6 +357,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, /* FIXME: When no memory manager is available we should set this * to some reasonable value based on texture memory pool size */ ctx->Const.MaxTextureLevels = 12; + ctx->Const.Max3DTextureLevels = 9; + ctx->Const.MaxCubeTextureLevels = 12; + ctx->Const.MaxTextureRectSize = 2048; ctx->Const.MaxTextureMaxAnisotropy = 16.0; @@ -388,6 +391,8 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, ctx->Const.MaxDrawBuffers = 1; + _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); + /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext( ctx ); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 0b3398a730e..4dbda39eb95 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -58,11 +58,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define R200_TIMEOUT 512 #define R200_IDLE_RETRY 16 -static void r200UserClear(GLcontext *ctx, GLuint mask) -{ - radeon_clear_tris(ctx, mask); -} - static void r200KernelClear(GLcontext *ctx, GLuint flags) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -196,7 +191,10 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask ) GLuint orig_mask = mask; if ( R200_DEBUG & DEBUG_IOCTL ) { - fprintf( stderr, "r200Clear %x %d\n", mask, rmesa->radeon.sarea->pfCurrentPage); + if (rmesa->radeon.sarea) + fprintf( stderr, "r200Clear %x %d\n", mask, rmesa->radeon.sarea->pfCurrentPage); + else + fprintf( stderr, "r200Clear %x radeon->sarea is NULL\n", mask); } { @@ -250,7 +248,7 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask ) } if (rmesa->radeon.radeonScreen->kernel_mm) - r200UserClear(ctx, orig_mask); + radeonUserClear(ctx, orig_mask); else { r200KernelClear(ctx, flags); rmesa->radeon.hw.all_dirty = GL_TRUE; diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index f8ebe0df57e..5a6fd20d8c2 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -574,6 +574,10 @@ static void r200FrontFace( GLcontext *ctx, GLenum mode ) R200_STATECHANGE( rmesa, tcl ); rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_CULL_FRONT_IS_CCW; + /* Winding is inverted when rendering to FBO */ + if (ctx->DrawBuffer && ctx->DrawBuffer->Name) + mode = (mode == GL_CW) ? GL_CCW : GL_CW; + switch ( mode ) { case GL_CW: rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_FFACE_CULL_CW; @@ -709,14 +713,20 @@ static void r200ColorMask( GLcontext *ctx, GLboolean b, GLboolean a ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint mask = radeonPackColor( rmesa->radeon.radeonScreen->cpp, - ctx->Color.ColorMask[RCOMP], - ctx->Color.ColorMask[GCOMP], - ctx->Color.ColorMask[BCOMP], - ctx->Color.ColorMask[ACOMP] ); - + GLuint mask; + struct radeon_renderbuffer *rrb; GLuint flag = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] & ~R200_PLANE_MASK_ENABLE; + rrb = radeon_get_colorbuffer(&rmesa->radeon); + if (!rrb) + return; + mask = radeonPackColor( rrb->cpp, + ctx->Color.ColorMask[RCOMP], + ctx->Color.ColorMask[GCOMP], + ctx->Color.ColorMask[BCOMP], + ctx->Color.ColorMask[ACOMP] ); + + if (!(r && g && b && a)) flag |= R200_PLANE_MASK_ENABLE; @@ -1720,11 +1730,16 @@ static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLubyte color[4]; + struct radeon_renderbuffer *rrb; + + rrb = radeon_get_colorbuffer(&rmesa->radeon); + if (!rrb) + return; CLAMPED_FLOAT_TO_UBYTE(color[0], c[0]); CLAMPED_FLOAT_TO_UBYTE(color[1], c[1]); CLAMPED_FLOAT_TO_UBYTE(color[2], c[2]); CLAMPED_FLOAT_TO_UBYTE(color[3], c[3]); - rmesa->radeon.state.color.clear = radeonPackColor( rmesa->radeon.radeonScreen->cpp, + rmesa->radeon.state.color.clear = radeonPackColor( rrb->cpp, color[0], color[1], color[2], color[3] ); } @@ -2274,23 +2289,23 @@ static GLboolean r200ValidateBuffers(GLcontext *ctx) { r200ContextPtr rmesa = R200_CONTEXT(ctx); struct radeon_renderbuffer *rrb; - int i; + int i, ret; - radeon_validate_reset_bos(&rmesa->radeon); + radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs); rrb = radeon_get_colorbuffer(&rmesa->radeon); /* color buffer */ if (rrb && rrb->bo) { - radeon_validate_bo(&rmesa->radeon, rrb->bo, - 0, RADEON_GEM_DOMAIN_VRAM); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, rrb->bo, + 0, RADEON_GEM_DOMAIN_VRAM); } /* depth buffer */ rrb = radeon_get_depthbuffer(&rmesa->radeon); /* color buffer */ if (rrb && rrb->bo) { - radeon_validate_bo(&rmesa->radeon, rrb->bo, - 0, RADEON_GEM_DOMAIN_VRAM); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, rrb->bo, + 0, RADEON_GEM_DOMAIN_VRAM); } for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { @@ -2301,17 +2316,17 @@ static GLboolean r200ValidateBuffers(GLcontext *ctx) t = radeon_tex_obj(ctx->Texture.Unit[i]._Current); if (t->image_override && t->bo) - radeon_validate_bo(&rmesa->radeon, t->bo, + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, t->bo, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); else if (t->mt->bo) - radeon_validate_bo(&rmesa->radeon, t->mt->bo, + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, t->mt->bo, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); } - if (rmesa->radeon.dma.current) - radeon_validate_bo(&rmesa->radeon, rmesa->radeon.dma.current, RADEON_GEM_DOMAIN_GTT, 0); - - return radeon_revalidate_bos(ctx); + ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, rmesa->radeon.dma.current, RADEON_GEM_DOMAIN_GTT, 0); + if (ret) + return GL_FALSE; + return GL_TRUE; } GLboolean r200ValidateState( GLcontext *ctx ) diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 83920093378..bc871d99048 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -484,8 +484,17 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) atom->cmd[CTX_RB3D_CNTL] &= ~(0xf << 10); if (rrb->cpp == 4) atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB8888; - else + else switch (rrb->base._ActualFormat) { + case GL_RGB5: atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_RGB565; + break; + case GL_RGBA4: + atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB4444; + break; + case GL_RGB5_A1: + atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB1555; + break; + } cbpitch = (rrb->pitch / rrb->cpp); if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) @@ -585,6 +594,8 @@ static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) radeon_mipmap_level *lvl; int hastexture = 1; + if (!r200->state.texture.unit[i].unitneeded) + hastexture = 0; if (!t) hastexture = 0; else { @@ -620,6 +631,30 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); + uint32_t dwords = 3; + int i = atom->idx, j; + radeonTexObj *t = r200->state.texture.unit[i].texobj; + radeon_mipmap_level *lvl; + + BEGIN_BATCH_NO_AUTOSTATE(dwords + (3 * 5)); + /* XXX that size won't really match with image_override... */ + OUT_BATCH_TABLE(atom->cmd, 2); + + if (t && !t->image_override) { + lvl = &t->mt->levels[0]; + OUT_BATCH_TABLE((atom->cmd + 2), 1); + for (j = 1; j <= 5; j++) { + OUT_BATCH_RELOC(lvl->faces[j].offset, t->mt->bo, lvl->faces[j].offset, + RADEON_GEM_DOMAIN_VRAM, 0, 0); + } + } + END_BATCH(); +} + +static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +{ + r200ContextPtr r200 = R200_CONTEXT(ctx); + BATCH_LOCALS(&r200->radeon); uint32_t dwords = 2; int i = atom->idx, j; radeonTexObj *t = r200->state.texture.unit[i].texobj; @@ -752,7 +787,10 @@ void r200InitState( r200ContextPtr rmesa ) ALLOC_STATE( cube[4], tex_cube, CUBE_STATE_SIZE, "CUBE/tex-4", 4 ); ALLOC_STATE( cube[5], tex_cube, CUBE_STATE_SIZE, "CUBE/tex-5", 5 ); for (i = 0; i < 5; i++) - rmesa->hw.cube[i].emit = cube_emit; + if (rmesa->radeon.radeonScreen->kernel_mm) + rmesa->hw.cube[i].emit = cube_emit_cs; + else + rmesa->hw.cube[i].emit = cube_emit; } else { ALLOC_STATE( cube[0], never, CUBE_STATE_SIZE, "CUBE/tex-0", 0 ); diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index ed1995e147c..4e53672aee2 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -834,7 +834,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo rImage->mt = NULL; } _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->width, rb->height, 1, 0, rb->cpp); + rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx, internalFormat, @@ -866,8 +866,8 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo t->pp_txfilter |= tx_table_le[MESA_FORMAT_RGB565].filter; break; } - t->pp_txsize = ((rb->width - 1) << RADEON_TEX_USIZE_SHIFT) - | ((rb->height - 1) << RADEON_TEX_VSIZE_SHIFT); + t->pp_txsize = ((rb->base.Width - 1) << RADEON_TEX_USIZE_SHIFT) + | ((rb->base.Height - 1) << RADEON_TEX_VSIZE_SHIFT); t->pp_txformat |= R200_TXFORMAT_NON_POWER2; t->pp_txpitch = pitch_val; t->pp_txpitch -= 32; diff --git a/src/mesa/drivers/dri/r300/.gitignore b/src/mesa/drivers/dri/r300/.gitignore index 3689a6a78e5..2f9cd1a987b 100644 --- a/src/mesa/drivers/dri/r300/.gitignore +++ b/src/mesa/drivers/dri/r300/.gitignore @@ -1,4 +1,15 @@ +radeon_bocs_wrapper.h +radeon_bo_legacy.[ch] radeon_chipset.h +radeon_cmdbuf.h +radeon_common.[ch] +radeon_common_context.[ch] +radeon_cs_legacy.[ch] +radeon_dma.[ch] +radeon_fbo.c +radeon_lock.[ch] +radeon_mipmap_tree.[ch] radeon_screen.[ch] -radeon_span.h +radeon_span.[ch] +radeon_texture.[ch] server diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index bdb09624be4..a77209074ae 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -13,6 +13,10 @@ ifeq ($(USING_EGL), 1) EGL_SOURCES = server/radeon_egl.c endif +ifeq ($(RADEON_LDFLAGS),) +CS_SOURCES = radeon_cs_space_drm.c +endif + COMMON_SOURCES = \ ../../common/driverfuncs.c \ ../common/mm.c \ @@ -59,7 +63,8 @@ DRIVER_SOURCES = \ r300_emit.c \ r300_swtcl.c \ $(RADEON_COMMON_SOURCES) \ - $(EGL_SOURCES) + $(EGL_SOURCES) \ + $(CS_SOURCES) C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES) @@ -100,7 +105,8 @@ COMMON_SYMLINKS = \ radeon_mipmap_tree.h \ radeon_texture.c \ radeon_texture.h \ - radeon_fbo.c + radeon_fbo.c \ + $(CS_SOURCES) DRI_LIB_DEPS += $(RADEON_LDFLAGS) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 0261a5b1d8a..af535037d06 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -232,8 +232,8 @@ void r300_emit_scissor(GLcontext *ctx) } else { x1 = 0; y1 = 0; - x2 = rrb->width - 1; - y2 = rrb->height - 1; + x2 = rrb->base.Width - 1; + y2 = rrb->base.Height - 1; } if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) { x1 += R300_SCISSORS_OFFSET; @@ -264,11 +264,22 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) return; } + if (RADEON_DEBUG & DEBUG_STATE) + fprintf(stderr,"rrb is %p %d %dx%d\n", rrb, offset, rrb->base.Width, rrb->base.Height); cbpitch = (rrb->pitch / rrb->cpp); if (rrb->cpp == 4) cbpitch |= R300_COLOR_FORMAT_ARGB8888; - else + else switch (rrb->base._ActualFormat) { + case GL_RGB5: cbpitch |= R300_COLOR_FORMAT_RGB565; + break; + case GL_RGBA4: + cbpitch |= R300_COLOR_FORMAT_ARGB4444; + break; + case GL_RGB5_A1: + cbpitch |= R300_COLOR_FORMAT_ARGB1555; + break; + } if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) cbpitch |= R300_COLOR_TILE_ENABLE; @@ -289,14 +300,14 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) BEGIN_BATCH_NO_AUTOSTATE(3); OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); OUT_BATCH(0); - OUT_BATCH(((rrb->width - 1) << R300_SCISSORS_X_SHIFT) | - ((rrb->height - 1) << R300_SCISSORS_Y_SHIFT)); + OUT_BATCH(((rrb->base.Width - 1) << R300_SCISSORS_X_SHIFT) | + ((rrb->base.Height - 1) << R300_SCISSORS_Y_SHIFT)); END_BATCH(); BEGIN_BATCH_NO_AUTOSTATE(16); for (i = 0; i < 4; i++) { OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); OUT_BATCH((0 << R300_CLIPRECT_X_SHIFT) | (0 << R300_CLIPRECT_Y_SHIFT)); - OUT_BATCH(((rrb->width - 1) << R300_CLIPRECT_X_SHIFT) | ((rrb->height - 1) << R300_CLIPRECT_Y_SHIFT)); + OUT_BATCH(((rrb->base.Width - 1) << R300_CLIPRECT_X_SHIFT) | ((rrb->base.Height - 1) << R300_CLIPRECT_Y_SHIFT)); } OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); OUT_BATCH(0xAAAA); @@ -308,15 +319,15 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); OUT_BATCH((R300_SCISSORS_OFFSET << R300_SCISSORS_X_SHIFT) | (R300_SCISSORS_OFFSET << R300_SCISSORS_Y_SHIFT)); - OUT_BATCH(((rrb->width + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_X_SHIFT) | - ((rrb->height + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_Y_SHIFT)); + OUT_BATCH(((rrb->base.Width + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_X_SHIFT) | + ((rrb->base.Height + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_Y_SHIFT)); END_BATCH(); BEGIN_BATCH_NO_AUTOSTATE(16); for (i = 0; i < 4; i++) { OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); OUT_BATCH((R300_SCISSORS_OFFSET << R300_CLIPRECT_X_SHIFT) | (R300_SCISSORS_OFFSET << R300_CLIPRECT_Y_SHIFT)); - OUT_BATCH(((R300_SCISSORS_OFFSET + rrb->width - 1) << R300_CLIPRECT_X_SHIFT) | - ((R300_SCISSORS_OFFSET + rrb->height - 1) << R300_CLIPRECT_Y_SHIFT)); + OUT_BATCH(((R300_SCISSORS_OFFSET + rrb->base.Width - 1) << R300_CLIPRECT_X_SHIFT) | + ((R300_SCISSORS_OFFSET + rrb->base.Height - 1) << R300_CLIPRECT_Y_SHIFT)); } OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); OUT_BATCH(0xAAAA); @@ -333,23 +344,33 @@ static void emit_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) BATCH_LOCALS(&r300->radeon); struct radeon_renderbuffer *rrb; uint32_t zbpitch; + uint32_t dw; rrb = radeon_get_depthbuffer(&r300->radeon); if (!rrb) return; zbpitch = (rrb->pitch / rrb->cpp); - if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) { - zbpitch |= R300_DEPTHMACROTILE_ENABLE; - } - if (rrb->bo->flags & RADEON_BO_FLAGS_MICRO_TILE){ - zbpitch |= R300_DEPTHMICROTILE_TILED; + if (!r300->radeon.radeonScreen->kernel_mm) { + if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) { + zbpitch |= R300_DEPTHMACROTILE_ENABLE; + } + if (rrb->bo->flags & RADEON_BO_FLAGS_MICRO_TILE){ + zbpitch |= R300_DEPTHMICROTILE_TILED; + } } - BEGIN_BATCH_NO_AUTOSTATE(6); + dw = 6; + if (r300->radeon.radeonScreen->kernel_mm) + dw += 2; + BEGIN_BATCH_NO_AUTOSTATE(dw); OUT_BATCH_REGSEQ(R300_ZB_DEPTHOFFSET, 1); OUT_BATCH_RELOC(0, rrb->bo, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); - OUT_BATCH_REGVAL(R300_ZB_DEPTHPITCH, zbpitch); + OUT_BATCH_REGSEQ(R300_ZB_DEPTHPITCH, 1); + if (!r300->radeon.radeonScreen->kernel_mm) + OUT_BATCH(zbpitch); + else + OUT_BATCH_RELOC(cbpitch, rrb->bo, zbpitch, 0, RADEON_GEM_DOMAIN_VRAM, 0); END_BATCH(); } @@ -503,7 +524,7 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.vap_cntl.cmd[R300_VAP_CNTL_FLUSH] = cmdpacket0(r300->radeon.radeonScreen, R300_VAP_PVS_STATE_FLUSH_REG, 1); r300->hw.vap_cntl.cmd[R300_VAP_CNTL_FLUSH_1] = 0; r300->hw.vap_cntl.cmd[R300_VAP_CNTL_CMD] = cmdpacket0(r300->radeon.radeonScreen, R300_VAP_CNTL, 1); - if (is_r500) { + if (is_r500 && !r300->radeon.radeonScreen->kernel_mm) { ALLOC_STATE(vap_index_offset, always, 2, 0); r300->hw.vap_index_offset.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R500_VAP_INDEX_OFFSET, 1); r300->hw.vap_index_offset.cmd[1] = 0; diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 394521a051f..6f3aab986d2 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -124,6 +124,7 @@ const struct dri_extension card_extensions[] = { {"GL_EXT_texture_lod_bias", NULL}, {"GL_EXT_texture_mirror_clamp", NULL}, {"GL_EXT_texture_rectangle", NULL}, + {"GL_EXT_texture_sRGB", NULL}, {"GL_EXT_vertex_array_bgra", NULL}, {"GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions}, {"GL_ATI_texture_env_combine3", NULL}, @@ -269,10 +270,16 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) ctx->Const.MaxTextureMaxAnisotropy = 16.0; ctx->Const.MaxTextureLodBias = 16.0; - if (screen->chip_family >= CHIP_FAMILY_RV515) + if (screen->chip_family >= CHIP_FAMILY_RV515) { ctx->Const.MaxTextureLevels = 13; - else + ctx->Const.MaxCubeTextureLevels = 13; + ctx->Const.MaxTextureRectSize = 4096; + } + else { ctx->Const.MaxTextureLevels = 12; + ctx->Const.MaxCubeTextureLevels = 12; + ctx->Const.MaxTextureRectSize = 2048; + } ctx->Const.MinPointSize = 1.0; ctx->Const.MinPointSizeAA = 1.0; @@ -409,6 +416,8 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, r300InitConstValues(ctx, screen); + _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); + /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 026c33c67cb..f7af7d4e574 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -405,12 +405,13 @@ struct r300_hw_state { #undef TAG struct r300_vertex_program { + struct gl_vertex_program *Base; struct r300_vertex_program *next; struct r300_vertex_program_key { - GLuint InputsRead; - GLuint OutputsWritten; - GLuint OutputsAdded; + GLuint FpReads; + GLuint FogAttr; + GLuint WPosAttr; } key; struct r300_vertex_shader_hw_code { @@ -426,13 +427,17 @@ struct r300_vertex_program { int pos_end; int num_temporaries; /* Number of temp vars used by program */ - int wpos_idx; int inputs[VERT_ATTRIB_MAX]; int outputs[VERT_RESULT_MAX]; }; struct r300_vertex_program_cont { - struct gl_vertex_program mesa_program; /* Must be first */ + /* This is the unmodified vertex program mesa provided us with. + * We need to keep it unchanged because we may need to create another + * hw specific vertex program based on this. + */ + struct gl_vertex_program mesa_program; + /* This is the list of hw specific vertex programs derived from mesa_program */ struct r300_vertex_program *progs; }; @@ -546,7 +551,7 @@ struct r500_fragment_program_code { * to render with that program. */ struct r300_fragment_program { - struct gl_fragment_program Base; + struct gl_program *Base; GLboolean translated; GLboolean error; @@ -559,6 +564,23 @@ struct r300_fragment_program { GLboolean writes_depth; GLuint optimization; + + struct r300_fragment_program *next; + + /* attribute that we are sending the WPOS in */ + gl_frag_attrib wpos_attr; + /* attribute that we are sending the fog coordinate in */ + gl_frag_attrib fog_attr; +}; + +struct r300_fragment_program_cont { + /* This is the unmodified fragment program mesa provided us with. + * We need to keep it unchanged because we may need to create another + * hw specific fragment program based on this. + */ + struct gl_fragment_program Base; + /* This is the list of hw specific fragment programs derived from Base */ + struct r300_fragment_program *progs; }; struct r300_fragment_program_compiler { @@ -633,6 +655,7 @@ struct r300_context { struct r300_hw_state hw; struct r300_vertex_program *selected_vp; + struct r300_fragment_program *selected_fp; /* Vertex buffers */ @@ -664,11 +687,7 @@ extern GLboolean r300CreateContext(const __GLcontextModes * glVisual, __DRIcontextPrivate * driContextPriv, void *sharedContextPrivate); -extern void r300SelectVertexShader(r300ContextPtr r300); extern void r300InitShaderFuncs(struct dd_function_table *functions); -extern int r300VertexProgUpdateParams(GLcontext * ctx, - struct r300_vertex_program_cont *vp, - float *dst); extern void r300InitShaderFunctions(r300ContextPtr r300); diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c index cc5650fb7c8..9769ff53994 100644 --- a/src/mesa/drivers/dri/r300/r300_draw.c +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -195,6 +195,11 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st } GLfloat *dst_ptr, *tmp; + + /* Convert value for first element only */ + if (input->StrideB == 0) + count = 1; + tmp = dst_ptr = _mesa_malloc(sizeof(GLfloat) * input->Size * count); switch (input->Type) { @@ -228,13 +233,17 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st type = GL_FLOAT; r300_attr.free_needed = GL_TRUE; r300_attr.data = tmp; - r300_attr.stride = sizeof(GLfloat) * input->Size; + if (input->StrideB == 0) { + r300_attr.stride = 0; + } else { + r300_attr.stride = sizeof(GLfloat) * input->Size; + } r300_attr.dwords = input->Size; } else { type = input->Type; r300_attr.free_needed = GL_FALSE; r300_attr.data = (GLvoid *)src_ptr; - r300_attr.stride = stride; + r300_attr.stride = input->StrideB; r300_attr.dwords = (getTypeSize(type) * input->Size + 3)/ 4; } @@ -332,7 +341,7 @@ static void r300SetVertexFormat(GLcontext *ctx, const struct gl_client_array *ar { int i, tmp; - tmp = r300->selected_vp->key.InputsRead; + tmp = r300->selected_vp->Base->Base.InputsRead; i = 0; vbuf->num_attribs = 0; while (tmp) { @@ -417,12 +426,18 @@ static GLboolean r300TryDrawPrims(GLcontext *ctx, r300FixupIndexBuffer(ctx, ib, bo, &nr_bo); + /* ensure we have the cmd buf space in advance to cover + * the state + DMA AOS pointers */ + rcommonEnsureCmdBufSpace(&r300->radeon, + r300->radeon.hw.max_state_size + (50*sizeof(int)), + __FUNCTION__); + r300SetVertexFormat(ctx, arrays, max_index + 1, bo, &nr_bo); if (r300->fallback) return GL_FALSE; - r300SetupVAP(ctx, r300->selected_vp->key.InputsRead, r300->selected_vp->key.OutputsWritten); + r300SetupVAP(ctx, r300->selected_vp->Base->Base.InputsRead, r300->selected_vp->Base->Base.OutputsWritten); r300UpdateShaderStates(r300); @@ -442,8 +457,6 @@ static GLboolean r300TryDrawPrims(GLcontext *ctx, return GL_TRUE; } -/* TODO: rebase if number of indices in any of primitives is > 8192 for 32bit indices or 16384 for 16bit indices */ - static void r300DrawPrims(GLcontext *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, @@ -452,12 +465,25 @@ static void r300DrawPrims(GLcontext *ctx, GLuint min_index, GLuint max_index) { + struct split_limits limits; GLboolean retval; + if (ib) + limits.max_verts = 0xffffffff; + else + limits.max_verts = 65535; + + limits.max_indices = 65535; + limits.max_vb_size = 1024*1024; + if (min_index) { vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, r300DrawPrims ); return; } + if ((ib && ib->count > 65535)) { + vbo_split_prims (ctx, arrays, prim, nr_prims, ib, min_index, max_index, r300DrawPrims, &limits); + return; + } /* Make an attempt at drawing */ retval = r300TryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index c3817721dc4..feb3370f372 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -81,17 +81,17 @@ GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead) return vic_1; } -GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads) +GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes) { GLuint ret = 0; if (vp_writes & (1 << VERT_RESULT_HPOS)) ret |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; - if (vp_writes & (1 << VERT_RESULT_COL0) && fp_reads & FRAG_BIT_COL0) + if (vp_writes & (1 << VERT_RESULT_COL0)) ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT; - if (vp_writes & (1 << VERT_RESULT_COL1) && fp_reads & FRAG_BIT_COL1) + if (vp_writes & (1 << VERT_RESULT_COL1)) ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT; /* Two sided lighting works only if all 4 colors are written */ @@ -105,26 +105,17 @@ GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads) return ret; } -GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads) +GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes) { GLuint i, ret = 0, first_free_texcoord = 0; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (vp_writes & (1 << (VERT_RESULT_TEX0 + i)) && fp_reads & FRAG_BIT_TEX(i)) { + if (vp_writes & (1 << (VERT_RESULT_TEX0 + i))) { ret |= (4 << (3 * first_free_texcoord)); ++first_free_texcoord; } } - if (fp_reads & FRAG_BIT_WPOS) { - ret |= (4 << (3 * first_free_texcoord)); - ++first_free_texcoord; - } - - if (vp_writes & (1 << VERT_RESULT_FOGC) && fp_reads & FRAG_BIT_FOGC) { - ret |= 4 << (3 * first_free_texcoord); - } - if (first_free_texcoord > 8) { fprintf(stderr, "\tout of free texcoords\n"); _mesa_exit(-1); diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index 2fb8b82d3a1..3f8c60ffae1 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -225,7 +225,7 @@ extern void r300EmitCacheFlush(r300ContextPtr rmesa); extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead); extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead); -extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads); -extern GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads); +extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes); +extern GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes); #endif diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index abc8757ba1f..f5c4c0f4a0e 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -50,13 +50,6 @@ #include "radeon_program.h" #include "radeon_program_alu.h" -static void update_params(GLcontext *ctx, struct gl_fragment_program *fp) -{ - /* Ask Mesa nicely to fill in ParameterValues for us */ - if (fp->Base.Parameters) - _mesa_load_state_parameters(ctx, fp->Base.Parameters); -} - static void nqssadce_init(struct nqssadce_state* s) { s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW; @@ -74,10 +67,12 @@ static void nqssadce_init(struct nqssadce_state* s) */ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) { - GLuint InputsRead = compiler->fp->Base.Base.InputsRead; + GLuint InputsRead = compiler->fp->Base->InputsRead; - if (!(InputsRead & FRAG_BIT_WPOS)) + if (!(InputsRead & FRAG_BIT_WPOS)) { + compiler->fp->wpos_attr = FRAG_ATTRIB_MAX; return; + } static gl_state_index tokens[STATE_LENGTH] = { STATE_INTERNAL, STATE_R300_WINDOW_DIMENSION, 0, 0, 0 @@ -85,10 +80,23 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) struct prog_instruction *fpi; GLuint window_index; int i = 0; + + for (i = FRAG_ATTRIB_TEX0; i <= FRAG_ATTRIB_TEX7; ++i) + { + if (!(InputsRead & (1 << i))) { + InputsRead &= ~(1 << FRAG_ATTRIB_WPOS); + InputsRead |= 1 << i; + compiler->fp->Base->InputsRead = InputsRead; + compiler->fp->wpos_attr = i; + break; + } + } + GLuint tempregi = _mesa_find_free_register(compiler->program, PROGRAM_TEMPORARY); _mesa_insert_instructions(compiler->program, 0, 3); fpi = compiler->program->Instructions; + i = 0; /* perspective divide */ fpi[i].Opcode = OPCODE_RCP; @@ -99,7 +107,7 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) fpi[i].DstReg.CondMask = COND_TR; fpi[i].SrcReg[0].File = PROGRAM_INPUT; - fpi[i].SrcReg[0].Index = FRAG_ATTRIB_WPOS; + fpi[i].SrcReg[0].Index = compiler->fp->wpos_attr; fpi[i].SrcReg[0].Swizzle = SWIZZLE_WWWW; i++; @@ -111,7 +119,7 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) fpi[i].DstReg.CondMask = COND_TR; fpi[i].SrcReg[0].File = PROGRAM_INPUT; - fpi[i].SrcReg[0].Index = FRAG_ATTRIB_WPOS; + fpi[i].SrcReg[0].Index = compiler->fp->wpos_attr; fpi[i].SrcReg[0].Swizzle = SWIZZLE_XYZW; fpi[i].SrcReg[1].File = PROGRAM_TEMPORARY; @@ -154,6 +162,57 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) } } + +/** + * Rewrite fragment.fogcoord to use a texture coordinate slot. + * Note that fogcoord is forced into an X001 pattern, and this enforcement + * is done here. + * + * See also the counterpart rewriting for vertex programs. + */ +static void rewriteFog(struct r300_fragment_program_compiler *compiler) +{ + struct r300_fragment_program *fp = compiler->fp; + GLuint InputsRead; + int i; + + InputsRead = fp->Base->InputsRead; + + if (!(InputsRead & FRAG_BIT_FOGC)) { + fp->fog_attr = FRAG_ATTRIB_MAX; + return; + } + + for (i = FRAG_ATTRIB_TEX0; i <= FRAG_ATTRIB_TEX7; ++i) + { + if (!(InputsRead & (1 << i))) { + InputsRead &= ~(1 << FRAG_ATTRIB_FOGC); + InputsRead |= 1 << i; + fp->Base->InputsRead = InputsRead; + fp->fog_attr = i; + break; + } + } + + { + struct prog_instruction *inst; + + inst = compiler->program->Instructions; + while (inst->Opcode != OPCODE_END) { + const int src_regs = _mesa_num_inst_src_regs(inst->Opcode); + for (i = 0; i < src_regs; ++i) { + if (inst->SrcReg[i].File == PROGRAM_INPUT && inst->SrcReg[i].Index == FRAG_ATTRIB_FOGC) { + inst->SrcReg[i].Index = fp->fog_attr; + inst->SrcReg[i].Swizzle = combine_swizzles( + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE), + inst->SrcReg[i].Swizzle); + } + } + ++inst; + } + } +} + static GLuint build_dtm(GLuint depthmode) { switch(depthmode) { @@ -175,7 +234,7 @@ static GLuint build_func(GLuint comparefunc) */ static void build_state( r300ContextPtr r300, - struct r300_fragment_program *fp, + struct gl_fragment_program *fp, struct r300_fragment_program_external_state *state) { int unit; @@ -183,7 +242,7 @@ static void build_state( _mesa_bzero(state, sizeof(*state)); for(unit = 0; unit < 16; ++unit) { - if (fp->Base.Base.ShadowSamplers & (1 << unit)) { + if (fp->Base.ShadowSamplers & (1 << unit)) { struct gl_texture_object* tex = r300->radeon.glCtx->Texture.Unit[unit]._Current; state->unit[unit].depth_texture_mode = build_dtm(tex->DepthMode); @@ -192,100 +251,149 @@ static void build_state( } } -void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) +static void rewrite_depth_out(struct gl_program *prog) { - r300ContextPtr r300 = R300_CONTEXT(ctx); - struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)fp; - struct r300_fragment_program_external_state state; + struct prog_instruction *inst; - build_state(r300, r300_fp, &state); - if (_mesa_memcmp(&r300_fp->state, &state, sizeof(state))) { - /* TODO: cache compiled programs */ - r300_fp->translated = GL_FALSE; - _mesa_memcpy(&r300_fp->state, &state, sizeof(state)); - } - - if (!r300_fp->translated) { - struct r300_fragment_program_compiler compiler; + for (inst = prog->Instructions; inst->Opcode != OPCODE_END; ++inst) { + if (inst->DstReg.File != PROGRAM_OUTPUT || inst->DstReg.Index != FRAG_RESULT_DEPTH) + continue; - compiler.r300 = r300; - compiler.fp = r300_fp; - compiler.code = &r300_fp->code; - compiler.program = _mesa_clone_program(ctx, &fp->Base); + if (inst->DstReg.WriteMask & WRITEMASK_Z) { + inst->DstReg.WriteMask = WRITEMASK_W; + } else { + inst->DstReg.WriteMask = 0; + continue; + } - if (RADEON_DEBUG & DEBUG_PIXEL) { - fflush(stdout); - _mesa_printf("Fragment Program: Initial program:\n"); - _mesa_print_program(compiler.program); - fflush(stdout); + switch (inst->Opcode) { + case OPCODE_FRC: + case OPCODE_MOV: + inst->SrcReg[0] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[0]); + break; + case OPCODE_ADD: + case OPCODE_MAX: + case OPCODE_MIN: + case OPCODE_MUL: + inst->SrcReg[0] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[0]); + inst->SrcReg[1] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[1]); + break; + case OPCODE_CMP: + case OPCODE_MAD: + inst->SrcReg[0] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[0]); + inst->SrcReg[1] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[1]); + inst->SrcReg[2] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[2]); + break; + default: + // Scalar instructions needn't be reswizzled + break; } + } +} - insert_WPOS_trailer(&compiler); +void r300TranslateFragmentShader(GLcontext *ctx, struct r300_fragment_program *fp) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_fragment_program_compiler compiler; + + compiler.r300 = r300; + compiler.fp = fp; + compiler.code = &fp->code; + compiler.program = fp->Base; + + if (RADEON_DEBUG & DEBUG_PIXEL) { + fflush(stdout); + _mesa_printf("Fragment Program: Initial program:\n"); + _mesa_print_program(compiler.program); + fflush(stdout); + } - if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - struct radeon_program_transformation transformations[] = { - { &r500_transform_TEX, &compiler }, - { &radeonTransformALU, 0 }, - { &radeonTransformDeriv, 0 }, - { &radeonTransformTrigScale, 0 } - }; - radeonLocalTransform(ctx, compiler.program, 4, transformations); - } else { - struct radeon_program_transformation transformations[] = { - { &r300_transform_TEX, &compiler }, - { &radeonTransformALU, 0 }, - { &radeonTransformTrigSimple, 0 } - }; - radeonLocalTransform(ctx, compiler.program, 3, transformations); - } + insert_WPOS_trailer(&compiler); + + rewriteFog(&compiler); + + rewrite_depth_out(compiler.program); + + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + struct radeon_program_transformation transformations[] = { + { &r500_transform_TEX, &compiler }, + { &radeonTransformALU, 0 }, + { &radeonTransformDeriv, 0 }, + { &radeonTransformTrigScale, 0 } + }; + radeonLocalTransform(ctx, compiler.program, 4, transformations); + } else { + struct radeon_program_transformation transformations[] = { + { &r300_transform_TEX, &compiler }, + { &radeonTransformALU, 0 }, + { &radeonTransformTrigSimple, 0 } + }; + radeonLocalTransform(ctx, compiler.program, 3, transformations); + } - if (RADEON_DEBUG & DEBUG_PIXEL) { - _mesa_printf("Fragment Program: After native rewrite:\n"); - _mesa_print_program(compiler.program); - fflush(stdout); - } + if (RADEON_DEBUG & DEBUG_PIXEL) { + _mesa_printf("Fragment Program: After native rewrite:\n"); + _mesa_print_program(compiler.program); + fflush(stdout); + } - if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - struct radeon_nqssadce_descr nqssadce = { - .Init = &nqssadce_init, - .IsNativeSwizzle = &r500FPIsNativeSwizzle, - .BuildSwizzle = &r500FPBuildSwizzle, - .RewriteDepthOut = GL_TRUE - }; - radeonNqssaDce(ctx, compiler.program, &nqssadce); - } else { - struct radeon_nqssadce_descr nqssadce = { - .Init = &nqssadce_init, - .IsNativeSwizzle = &r300FPIsNativeSwizzle, - .BuildSwizzle = &r300FPBuildSwizzle, - .RewriteDepthOut = GL_TRUE - }; - radeonNqssaDce(ctx, compiler.program, &nqssadce); - } + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + struct radeon_nqssadce_descr nqssadce = { + .Init = &nqssadce_init, + .IsNativeSwizzle = &r500FPIsNativeSwizzle, + .BuildSwizzle = &r500FPBuildSwizzle + }; + radeonNqssaDce(ctx, compiler.program, &nqssadce); + } else { + struct radeon_nqssadce_descr nqssadce = { + .Init = &nqssadce_init, + .IsNativeSwizzle = &r300FPIsNativeSwizzle, + .BuildSwizzle = &r300FPBuildSwizzle + }; + radeonNqssaDce(ctx, compiler.program, &nqssadce); + } - if (RADEON_DEBUG & DEBUG_PIXEL) { - _mesa_printf("Compiler: after NqSSA-DCE:\n"); - _mesa_print_program(compiler.program); - fflush(stdout); - } + if (RADEON_DEBUG & DEBUG_PIXEL) { + _mesa_printf("Compiler: after NqSSA-DCE:\n"); + _mesa_print_program(compiler.program); + fflush(stdout); + } - if (!r300->vtbl.BuildFragmentProgramHwCode(&compiler)) - r300_fp->error = GL_TRUE; + if (!r300->vtbl.BuildFragmentProgramHwCode(&compiler)) + fp->error = GL_TRUE; - /* Subtle: Rescue any parameters that have been added during transformations */ - _mesa_free_parameter_list(fp->Base.Parameters); - fp->Base.Parameters = compiler.program->Parameters; - compiler.program->Parameters = 0; + fp->translated = GL_TRUE; - _mesa_reference_program(ctx, &compiler.program, NULL); + if (fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) + r300->vtbl.FragmentProgramDump(&fp->code); +} - r300_fp->translated = GL_TRUE; +struct r300_fragment_program *r300SelectFragmentShader(GLcontext *ctx) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_fragment_program_cont *fp_list; + struct r300_fragment_program *fp; + struct r300_fragment_program_external_state state; - r300UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + fp_list = (struct r300_fragment_program_cont *)ctx->FragmentProgram._Current; + build_state(r300, ctx->FragmentProgram._Current, &state); - if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) - r300->vtbl.FragmentProgramDump(&r300_fp->code); + fp = fp_list->progs; + while (fp) { + if (_mesa_memcmp(&fp->state, &state, sizeof(state)) == 0) { + return r300->selected_fp = fp; + } + fp = fp->next; } - update_params(ctx, fp); + fp = _mesa_calloc(sizeof(struct r300_fragment_program)); + + fp->state = state; + fp->translated = GL_FALSE; + fp->Base = _mesa_clone_program(ctx, &ctx->FragmentProgram._Current->Base); + + fp->next = fp_list->progs; + fp_list->progs = fp; + + return r300->selected_fp = fp; } diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.h b/src/mesa/drivers/dri/r300/r300_fragprog_common.h index 85ea86fecb1..5e103ee4086 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.h @@ -30,6 +30,10 @@ #include "main/mtypes.h" -extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); +#include "r300_context.h" + +extern void r300TranslateFragmentShader(GLcontext *ctx, struct r300_fragment_program *fp); + +struct r300_fragment_program *r300SelectFragmentShader(GLcontext *ctx); #endif diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 104079b4dbe..ddabd539925 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -68,11 +68,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static void r300EmitClearState(GLcontext * ctx); -static void r300UserClear(GLcontext *ctx, GLuint mask) -{ - radeon_clear_tris(ctx, mask); -} - static void r300ClearBuffer(r300ContextPtr r300, int flags, struct radeon_renderbuffer *rrb, struct radeon_renderbuffer *rrbd) @@ -540,19 +535,50 @@ static void r300EmitClearState(GLcontext * ctx) } } -static void r300KernelClear(GLcontext *ctx, GLuint flags) +static int r300KernelClear(GLcontext *ctx, GLuint flags) { r300ContextPtr r300 = R300_CONTEXT(ctx); __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); struct radeon_framebuffer *rfb = dPriv->driverPrivate; struct radeon_renderbuffer *rrb; struct radeon_renderbuffer *rrbd; - int bits = 0; + int bits = 0, ret; /* Make sure it fits there. */ + radeon_cs_space_reset_bos(r300->radeon.cmdbuf.cs); + + if (flags & BUFFER_BIT_COLOR0) { + rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_COLOR0); + radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, + rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM); + } + + if (flags & BUFFER_BIT_FRONT_LEFT) { + rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_FRONT_LEFT); + radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, + rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM); + } + + if (flags & BUFFER_BIT_BACK_LEFT) { + rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_BACK_LEFT); + radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, + rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM); + } + + rrbd = radeon_get_renderbuffer(&rfb->base, BUFFER_DEPTH); + if (rrbd) { + radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, + rrbd->bo, 0, RADEON_GEM_DOMAIN_VRAM); + } + + ret = radeon_cs_space_check(r300->radeon.cmdbuf.cs); + if (ret) + return -1; + rcommonEnsureCmdBufSpace(&r300->radeon, 421 * 3, __FUNCTION__); if (flags || bits) r300EmitClearState(ctx); + rrbd = radeon_get_renderbuffer(&rfb->base, BUFFER_DEPTH); if (rrbd && (flags & BUFFER_BIT_DEPTH)) bits |= CLEARBUFFER_DEPTH; @@ -582,6 +608,7 @@ static void r300KernelClear(GLcontext *ctx, GLuint flags) r300ClearBuffer(r300, bits, NULL, rrbd); COMMIT_BATCH(); + return 0; } /** @@ -593,7 +620,7 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask) __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask); GLbitfield swrast_mask = 0, tri_mask = 0; - int i; + int i, ret; struct gl_framebuffer *fb = ctx->DrawBuffer; if (RADEON_DEBUG & DEBUG_IOCTL) @@ -614,6 +641,8 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask) if (colorMask == ~0) tri_mask |= (mask & BUFFER_BITS_COLOR); + else + tri_mask |= (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)); /* HW stencil */ @@ -643,12 +672,18 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask) /* SW fallback clearing */ swrast_mask = mask & ~tri_mask; + ret = 0; if (tri_mask) { if (r300->radeon.radeonScreen->kernel_mm) - r300UserClear(ctx, tri_mask); - else - r300KernelClear(ctx, tri_mask); + radeonUserClear(ctx, tri_mask); + else { + /* if kernel clear fails due to size restraints fallback */ + ret = r300KernelClear(ctx, tri_mask); + if (ret < 0) + swrast_mask |= tri_mask; + } } + if (swrast_mask) { if (RADEON_DEBUG & DEBUG_FALLBACKS) fprintf(stderr, "%s: swrast clear, mask: %x\n", diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index c22616b95f6..357c600af97 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -1467,6 +1467,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_FORMAT_3D (1 << 25) # define R300_TX_FORMAT_CUBIC_MAP (2 << 25) +# define R300_TX_FORMAT_GAMMA (1 << 21) + /* gap */ /* Floating point formats */ /* Note - hardware supports both 16 and 32 bit floating point */ diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 1356305a212..08d67b73edc 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -243,7 +243,6 @@ static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __FUNCTION__, nr, offset); - if (!rmesa->radeon.radeonScreen->kernel_mm) { BEGIN_BATCH(sz+2+(nr * 2)); OUT_BATCH_PACKET3(R300_PACKET3_3D_LOAD_VBPNTR, sz - 1); @@ -360,31 +359,15 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) if (type < 0 || num_verts <= 0) return; - /* Make space for at least 64 dwords. + /* Make space for at least 128 dwords. * This is supposed to ensure that we can get all rendering * commands into a single command buffer. */ rcommonEnsureCmdBufSpace(&rmesa->radeon, 128, __FUNCTION__); if (rmesa->ind_buf.ptr) { - if (num_verts > 65535) { - /* not implemented yet */ - WARN_ONCE("Too many elts\n"); - return; - } - /* Note: The following is incorrect, but it's the best I can do - * without a major refactoring of how DMA memory is handled. - * The problem: Ensuring that both vertex arrays *and* index - * arrays are at the right position, and then ensuring that - * the LOAD_VBPNTR, DRAW_INDX and INDX_BUFFER packets are emitted - * at once. - * - * So why is the following incorrect? Well, it seems like - * allocating the index array might actually evict the vertex - * arrays. *sigh* - */ r300EmitElts(ctx, num_verts); - r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start); + r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, 0); if (rmesa->radeon.radeonScreen->kernel_mm) { BEGIN_BATCH_NO_AUTOSTATE(2); OUT_BATCH_REGSEQ(R300_VAP_VF_MAX_VTX_INDX, 1); @@ -469,7 +452,8 @@ void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode) if (mode) { if ((fallback_warn & bit) == 0) { - _mesa_fprintf(stderr, "WARNING! Falling back to software for %s\n", getFallbackString(bit)); + if (RADEON_DEBUG & DEBUG_FALLBACKS) + _mesa_fprintf(stderr, "WARNING! Falling back to software for %s\n", getFallbackString(bit)); fallback_warn |= bit; } rmesa->fallback |= bit; diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index 0133b837966..62228a3786e 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -32,22 +32,45 @@ #include "r300_context.h" #include "r300_fragprog_common.h" +static void freeFragProgCache(GLcontext *ctx, struct r300_fragment_program_cont *cache) +{ + struct r300_fragment_program *tmp, *fp = cache->progs; + + while (fp) { + tmp = fp->next; + _mesa_reference_program(ctx, &fp->Base, NULL); + _mesa_free(fp); + fp = tmp; + } +} + +static void freeVertProgCache(GLcontext *ctx, struct r300_vertex_program_cont *cache) +{ + struct r300_vertex_program *tmp, *vp = cache->progs; + + while (vp) { + tmp = vp->next; + _mesa_reference_vertprog(ctx, &vp->Base, NULL); + _mesa_free(vp); + vp = tmp; + } +} + static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, GLuint id) { struct r300_vertex_program_cont *vp; - struct r300_fragment_program *fp; + struct r300_fragment_program_cont *fp; switch (target) { case GL_VERTEX_STATE_PROGRAM_NV: case GL_VERTEX_PROGRAM_ARB: vp = CALLOC_STRUCT(r300_vertex_program_cont); - return _mesa_init_vertex_program(ctx, &vp->mesa_program, - target, id); + return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id); case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: - fp = CALLOC_STRUCT(r300_fragment_program); + fp = CALLOC_STRUCT(r300_fragment_program_cont); return _mesa_init_fragment_program(ctx, &fp->Base, target, id); default: @@ -59,21 +82,35 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog) { + struct r300_vertex_program_cont *vp = (struct r300_vertex_program_cont *)prog; + struct r300_fragment_program_cont *fp = (struct r300_fragment_program_cont *)prog; + + switch (prog->Target) { + case GL_VERTEX_PROGRAM_ARB: + freeVertProgCache(ctx, vp); + break; + case GL_FRAGMENT_PROGRAM_ARB: + freeFragProgCache(ctx, fp); + break; + } + _mesa_delete_program(ctx, prog); } static void r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) { - struct r300_vertex_program_cont *vp = (void *)prog; - struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)prog; + struct r300_vertex_program_cont *vp = (struct r300_vertex_program_cont *)prog; + struct r300_fragment_program_cont *fp = (struct r300_fragment_program_cont *)prog; switch (target) { case GL_VERTEX_PROGRAM_ARB: + freeVertProgCache(ctx, vp); vp->progs = NULL; break; case GL_FRAGMENT_PROGRAM_ARB: - r300_fp->translated = GL_FALSE; + freeFragProgCache(ctx, fp); + fp->progs = NULL; break; } @@ -85,13 +122,18 @@ static GLboolean r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { - struct r300_fragment_program *fp = (struct r300_fragment_program *)prog; + struct r300_fragment_program *fp = r300SelectFragmentShader(ctx); if (!fp->translated) - r300TranslateFragmentShader(ctx, &fp->Base); + r300TranslateFragmentShader(ctx, fp); return !fp->error; - } else - return GL_TRUE; + } else { + struct r300_vertex_program *vp = r300SelectVertexShader(ctx); + if (!vp->translated) + r300TranslateVertexShader(vp); + + return !vp->error; + } } void r300InitShaderFuncs(struct dd_function_table *functions) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index c0eda977db8..12fbf281d99 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -434,6 +434,10 @@ static void r300UpdateCulling(GLcontext * ctx) break; } + /* Winding is inverted when rendering to FBO */ + if (ctx->DrawBuffer && ctx->DrawBuffer->Name) + val ^= R300_FRONT_FACE_CW; + R300_STATECHANGE(r300, cul); r300->hw.cul.cmd[R300_CUL_CULL] = val; } @@ -452,9 +456,9 @@ static void r300SetPolygonOffsetState(GLcontext * ctx, GLboolean state) static GLboolean current_fragment_program_writes_depth(GLcontext* ctx) { - struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; + r300ContextPtr r300 = R300_CONTEXT(ctx); - return (fp && fp->writes_depth); + return ctx->FragmentProgram._Current && r300->selected_fp->writes_depth; } static void r300SetEarlyZState(GLcontext * ctx) @@ -1093,24 +1097,25 @@ r300FetchStateParameter(GLcontext * ctx, * Update R300's own internal state parameters. * For now just STATE_R300_WINDOW_DIMENSION */ -void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) +static void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) { - struct r300_fragment_program *fp; + r300ContextPtr rmesa = R300_CONTEXT(ctx); struct gl_program_parameter_list *paramList; GLuint i; if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))) return; - fp = (struct r300_fragment_program *)ctx->FragmentProgram._Current; - if (!fp) + if (!ctx->FragmentProgram._Current || !rmesa->selected_fp) return; - paramList = fp->Base.Base.Parameters; + paramList = rmesa->selected_fp->Base->Parameters; if (!paramList) return; + _mesa_load_state_parameters(ctx, paramList); + for (i = 0; i < paramList->NumParameters; i++) { if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) { r300FetchStateParameter(ctx, @@ -1225,8 +1230,7 @@ static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) { r300ContextPtr r300 = R300_CONTEXT(ctx); int i; - struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; - struct r300_fragment_program_code *code = &fp->code.r300; + struct r300_fragment_program_code *code = &r300->selected_fp->code.r300; R300_STATECHANGE(r300, fpt); @@ -1266,9 +1270,9 @@ static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) static void r500SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) { + r300ContextPtr r300 = R300_CONTEXT(ctx); int i; - struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; - struct r500_fragment_program_code *code = &fp->code.r500; + struct r500_fragment_program_code *code = &r300->selected_fp->code.r500; /* find all the texture instructions and relocate the texture units */ for (i = 0; i < code->inst_end + 1; i++) { @@ -1316,8 +1320,6 @@ static void r300SetupTextures(GLcontext * ctx) int hw_tmu = 0; int last_hw_tmu = -1; /* -1 translates into no setup costs for fields */ int tmu_mappings[R300_MAX_TEXTURE_UNITS] = { -1, }; - struct r300_fragment_program *fp = (struct r300_fragment_program *) - (char *)ctx->FragmentProgram._Current; R300_STATECHANGE(r300, txe); R300_STATECHANGE(r300, tex.filter); @@ -1420,7 +1422,7 @@ static void r300SetupTextures(GLcontext * ctx) cmdpacket0(r300->radeon.radeonScreen, R300_TX_BORDER_COLOR_0, last_hw_tmu + 1); if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) { - if (fp->Base.UsesKill && last_hw_tmu < 0) { + if (ctx->FragmentProgram._Current->UsesKill && last_hw_tmu < 0) { // The KILL operation requires the first texture unit // to be enabled. r300->hw.txe.cmd[R300_TXE_ENABLE] |= 1; @@ -1458,11 +1460,11 @@ static void r300SetupRSUnit(GLcontext * ctx) hw_tcl_on = r300->options.hw_tcl_enabled; if (hw_tcl_on) - OutputsWritten.vp_outputs = r300->selected_vp->key.OutputsWritten; + OutputsWritten.vp_outputs = r300->selected_vp->Base->Base.OutputsWritten; else RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->render_inputs_bitset); - InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; + InputsRead = r300->selected_fp->Base->InputsRead; R300_STATECHANGE(r300, ri); R300_STATECHANGE(r300, rc); @@ -1521,29 +1523,6 @@ static void r300SetupRSUnit(GLcontext * ctx) ++fp_reg; } - if (InputsRead & FRAG_BIT_WPOS) { - r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3) | R300_RS_TEX_PTR(rs_tex_count); - r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg); - InputsRead &= ~FRAG_BIT_WPOS; - rs_tex_count += 4; - ++tex_ip; - ++fp_reg; - } - - if (InputsRead & FRAG_BIT_FOGC) { - if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_FOGC, _TNL_ATTRIB_FOG)) { - r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= R300_RS_SEL_S(0) | R300_RS_SEL_T(R300_RS_SEL_K0) | R300_RS_SEL_R(R300_RS_SEL_K0); - r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= R300_RS_SEL_Q(R300_RS_SEL_K1) | R300_RS_TEX_PTR(rs_tex_count); - r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg); - InputsRead &= ~FRAG_BIT_FOGC; - rs_tex_count += 4; - ++tex_ip; - ++fp_reg; - } else { - WARN_ONCE("fragprog wants fogc, vp doesn't provide it\n"); - } - } - /* Setup default color if no color or tex was set */ if (rs_tex_count == 0 && col_ip == 0) { r300->hw.rr.cmd[R300_RR_INST_0] = R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_ADDR(0); @@ -1575,11 +1554,11 @@ static void r500SetupRSUnit(GLcontext * ctx) hw_tcl_on = r300->options.hw_tcl_enabled; if (hw_tcl_on) - OutputsWritten.vp_outputs = r300->selected_vp->key.OutputsWritten; + OutputsWritten.vp_outputs = r300->selected_vp->Base->Base.OutputsWritten; else RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->render_inputs_bitset); - InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; + InputsRead = r300->selected_fp->Base->InputsRead; R300_STATECHANGE(r300, ri); R300_STATECHANGE(r300, rc); @@ -1642,36 +1621,6 @@ static void r500SetupRSUnit(GLcontext * ctx) ++fp_reg; } - if (InputsRead & FRAG_BIT_WPOS) { - r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= ((rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT) | - ((rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT) | - ((rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT) | - ((rs_tex_count + 3) << R500_RS_IP_TEX_PTR_Q_SHIFT); - - r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg); - InputsRead &= ~FRAG_BIT_WPOS; - rs_tex_count += 4; - ++tex_ip; - ++fp_reg; - } - - if (InputsRead & FRAG_BIT_FOGC) { - if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_FOGC, _TNL_ATTRIB_FOG)) { - r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= (rs_tex_count << R500_RS_IP_TEX_PTR_S_SHIFT) | - (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) | - (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) | - (R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT); - - r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg); - InputsRead &= ~FRAG_BIT_FOGC; - rs_tex_count += 4; - ++tex_ip; - ++fp_reg; - } else { - WARN_ONCE("fragprog wants fogc, vp doesn't provide it\n"); - } - } - /* Setup default color if no color or tex was set */ if (rs_tex_count == 0 && col_ip == 0) { r300->hw.rr.cmd[R300_RR_INST_0] = R500_RS_INST_COL_ID(0) | R500_RS_INST_COL_ADDR(0); @@ -2036,43 +1985,51 @@ static void r300ResetHwState(r300ContextPtr r300) void r300UpdateShaders(r300ContextPtr rmesa) { - GLcontext *ctx; - struct r300_fragment_program *fp; - int i; - - ctx = rmesa->radeon.glCtx; - fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; + GLcontext *ctx = rmesa->radeon.glCtx; /* should only happenen once, just after context is created */ /* TODO: shouldn't we fallback to sw here? */ - if (!fp) { + if (!ctx->FragmentProgram._Current) { _mesa_fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); return; } - if (rmesa->radeon.NewGLState && rmesa->options.hw_tcl_enabled) { - for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { - rmesa->temp_attrib[i] = - TNL_CONTEXT(ctx)->vb.AttribPtr[i]; - TNL_CONTEXT(ctx)->vb.AttribPtr[i] = - &rmesa->dummy_attrib[i]; - } + { + struct r300_fragment_program *fp; - _tnl_UpdateFixedFunctionProgram(ctx); + fp = r300SelectFragmentShader(ctx); + if (!fp->translated) + r300TranslateFragmentShader(ctx, fp); - for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { - TNL_CONTEXT(ctx)->vb.AttribPtr[i] = - rmesa->temp_attrib[i]; - } - - r300SelectVertexShader(rmesa); - r300SwitchFallback(ctx, R300_FALLBACK_VERTEX_PROGRAM, rmesa->selected_vp->error); + r300SwitchFallback(ctx, R300_FALLBACK_FRAGMENT_PROGRAM, fp->error); } - if (!fp->translated || rmesa->radeon.NewGLState) - r300TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); + if (rmesa->options.hw_tcl_enabled) { + struct r300_vertex_program *vp; + + if (rmesa->radeon.NewGLState) { + int i; + for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { + rmesa->temp_attrib[i] = + TNL_CONTEXT(ctx)->vb.AttribPtr[i]; + TNL_CONTEXT(ctx)->vb.AttribPtr[i] = + &rmesa->dummy_attrib[i]; + } + + _tnl_UpdateFixedFunctionProgram(ctx); + + for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { + TNL_CONTEXT(ctx)->vb.AttribPtr[i] = + rmesa->temp_attrib[i]; + } + } + + vp = r300SelectVertexShader(ctx); + if (!vp->translated) + r300TranslateVertexShader(vp); - r300SwitchFallback(ctx, R300_FALLBACK_FRAGMENT_PROGRAM, fp->error); + r300SwitchFallback(ctx, R300_FALLBACK_VERTEX_PROGRAM, vp->error); + } r300UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); rmesa->radeon.NewGLState = 0; @@ -2102,7 +2059,7 @@ static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, static void r300SetupPixelShader(GLcontext *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; + struct r300_fragment_program *fp = rmesa->selected_fp; struct r300_fragment_program_code *code; int i, k; @@ -2148,8 +2105,7 @@ static void r300SetupPixelShader(GLcontext *ctx) R300_STATECHANGE(rmesa, fpp); rmesa->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(rmesa->radeon.radeonScreen, R300_PFS_PARAM_0_X, code->const_nr * 4); for (i = 0; i < code->const_nr; i++) { - const GLfloat *constant = get_fragmentprogram_constant(ctx, - &fp->Base.Base, code->constant[i]); + const GLfloat *constant = get_fragmentprogram_constant(ctx, fp->Base, code->constant[i]); rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 0] = r300PackFloat24(constant[0]); rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 1] = r300PackFloat24(constant[1]); rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 2] = r300PackFloat24(constant[2]); @@ -2174,7 +2130,7 @@ static void r300SetupPixelShader(GLcontext *ctx) static void r500SetupPixelShader(GLcontext *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; + struct r300_fragment_program *fp = rmesa->selected_fp; int i; struct r500_fragment_program_code *code; @@ -2210,8 +2166,7 @@ static void r500SetupPixelShader(GLcontext *ctx) R300_STATECHANGE(rmesa, r500fp_const); for (i = 0; i < code->const_nr; i++) { - const GLfloat *constant = get_fragmentprogram_constant(ctx, - &fp->Base.Base, code->constant[i]); + const GLfloat *constant = get_fragmentprogram_constant(ctx, fp->Base, code->constant[i]); rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 0] = r300PackFloat32(constant[0]); rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 1] = r300PackFloat32(constant[1]); rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 2] = r300PackFloat32(constant[2]); @@ -2274,20 +2229,17 @@ void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten) rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead); rmesa->hw.vic.cmd[R300_VIC_CNTL_1] = r300VAPInputCntl1(ctx, InputsRead); - rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten, ctx->FragmentProgram._Current->Base.InputsRead); - rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = r300VAPOutputCntl1(ctx, OutputsWritten, ctx->FragmentProgram._Current->Base.InputsRead); + rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten); + rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = r300VAPOutputCntl1(ctx, OutputsWritten); } void r300UpdateShaderStates(r300ContextPtr rmesa) { GLcontext *ctx; ctx = rmesa->radeon.glCtx; - struct r300_fragment_program *r300_fp; - - r300_fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; /* should only happenen once, just after context is created */ - if (!r300_fp) + if (!ctx->FragmentProgram._Current) return; r300SetEarlyZState(ctx); @@ -2323,8 +2275,6 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state) R300_STATECHANGE(r300, cb); } - r300UpdateStateParameters(ctx, new_state); - r300->radeon.NewGLState |= new_state; } diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h index 23282894202..d46bf9f1796 100644 --- a/src/mesa/drivers/dri/r300/r300_state.h +++ b/src/mesa/drivers/dri/r300/r300_state.h @@ -52,7 +52,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void r300UpdateViewportOffset (GLcontext * ctx); void r300UpdateDrawBuffer (GLcontext * ctx); -void r300UpdateStateParameters (GLcontext * ctx, GLuint new_state); void r300UpdateShaders (r300ContextPtr rmesa); void r300UpdateShaderStates (r300ContextPtr rmesa); void r300InitState (r300ContextPtr r300); diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index ce4179208eb..56ed519cf41 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -76,7 +76,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ GLuint InputsRead = 0; GLuint OutputsWritten = 0; int num_attrs = 0; - GLuint fp_reads = ctx->FragmentProgram._Current->Base.InputsRead; + GLuint fp_reads = rmesa->selected_fp->Base->InputsRead; struct vertex_attribute *attrs = rmesa->vbuf.attribs; rmesa->swtcl.coloroffset = rmesa->swtcl.specoffset = 0; @@ -150,6 +150,22 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ ADD_ATTR(VERT_ATTRIB_POINT_SIZE, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_POINT_SIZE, swiz, MASK_X, 0); } + if (rmesa->selected_fp->wpos_attr != FRAG_ATTRIB_MAX) { + int tex_id = rmesa->selected_fp->wpos_attr - FRAG_ATTRIB_TEX0; + + VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_POS]; + VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_POS]; + RENDERINPUTS_SET(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 + tex_id); + } + + if (rmesa->selected_fp->fog_attr != FRAG_ATTRIB_MAX) { + int tex_id = rmesa->selected_fp->fog_attr - FRAG_ATTRIB_TEX0; + + VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG]; + VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG]; + RENDERINPUTS_SET(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 + tex_id); + } + /** * Sending only one texcoord component may lead to lock up, * so for all textures always output 4 texcoord components to RS. @@ -192,31 +208,9 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ } } - /* RS can't put fragment position on the pixel stack, so stuff it in texcoord if needed */ - if (fp_reads & FRAG_BIT_WPOS) { - if (first_free_tex >= ctx->Const.MaxTextureUnits) { - fprintf(stderr, "\tout of free texcoords to write w pos\n"); - _mesa_exit(-1); - } - - InputsRead |= 1 << (VERT_ATTRIB_TEX0 + first_free_tex); - OutputsWritten |= 1 << (VERT_RESULT_TEX0 + first_free_tex); - EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F ); - ADD_ATTR(VERT_ATTRIB_POS, R300_DATA_TYPE_FLOAT_4, SWTCL_OVM_TEX(first_free_tex), SWIZZLE_XYZW, MASK_XYZW, 0); - ++first_free_tex; - } - - if (fp_reads & FRAG_BIT_FOGC) { - if (first_free_tex >= ctx->Const.MaxTextureUnits) { - fprintf(stderr, "\tout of free texcoords to write fog coordinate\n"); - _mesa_exit(-1); - } - - InputsRead |= 1 << VERT_ATTRIB_FOG; - OutputsWritten |= 1 << VERT_RESULT_FOGC; - GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO); - EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F ); - ADD_ATTR(VERT_ATTRIB_FOG, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_XYZW, 0); + if (first_free_tex >= ctx->Const.MaxTextureUnits) { + fprintf(stderr, "\tout of free texcoords to write fog coordinate\n"); + _mesa_exit(-1); } R300_NEWPRIM(rmesa); @@ -497,11 +491,13 @@ void r300RenderStart(GLcontext *ctx) r300ContextPtr rmesa = R300_CONTEXT( ctx ); r300ChooseRenderState(ctx); + + r300UpdateShaders(rmesa); + r300PrepareVertices(ctx); r300ValidateBuffers(ctx); - r300UpdateShaders(rmesa); r300UpdateShaderStates(rmesa); r300EmitCacheFlush(rmesa); diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 6d6a90aa88a..6f489ace7bf 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -119,6 +119,10 @@ static const struct tx_table { _ASSIGN(Z24_S8, R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8)), _ASSIGN(S8_Z24, R300_EASY_TX_FORMAT(Y, Y, Y, Y, X24_Y8)), _ASSIGN(Z32, R300_EASY_TX_FORMAT(X, X, X, X, X32)), + /* EXT_texture_sRGB */ + _ASSIGN(SRGBA8, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8) | R300_TX_FORMAT_GAMMA), + _ASSIGN(SLA8, R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8) | R300_TX_FORMAT_GAMMA), + _ASSIGN(SL8, R300_EASY_TX_FORMAT(X, X, X, ONE, X8) | R300_TX_FORMAT_GAMMA), /* *INDENT-ON* */ }; @@ -277,21 +281,24 @@ GLboolean r300ValidateBuffers(GLcontext * ctx) r300ContextPtr rmesa = R300_CONTEXT(ctx); struct radeon_renderbuffer *rrb; int i; + int ret; - radeon_validate_reset_bos(&rmesa->radeon); + radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs); rrb = radeon_get_colorbuffer(&rmesa->radeon); /* color buffer */ if (rrb && rrb->bo) { - radeon_validate_bo(&rmesa->radeon, rrb->bo, - 0, RADEON_GEM_DOMAIN_VRAM); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + rrb->bo, 0, + RADEON_GEM_DOMAIN_VRAM); } /* depth buffer */ rrb = radeon_get_depthbuffer(&rmesa->radeon); if (rrb && rrb->bo) { - radeon_validate_bo(&rmesa->radeon, rrb->bo, - 0, RADEON_GEM_DOMAIN_VRAM); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + rrb->bo, 0, + RADEON_GEM_DOMAIN_VRAM); } for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { @@ -307,17 +314,19 @@ GLboolean r300ValidateBuffers(GLcontext * ctx) } t = radeon_tex_obj(ctx->Texture.Unit[i]._Current); if (t->image_override && t->bo) - radeon_validate_bo(&rmesa->radeon, t->bo, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + t->bo, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); else if (t->mt->bo) - radeon_validate_bo(&rmesa->radeon, t->mt->bo, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + t->mt->bo, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); } - if (rmesa->radeon.dma.current) - radeon_validate_bo(&rmesa->radeon, rmesa->radeon.dma.current, RADEON_GEM_DOMAIN_GTT, 0); - return radeon_revalidate_bos(ctx); + ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, rmesa->radeon.dma.current, RADEON_GEM_DOMAIN_GTT, 0); + if (ret) + return GL_FALSE; + return GL_TRUE; } void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname, @@ -433,7 +442,7 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo rImage->mt = NULL; } _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->width, rb->height, 1, 0, rb->cpp); + rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx, internalFormat, @@ -469,15 +478,15 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo break; } pitch_val--; - t->pp_txsize = ((rb->width - 1) << R300_TX_WIDTHMASK_SHIFT) | - ((rb->height - 1) << R300_TX_HEIGHTMASK_SHIFT); + t->pp_txsize = ((rb->base.Width - 1) << R300_TX_WIDTHMASK_SHIFT) | + ((rb->base.Height - 1) << R300_TX_HEIGHTMASK_SHIFT); t->pp_txsize |= R300_TX_SIZE_TXPITCH_EN; t->pp_txpitch |= pitch_val; if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - if (rb->width > 2048) + if (rb->base.Width > 2048) t->pp_txpitch |= R500_TXWIDTH_BIT11; - if (rb->height > 2048) + if (rb->base.Height > 2048) t->pp_txpitch |= R500_TXHEIGHT_BIT11; } t->validated = GL_TRUE; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index c41a8fdd621..de32013032f 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -32,12 +32,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/macros.h" #include "main/enums.h" #include "shader/program.h" +#include "shader/programopt.h" #include "shader/prog_instruction.h" +#include "shader/prog_optimize.h" #include "shader/prog_parameter.h" #include "shader/prog_print.h" #include "shader/prog_statevars.h" #include "tnl/tnl.h" +#include "radeon_nqssadce.h" #include "r300_context.h" #include "r300_state.h" @@ -71,15 +74,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. u_temp_i=VSF_MAX_FRAGMENT_TEMPS-1; \ } while (0) -int r300VertexProgUpdateParams(GLcontext * ctx, - struct r300_vertex_program_cont *vp, float *dst) +static int r300VertexProgUpdateParams(GLcontext * ctx, struct gl_vertex_program *vp, float *dst) { int pi; - struct gl_vertex_program *mesa_vp = &vp->mesa_program; float *dst_o = dst; struct gl_program_parameter_list *paramList; - if (mesa_vp->IsNVProgram) { + if (vp->IsNVProgram) { _mesa_load_tracked_matrices(ctx); for (pi = 0; pi < MAX_NV_VERTEX_PROGRAM_PARAMS; pi++) { @@ -91,16 +92,18 @@ int r300VertexProgUpdateParams(GLcontext * ctx, return dst - dst_o; } - assert(mesa_vp->Base.Parameters); - _mesa_load_state_parameters(ctx, mesa_vp->Base.Parameters); + if (!vp->Base.Parameters) + return 0; - if (mesa_vp->Base.Parameters->NumParameters * 4 > + _mesa_load_state_parameters(ctx, vp->Base.Parameters); + + if (vp->Base.Parameters->NumParameters * 4 > VSF_MAX_FRAGMENT_LENGTH) { fprintf(stderr, "%s:Params exhausted\n", __FUNCTION__); _mesa_exit(-1); } - paramList = mesa_vp->Base.Parameters; + paramList = vp->Base.Parameters; for (pi = 0; pi < paramList->NumParameters; pi++) { switch (paramList->Parameters[pi].Type) { case PROGRAM_STATE_VAR: @@ -933,10 +936,14 @@ static void t_inputs_outputs(struct r300_vertex_program *vp) { int i; int cur_reg; + GLuint OutputsWritten, InputsRead; + + OutputsWritten = vp->Base->Base.OutputsWritten; + InputsRead = vp->Base->Base.InputsRead; cur_reg = -1; for (i = 0; i < VERT_ATTRIB_MAX; i++) { - if (vp->key.InputsRead & (1 << i)) + if (InputsRead & (1 << i)) vp->inputs[i] = ++cur_reg; else vp->inputs[i] = -1; @@ -946,13 +953,13 @@ static void t_inputs_outputs(struct r300_vertex_program *vp) for (i = 0; i < VERT_RESULT_MAX; i++) vp->outputs[i] = -1; - assert(vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS)); + assert(OutputsWritten & (1 << VERT_RESULT_HPOS)); - if (vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS)) { + if (OutputsWritten & (1 << VERT_RESULT_HPOS)) { vp->outputs[VERT_RESULT_HPOS] = cur_reg++; } - if (vp->key.OutputsWritten & (1 << VERT_RESULT_PSIZ)) { + if (OutputsWritten & (1 << VERT_RESULT_PSIZ)) { vp->outputs[VERT_RESULT_PSIZ] = cur_reg++; } @@ -962,46 +969,46 @@ static void t_inputs_outputs(struct r300_vertex_program *vp) * pretend it does by skipping output index reg so the colors * get written into appropriate output vectors. */ - if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL0)) { + if (OutputsWritten & (1 << VERT_RESULT_COL0)) { vp->outputs[VERT_RESULT_COL0] = cur_reg++; - } else if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0) || - vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { + } else if (OutputsWritten & (1 << VERT_RESULT_BFC0) || + OutputsWritten & (1 << VERT_RESULT_BFC1)) { cur_reg++; } - if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL1)) { + if (OutputsWritten & (1 << VERT_RESULT_COL1)) { vp->outputs[VERT_RESULT_COL1] = cur_reg++; - } else if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0) || - vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { + } else if (OutputsWritten & (1 << VERT_RESULT_BFC0) || + OutputsWritten & (1 << VERT_RESULT_BFC1)) { cur_reg++; } - if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0)) { + if (OutputsWritten & (1 << VERT_RESULT_BFC0)) { vp->outputs[VERT_RESULT_BFC0] = cur_reg++; - } else if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { + } else if (OutputsWritten & (1 << VERT_RESULT_BFC1)) { cur_reg++; } - if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { + if (OutputsWritten & (1 << VERT_RESULT_BFC1)) { vp->outputs[VERT_RESULT_BFC1] = cur_reg++; - } else if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0)) { + } else if (OutputsWritten & (1 << VERT_RESULT_BFC0)) { cur_reg++; } for (i = VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++) { - if (vp->key.OutputsWritten & (1 << i)) { + if (OutputsWritten & (1 << i)) { vp->outputs[i] = cur_reg++; } } - if (vp->key.OutputsWritten & (1 << VERT_RESULT_FOGC)) { + if (OutputsWritten & (1 << VERT_RESULT_FOGC)) { vp->outputs[VERT_RESULT_FOGC] = cur_reg++; } } -static void r300TranslateVertexShader(struct r300_vertex_program *vp, - struct prog_instruction *vpi) +void r300TranslateVertexShader(struct r300_vertex_program *vp) { + struct prog_instruction *vpi = vp->Base->Base.Instructions; int i; GLuint *inst; unsigned long num_operands; @@ -1191,313 +1198,463 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, } } -/* DP4 version seems to trigger some hw peculiarity */ -//#define PREFER_DP4 +static void insert_wpos(struct gl_program *prog, GLuint temp_index, int tex_id) +{ + struct prog_instruction *vpi; + + _mesa_insert_instructions(prog, prog->NumInstructions - 1, 2); + + vpi = &prog->Instructions[prog->NumInstructions - 3]; + + vpi->Opcode = OPCODE_MOV; + + vpi->DstReg.File = PROGRAM_OUTPUT; + vpi->DstReg.Index = VERT_RESULT_HPOS; + vpi->DstReg.WriteMask = WRITEMASK_XYZW; + vpi->DstReg.CondMask = COND_TR; + + vpi->SrcReg[0].File = PROGRAM_TEMPORARY; + vpi->SrcReg[0].Index = temp_index; + vpi->SrcReg[0].Swizzle = SWIZZLE_XYZW; + + ++vpi; + + vpi->Opcode = OPCODE_MOV; -static void position_invariant(struct gl_program *prog) + vpi->DstReg.File = PROGRAM_OUTPUT; + vpi->DstReg.Index = VERT_RESULT_TEX0 + tex_id; + vpi->DstReg.WriteMask = WRITEMASK_XYZW; + vpi->DstReg.CondMask = COND_TR; + + vpi->SrcReg[0].File = PROGRAM_TEMPORARY; + vpi->SrcReg[0].Index = temp_index; + vpi->SrcReg[0].Swizzle = SWIZZLE_XYZW; + + ++vpi; + + vpi->Opcode = OPCODE_END; +} + +static void pos_as_texcoord(struct gl_program *prog, int tex_id) { struct prog_instruction *vpi; - struct gl_program_parameter_list *paramList; - int i; + GLuint tempregi = prog->NumTemporaries; - gl_state_index tokens[STATE_LENGTH] = { STATE_MVP_MATRIX, 0, 0, 0, 0 }; + prog->NumTemporaries++; - /* tokens[4] = matrix modifier */ -#ifdef PREFER_DP4 - tokens[4] = 0; /* not transposed or inverted */ -#else - tokens[4] = STATE_MATRIX_TRANSPOSE; -#endif - paramList = prog->Parameters; - - vpi = _mesa_alloc_instructions(prog->NumInstructions + 4); - _mesa_init_instructions(vpi, prog->NumInstructions + 4); - - for (i = 0; i < 4; i++) { - GLint idx; - tokens[2] = tokens[3] = i; /* matrix row[i]..row[i] */ - idx = _mesa_add_state_reference(paramList, tokens); -#ifdef PREFER_DP4 - vpi[i].Opcode = OPCODE_DP4; - vpi[i].StringPos = 0; - vpi[i].Data = 0; - - vpi[i].DstReg.File = PROGRAM_OUTPUT; - vpi[i].DstReg.Index = VERT_RESULT_HPOS; - vpi[i].DstReg.WriteMask = 1 << i; - vpi[i].DstReg.CondMask = COND_TR; - - vpi[i].SrcReg[0].File = PROGRAM_STATE_VAR; - vpi[i].SrcReg[0].Index = idx; - vpi[i].SrcReg[0].Swizzle = SWIZZLE_XYZW; - - vpi[i].SrcReg[1].File = PROGRAM_INPUT; - vpi[i].SrcReg[1].Index = VERT_ATTRIB_POS; - vpi[i].SrcReg[1].Swizzle = SWIZZLE_XYZW; -#else - if (i == 0) - vpi[i].Opcode = OPCODE_MUL; - else - vpi[i].Opcode = OPCODE_MAD; + for (vpi = prog->Instructions; vpi->Opcode != OPCODE_END; vpi++) { + if (vpi->DstReg.File == PROGRAM_OUTPUT && vpi->DstReg.Index == VERT_RESULT_HPOS) { + vpi->DstReg.File = PROGRAM_TEMPORARY; + vpi->DstReg.Index = tempregi; + } + } - vpi[i].Data = 0; + insert_wpos(prog, tempregi, tex_id); - if (i == 3) - vpi[i].DstReg.File = PROGRAM_OUTPUT; - else - vpi[i].DstReg.File = PROGRAM_TEMPORARY; - vpi[i].DstReg.Index = 0; - vpi[i].DstReg.WriteMask = 0xf; - vpi[i].DstReg.CondMask = COND_TR; - - vpi[i].SrcReg[0].File = PROGRAM_STATE_VAR; - vpi[i].SrcReg[0].Index = idx; - vpi[i].SrcReg[0].Swizzle = SWIZZLE_XYZW; - - vpi[i].SrcReg[1].File = PROGRAM_INPUT; - vpi[i].SrcReg[1].Index = VERT_ATTRIB_POS; - vpi[i].SrcReg[1].Swizzle = MAKE_SWIZZLE4(i, i, i, i); - - if (i > 0) { - vpi[i].SrcReg[2].File = PROGRAM_TEMPORARY; - vpi[i].SrcReg[2].Index = 0; - vpi[i].SrcReg[2].Swizzle = SWIZZLE_XYZW; + prog->OutputsWritten |= 1 << (VERT_RESULT_TEX0 + tex_id); +} + +/** + * The fogcoord attribute is special in that only the first component + * is relevant, and the remaining components are always fixed (when read + * from by the fragment program) to yield an X001 pattern. + * + * We need to enforce this either in the vertex program or in the fragment + * program, and this code chooses not to enforce it in the vertex program. + * This is slightly cheaper, as long as the fragment program does not use + * weird swizzles. + * + * And it seems that usually, weird swizzles are not used, so... + * + * See also the counterpart rewriting for fragment programs. + */ +static void fog_as_texcoord(struct gl_program *prog, int tex_id) +{ + struct prog_instruction *vpi; + + vpi = prog->Instructions; + while (vpi->Opcode != OPCODE_END) { + if (vpi->DstReg.File == PROGRAM_OUTPUT && vpi->DstReg.Index == VERT_RESULT_FOGC) { + vpi->DstReg.Index = VERT_RESULT_TEX0 + tex_id; + vpi->DstReg.WriteMask = WRITEMASK_X; } -#endif + + ++vpi; } - _mesa_copy_instructions(&vpi[i], prog->Instructions, - prog->NumInstructions); + prog->OutputsWritten &= ~(1 << VERT_RESULT_FOGC); + prog->OutputsWritten |= 1 << (VERT_RESULT_TEX0 + tex_id); +} - free(prog->Instructions); +static int translateABS(struct gl_program *prog, int pos) +{ + struct prog_instruction *inst; - prog->Instructions = vpi; + inst = &prog->Instructions[pos]; - prog->NumInstructions += 4; - vpi = &prog->Instructions[prog->NumInstructions - 1]; + inst->Opcode = OPCODE_MAX; + inst->SrcReg[1] = inst->SrcReg[0]; + inst->SrcReg[1].Negate ^= NEGATE_XYZW; - assert(vpi->Opcode == OPCODE_END); + return 0; } -static void insert_wpos(struct r300_vertex_program *vp, struct gl_program *prog, - GLuint temp_index) +static int translateDP3(struct gl_program *prog, int pos) { - struct prog_instruction *vpi; - struct prog_instruction *vpi_insert; - int i = 0; + struct prog_instruction *inst; - vpi = _mesa_alloc_instructions(prog->NumInstructions + 2); - _mesa_init_instructions(vpi, prog->NumInstructions + 2); - /* all but END */ - _mesa_copy_instructions(vpi, prog->Instructions, - prog->NumInstructions - 1); - /* END */ - _mesa_copy_instructions(&vpi[prog->NumInstructions + 1], - &prog->Instructions[prog->NumInstructions - 1], - 1); - vpi_insert = &vpi[prog->NumInstructions - 1]; + inst = &prog->Instructions[pos]; - vpi_insert[i].Opcode = OPCODE_MOV; + inst->Opcode = OPCODE_DP4; + inst->SrcReg[0].Swizzle = combine_swizzles4(inst->SrcReg[0].Swizzle, SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); - vpi_insert[i].DstReg.File = PROGRAM_OUTPUT; - vpi_insert[i].DstReg.Index = VERT_RESULT_HPOS; - vpi_insert[i].DstReg.WriteMask = WRITEMASK_XYZW; - vpi_insert[i].DstReg.CondMask = COND_TR; + return 0; +} + +static int translateDPH(struct gl_program *prog, int pos) +{ + struct prog_instruction *inst; + + inst = &prog->Instructions[pos]; + + inst->Opcode = OPCODE_DP4; + inst->SrcReg[0].Swizzle = combine_swizzles4(inst->SrcReg[0].Swizzle, SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); - vpi_insert[i].SrcReg[0].File = PROGRAM_TEMPORARY; - vpi_insert[i].SrcReg[0].Index = temp_index; - vpi_insert[i].SrcReg[0].Swizzle = SWIZZLE_XYZW; - i++; + return 0; +} - vpi_insert[i].Opcode = OPCODE_MOV; +static int translateFLR(struct gl_program *prog, int pos) +{ + struct prog_instruction *inst; + struct prog_dst_register dst; + int tmp_idx; - vpi_insert[i].DstReg.File = PROGRAM_OUTPUT; - vpi_insert[i].DstReg.Index = VERT_RESULT_TEX0 + vp->wpos_idx; - vpi_insert[i].DstReg.WriteMask = WRITEMASK_XYZW; - vpi_insert[i].DstReg.CondMask = COND_TR; + tmp_idx = prog->NumTemporaries++; - vpi_insert[i].SrcReg[0].File = PROGRAM_TEMPORARY; - vpi_insert[i].SrcReg[0].Index = temp_index; - vpi_insert[i].SrcReg[0].Swizzle = SWIZZLE_XYZW; - i++; + _mesa_insert_instructions(prog, pos + 1, 1); - free(prog->Instructions); + inst = &prog->Instructions[pos]; + dst = inst->DstReg; - prog->Instructions = vpi; + inst->Opcode = OPCODE_FRC; + inst->DstReg.File = PROGRAM_TEMPORARY; + inst->DstReg.Index = tmp_idx; + ++inst; - prog->NumInstructions += i; - vpi = &prog->Instructions[prog->NumInstructions - 1]; + inst->Opcode = OPCODE_ADD; + inst->DstReg = dst; + inst->SrcReg[0] = (inst-1)->SrcReg[0]; + inst->SrcReg[1].File = PROGRAM_TEMPORARY; + inst->SrcReg[1].Index = tmp_idx; + inst->SrcReg[1].Negate = NEGATE_XYZW; - assert(vpi->Opcode == OPCODE_END); + return 1; } -static void pos_as_texcoord(struct r300_vertex_program *vp, - struct gl_program *prog) +static int translateSUB(struct gl_program *prog, int pos) { - struct prog_instruction *vpi; - GLuint tempregi = prog->NumTemporaries; - /* should do something else if no temps left... */ - prog->NumTemporaries++; + struct prog_instruction *inst; - for (vpi = prog->Instructions; vpi->Opcode != OPCODE_END; vpi++) { - if (vpi->DstReg.File == PROGRAM_OUTPUT - && vpi->DstReg.Index == VERT_RESULT_HPOS) { - vpi->DstReg.File = PROGRAM_TEMPORARY; - vpi->DstReg.Index = tempregi; - } - } - insert_wpos(vp, prog, tempregi); + inst = &prog->Instructions[pos]; + + inst->Opcode = OPCODE_ADD; + inst->SrcReg[1].Negate ^= NEGATE_XYZW; + + return 0; } -static struct r300_vertex_program *build_program(struct r300_vertex_program_key - *wanted_key, struct gl_vertex_program - *mesa_vp, GLint wpos_idx) +static int translateSWZ(struct gl_program *prog, int pos) { - struct r300_vertex_program *vp; + prog->Instructions[pos].Opcode = OPCODE_MOV; - vp = _mesa_calloc(sizeof(*vp)); - _mesa_memcpy(&vp->key, wanted_key, sizeof(vp->key)); - vp->wpos_idx = wpos_idx; + return 0; +} - if (mesa_vp->IsPositionInvariant) { - position_invariant(&mesa_vp->Base); - } +static int translateXPD(struct gl_program *prog, int pos) +{ + struct prog_instruction *inst; + int tmp_idx; + + tmp_idx = prog->NumTemporaries++; + + _mesa_insert_instructions(prog, pos + 1, 1); + + inst = &prog->Instructions[pos]; + + *(inst+1) = *inst; + + inst->Opcode = OPCODE_MUL; + inst->DstReg.File = PROGRAM_TEMPORARY; + inst->DstReg.Index = tmp_idx; + inst->SrcReg[0].Swizzle = combine_swizzles4(inst->SrcReg[0].Swizzle, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_X, SWIZZLE_W); + inst->SrcReg[1].Swizzle = combine_swizzles4(inst->SrcReg[1].Swizzle, SWIZZLE_Z, SWIZZLE_X, SWIZZLE_Y, SWIZZLE_W); + ++inst; + + inst->Opcode = OPCODE_MAD; + inst->SrcReg[0].Swizzle = combine_swizzles4(inst->SrcReg[0].Swizzle, SWIZZLE_Z, SWIZZLE_X, SWIZZLE_Y, SWIZZLE_W); + inst->SrcReg[1].Swizzle = combine_swizzles4(inst->SrcReg[1].Swizzle, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_X, SWIZZLE_W); + inst->SrcReg[1].Negate ^= NEGATE_XYZW; + inst->SrcReg[2].File = PROGRAM_TEMPORARY; + inst->SrcReg[2].Index = tmp_idx; + + return 1; +} + +static void translateInsts(struct gl_program *prog) +{ + struct prog_instruction *inst; + int i; + + for (i = 0; i < prog->NumInstructions; ++i) { + inst = &prog->Instructions[i]; - if (wpos_idx > -1) { - pos_as_texcoord(vp, &mesa_vp->Base); + switch (inst->Opcode) { + case OPCODE_ABS: + i += translateABS(prog, i); + break; + case OPCODE_DP3: + i += translateDP3(prog, i); + break; + case OPCODE_DPH: + i += translateDPH(prog, i); + break; + case OPCODE_FLR: + i += translateFLR(prog, i); + break; + case OPCODE_SUB: + i += translateSUB(prog, i); + break; + case OPCODE_SWZ: + i += translateSWZ(prog, i); + break; + case OPCODE_XPD: + i += translateXPD(prog, i); + break; + default: + break; + } } +} - if (RADEON_DEBUG & DEBUG_VERTS) { - fprintf(stderr, "Vertex program after native rewrite:\n"); - _mesa_print_program(&mesa_vp->Base); - fflush(stdout); +#define ADD_OUTPUT(fp_attr, vp_result) \ + do { \ + if ((FpReads & (1 << (fp_attr))) && !(prog->OutputsWritten & (1 << (vp_result)))) { \ + OutputsAdded |= 1 << (vp_result); \ + count++; \ + } \ + } while (0) + +static void addArtificialOutputs(GLcontext *ctx, struct gl_program *prog) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + GLuint OutputsAdded, FpReads; + int i, count; + + OutputsAdded = 0; + count = 0; + FpReads = r300->selected_fp->Base->InputsRead; + + ADD_OUTPUT(FRAG_ATTRIB_COL0, VERT_RESULT_COL0); + ADD_OUTPUT(FRAG_ATTRIB_COL1, VERT_RESULT_COL1); + + for (i = 0; i < 7; ++i) { + ADD_OUTPUT(FRAG_ATTRIB_TEX0 + i, VERT_RESULT_TEX0 + i); } /* Some outputs may be artificially added, to match the inputs of the fragment program. * Issue 16 of vertex program spec says that all vertex attributes that are unwritten by * vertex program are undefined, so just use MOV [vertex_result], CONST[0] */ - { - int i, count = 0; + if (count > 0) { + struct prog_instruction *inst; + + _mesa_insert_instructions(prog, prog->NumInstructions - 1, count); + inst = &prog->Instructions[prog->NumInstructions - 1 - count]; + for (i = 0; i < VERT_RESULT_MAX; ++i) { - if (vp->key.OutputsAdded & (1 << i)) { - ++count; + if (OutputsAdded & (1 << i)) { + inst->Opcode = OPCODE_MOV; + + inst->DstReg.File = PROGRAM_OUTPUT; + inst->DstReg.Index = i; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->DstReg.CondMask = COND_TR; + + inst->SrcReg[0].File = PROGRAM_CONSTANT; + inst->SrcReg[0].Index = 0; + inst->SrcReg[0].Swizzle = SWIZZLE_XYZW; + + ++inst; } } - if (count > 0) { - struct prog_instruction *inst; + prog->OutputsWritten |= OutputsAdded; + } +} - _mesa_insert_instructions(&mesa_vp->Base, mesa_vp->Base.NumInstructions - 1, count); - inst = &mesa_vp->Base.Instructions[mesa_vp->Base.NumInstructions - 1 - count]; +#undef ADD_OUTPUT - for (i = 0; i < VERT_RESULT_MAX; ++i) { - if (vp->key.OutputsAdded & (1 << i)) { - inst->Opcode = OPCODE_MOV; +static void nqssadceInit(struct nqssadce_state* s) +{ + r300ContextPtr r300 = R300_CONTEXT(s->Ctx); + GLuint fp_reads; - inst->DstReg.File = PROGRAM_OUTPUT; - inst->DstReg.Index = i; - inst->DstReg.WriteMask = WRITEMASK_XYZW; - inst->DstReg.CondMask = COND_TR; + fp_reads = r300->selected_fp->Base->InputsRead; + { + if (fp_reads & FRAG_BIT_COL0) { + s->Outputs[VERT_RESULT_COL0].Sourced = WRITEMASK_XYZW; + s->Outputs[VERT_RESULT_BFC0].Sourced = WRITEMASK_XYZW; + } - inst->SrcReg[0].File = PROGRAM_CONSTANT; - inst->SrcReg[0].Index = 0; - inst->SrcReg[0].Swizzle = SWIZZLE_XYZW; + if (fp_reads & FRAG_BIT_COL1) { + s->Outputs[VERT_RESULT_COL1].Sourced = WRITEMASK_XYZW; + s->Outputs[VERT_RESULT_BFC1].Sourced = WRITEMASK_XYZW; + } + } - ++inst; - } + { + int i; + for (i = 0; i < 8; ++i) { + if (fp_reads & FRAG_BIT_TEX(i)) { + s->Outputs[VERT_RESULT_TEX0 + i].Sourced = WRITEMASK_XYZW; } } } - assert(mesa_vp->Base.NumInstructions); - vp->num_temporaries = mesa_vp->Base.NumTemporaries; - r300TranslateVertexShader(vp, mesa_vp->Base.Instructions); - - return vp; + s->Outputs[VERT_RESULT_HPOS].Sourced = WRITEMASK_XYZW; + if (s->Program->OutputsWritten & (1 << VERT_RESULT_PSIZ)) + s->Outputs[VERT_RESULT_PSIZ].Sourced = WRITEMASK_X; } -static void add_outputs(struct r300_vertex_program_key *key, GLint vert) +static GLboolean swizzleIsNative(GLuint opcode, struct prog_src_register reg) { - if (key->OutputsWritten & (1 << vert)) - return; + (void) opcode; + (void) reg; - key->OutputsWritten |= 1 << vert; - key->OutputsAdded |= 1 << vert; + return GL_TRUE; } -void r300SelectVertexShader(r300ContextPtr r300) +static struct r300_vertex_program *build_program(GLcontext *ctx, + struct r300_vertex_program_key *wanted_key, + const struct gl_vertex_program *mesa_vp) { - GLcontext *ctx = ctx = r300->radeon.glCtx; - GLuint InputsRead; - struct r300_vertex_program_key wanted_key = { 0 }; - GLint i; - struct r300_vertex_program_cont *vpc; + r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_vertex_program *vp; - GLint wpos_idx; + struct gl_program *prog; - vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current; - wanted_key.InputsRead = vpc->mesa_program.Base.InputsRead; - wanted_key.OutputsWritten = vpc->mesa_program.Base.OutputsWritten; - InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; - - wpos_idx = -1; - if (InputsRead & FRAG_BIT_WPOS) { - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) - if (!(InputsRead & (FRAG_BIT_TEX0 << i))) - break; + vp = _mesa_calloc(sizeof(*vp)); + vp->Base = (struct gl_vertex_program *) _mesa_clone_program(ctx, &mesa_vp->Base); + _mesa_memcpy(&vp->key, wanted_key, sizeof(vp->key)); - if (i == ctx->Const.MaxTextureUnits) { - fprintf(stderr, "\tno free texcoord found\n"); - _mesa_exit(-1); - } + prog = &vp->Base->Base; + + if (RADEON_DEBUG & DEBUG_VERTS) { + fprintf(stderr, "Initial vertex program:\n"); + _mesa_print_program(prog); + fflush(stdout); + } - wanted_key.OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i); - wpos_idx = i; + if (vp->Base->IsPositionInvariant) { + _mesa_insert_mvp_code(ctx, vp->Base); } - if (vpc->mesa_program.IsPositionInvariant) { - wanted_key.InputsRead |= (1 << VERT_ATTRIB_POS); - wanted_key.OutputsWritten |= (1 << VERT_RESULT_HPOS); - } else { - add_outputs(&wanted_key, VERT_RESULT_HPOS); + if (r300->selected_fp->wpos_attr != FRAG_ATTRIB_MAX) { + pos_as_texcoord(&vp->Base->Base, r300->selected_fp->wpos_attr - FRAG_ATTRIB_TEX0); } - if (InputsRead & FRAG_BIT_COL0) { - add_outputs(&wanted_key, VERT_RESULT_COL0); + if (r300->selected_fp->fog_attr != FRAG_ATTRIB_MAX) { + fog_as_texcoord(&vp->Base->Base, r300->selected_fp->fog_attr - FRAG_ATTRIB_TEX0); } - if (InputsRead & FRAG_BIT_COL1) { - add_outputs(&wanted_key, VERT_RESULT_COL1); + addArtificialOutputs(ctx, prog); + + translateInsts(prog); + + if (RADEON_DEBUG & DEBUG_VERTS) { + fprintf(stderr, "Vertex program after native rewrite:\n"); + _mesa_print_program(prog); + fflush(stdout); } - if (InputsRead & FRAG_BIT_FOGC) { - add_outputs(&wanted_key, VERT_RESULT_FOGC); + { + struct radeon_nqssadce_descr nqssadce = { + .Init = &nqssadceInit, + .IsNativeSwizzle = &swizzleIsNative, + .BuildSwizzle = NULL + }; + radeonNqssaDce(ctx, prog, &nqssadce); + + /* We need this step for reusing temporary registers */ + _mesa_optimize_program(ctx, prog); + + if (RADEON_DEBUG & DEBUG_VERTS) { + fprintf(stderr, "Vertex program after NQSSADCE:\n"); + _mesa_print_program(prog); + fflush(stdout); + } } - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (InputsRead & (FRAG_BIT_TEX0 << i)) { - add_outputs(&wanted_key, VERT_RESULT_TEX0 + i); + assert(prog->NumInstructions); + { + struct prog_instruction *inst; + int max, i, tmp; + + inst = prog->Instructions; + max = -1; + while (inst->Opcode != OPCODE_END) { + tmp = _mesa_num_inst_src_regs(inst->Opcode); + for (i = 0; i < tmp; ++i) { + if (inst->SrcReg[i].File == PROGRAM_TEMPORARY) { + if ((int) inst->SrcReg[i].Index > max) { + max = inst->SrcReg[i].Index; + } + } + } + + if (_mesa_num_inst_dst_regs(inst->Opcode)) { + if (inst->DstReg.File == PROGRAM_TEMPORARY) { + if ((int) inst->DstReg.Index > max) { + max = inst->DstReg.Index; + } + } + } + ++inst; } + + /* We actually want highest index of used temporary register, + * not the number of temporaries used. + * These values aren't always the same. + */ + vp->num_temporaries = max + 1; } - for (vp = vpc->progs; vp; vp = vp->next) + return vp; +} + +struct r300_vertex_program * r300SelectVertexShader(GLcontext *ctx) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_vertex_program_key wanted_key = { 0 }; + struct r300_vertex_program_cont *vpc; + struct r300_vertex_program *vp; + + vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current; + wanted_key.FpReads = r300->selected_fp->Base->InputsRead; + wanted_key.FogAttr = r300->selected_fp->fog_attr; + wanted_key.WPosAttr = r300->selected_fp->wpos_attr; + + for (vp = vpc->progs; vp; vp = vp->next) { if (_mesa_memcmp(&vp->key, &wanted_key, sizeof(wanted_key)) == 0) { - r300->selected_vp = vp; - return; + return r300->selected_vp = vp; } - - if (RADEON_DEBUG & DEBUG_VERTS) { - fprintf(stderr, "Initial vertex program:\n"); - _mesa_print_program(&vpc->mesa_program.Base); - fflush(stdout); } - vp = build_program(&wanted_key, &vpc->mesa_program, wpos_idx); + vp = build_program(ctx, &wanted_key, &vpc->mesa_program); vp->next = vpc->progs; vpc->progs = vp; - r300->selected_vp = vp; + + return r300->selected_vp = vp; } #define bump_vpu_count(ptr, new_count) do { \ @@ -1544,25 +1701,22 @@ void r300SetupVertexProgram(r300ContextPtr rmesa) struct r300_vertex_program *prog = rmesa->selected_vp; int inst_count = 0; int param_count = 0; - + /* Reset state, in case we don't use something */ ((drm_r300_cmd_header_t *) rmesa->hw.vpp.cmd)->vpu.count = 0; ((drm_r300_cmd_header_t *) rmesa->hw.vpi.cmd)->vpu.count = 0; ((drm_r300_cmd_header_t *) rmesa->hw.vps.cmd)->vpu.count = 0; - + R300_STATECHANGE(rmesa, vpp); - param_count = r300VertexProgUpdateParams(ctx, - (struct r300_vertex_program_cont *) - ctx->VertexProgram._Current, - (float *)&rmesa->hw.vpp.cmd[R300_VPP_PARAM_0]); + param_count = r300VertexProgUpdateParams(ctx, prog->Base, (float *)&rmesa->hw.vpp.cmd[R300_VPP_PARAM_0]); bump_vpu_count(rmesa->hw.vpp.cmd, param_count); param_count /= 4; r300EmitVertexProgram(rmesa, R300_PVS_CODE_START, &(prog->hw_code)); inst_count = (prog->hw_code.length / 4) - 1; - r300VapCntl(rmesa, _mesa_bitcount(prog->key.InputsRead), - _mesa_bitcount(prog->key.OutputsWritten), prog->num_temporaries); + r300VapCntl(rmesa, _mesa_bitcount(prog->Base->Base.InputsRead), + _mesa_bitcount(prog->Base->Base.OutputsWritten), prog->num_temporaries); R300_STATECHANGE(rmesa, pvs); rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = (0 << R300_PVS_FIRST_INST_SHIFT) | (inst_count << R300_PVS_XYZW_VALID_INST_SHIFT) | diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index b552e3fb1bd..2dab11c3378 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -34,4 +34,8 @@ void r300SetupVertexProgram(r300ContextPtr rmesa); +struct r300_vertex_program * r300SelectVertexShader(GLcontext *ctx); + +void r300TranslateVertexShader(struct r300_vertex_program *vp); + #endif diff --git a/src/mesa/drivers/dri/r300/radeon_nqssadce.c b/src/mesa/drivers/dri/r300/radeon_nqssadce.c index 4a2e1cba402..840c9733b16 100644 --- a/src/mesa/drivers/dri/r300/radeon_nqssadce.c +++ b/src/mesa/drivers/dri/r300/radeon_nqssadce.c @@ -46,6 +46,7 @@ static struct register_state *get_reg_state(struct nqssadce_state* s, GLuint fil switch(file) { case PROGRAM_TEMPORARY: return &s->Temps[index]; case PROGRAM_OUTPUT: return &s->Outputs[index]; + case PROGRAM_ADDRESS: return &s->Address; default: return 0; } } @@ -56,7 +57,7 @@ static struct register_state *get_reg_state(struct nqssadce_state* s, GLuint fil * * @note Works correctly only for X, Y, Z, W swizzles, not for constant swizzles. */ -static struct prog_src_register lmul_swizzle(GLuint swizzle, struct prog_src_register srcreg) +struct prog_src_register lmul_swizzle(GLuint swizzle, struct prog_src_register srcreg) { struct prog_src_register tmp = srcreg; int i; @@ -114,47 +115,19 @@ static struct prog_instruction* track_used_srcreg(struct nqssadce_state* s, deswz_source = sourced; } - struct register_state *regstate = get_reg_state(s, inst->SrcReg[src].File, inst->SrcReg[src].Index); + struct register_state *regstate; + + if (inst->SrcReg[src].RelAddr) + regstate = get_reg_state(s, PROGRAM_ADDRESS, 0); + else + regstate = get_reg_state(s, inst->SrcReg[src].File, inst->SrcReg[src].Index); + if (regstate) regstate->Sourced |= deswz_source & 0xf; return inst; } - -static void rewrite_depth_out(struct prog_instruction *inst) -{ - if (inst->DstReg.WriteMask & WRITEMASK_Z) { - inst->DstReg.WriteMask = WRITEMASK_W; - } else { - inst->DstReg.WriteMask = 0; - return; - } - - switch (inst->Opcode) { - case OPCODE_FRC: - case OPCODE_MOV: - inst->SrcReg[0] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[0]); - break; - case OPCODE_ADD: - case OPCODE_MAX: - case OPCODE_MIN: - case OPCODE_MUL: - inst->SrcReg[0] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[0]); - inst->SrcReg[1] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[1]); - break; - case OPCODE_CMP: - case OPCODE_MAD: - inst->SrcReg[0] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[0]); - inst->SrcReg[1] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[1]); - inst->SrcReg[2] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[2]); - break; - default: - // Scalar instructions needn't be reswizzled - break; - } -} - static void unalias_srcregs(struct prog_instruction *inst, GLuint oldindex, GLuint newindex) { int nsrc = _mesa_num_inst_src_regs(inst->Opcode); @@ -189,11 +162,6 @@ static void process_instruction(struct nqssadce_state* s) return; if (inst->Opcode != OPCODE_KIL) { - if (s->Descr->RewriteDepthOut) { - if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPTH) - rewrite_depth_out(inst); - } - struct register_state *regstate = get_reg_state(s, inst->DstReg.File, inst->DstReg.Index); if (!regstate) { _mesa_problem(s->Ctx, "NqssaDce: bad destination register (%i[%i])\n", @@ -217,6 +185,7 @@ static void process_instruction(struct nqssadce_state* s) * might change the instruction stream under us, so we have * to be careful with the inst pointer. */ switch (inst->Opcode) { + case OPCODE_ARL: case OPCODE_DDX: case OPCODE_DDY: case OPCODE_FRC: @@ -227,6 +196,8 @@ static void process_instruction(struct nqssadce_state* s) case OPCODE_MAX: case OPCODE_MIN: case OPCODE_MUL: + case OPCODE_SGE: + case OPCODE_SLT: inst = track_used_srcreg(s, inst, 0, inst->DstReg.WriteMask); inst = track_used_srcreg(s, inst, 1, inst->DstReg.WriteMask); break; @@ -258,12 +229,51 @@ static void process_instruction(struct nqssadce_state* s) case OPCODE_TXP: inst = track_used_srcreg(s, inst, 0, 0xf); break; + case OPCODE_DST: + inst = track_used_srcreg(s, inst, 0, 0x6); + inst = track_used_srcreg(s, inst, 1, 0xa); + break; + case OPCODE_EXP: + case OPCODE_LOG: + case OPCODE_POW: + inst = track_used_srcreg(s, inst, 0, 0x3); + break; + case OPCODE_LIT: + inst = track_used_srcreg(s, inst, 0, 0xb); + break; default: _mesa_problem(s->Ctx, "NqssaDce: Unknown opcode %d\n", inst->Opcode); return; } } +static void calculateInputsOutputs(struct gl_program *p) +{ + struct prog_instruction *inst; + GLuint InputsRead, OutputsWritten; + + inst = p->Instructions; + InputsRead = 0; + OutputsWritten = 0; + while (inst->Opcode != OPCODE_END) + { + int i, num_src_regs; + + num_src_regs = _mesa_num_inst_src_regs(inst->Opcode); + for (i = 0; i < num_src_regs; ++i) { + if (inst->SrcReg[i].File == PROGRAM_INPUT) + InputsRead |= 1 << inst->SrcReg[i].Index; + } + + if (inst->DstReg.File == PROGRAM_OUTPUT) + OutputsWritten |= 1 << inst->DstReg.Index; + + ++inst; + } + + p->InputsRead = InputsRead; + p->OutputsWritten = OutputsWritten; +} void radeonNqssaDce(GLcontext *ctx, struct gl_program *p, struct radeon_nqssadce_descr* descr) { @@ -280,4 +290,6 @@ void radeonNqssaDce(GLcontext *ctx, struct gl_program *p, struct radeon_nqssadce s.IP--; process_instruction(&s); } + + calculateInputsOutputs(p); } diff --git a/src/mesa/drivers/dri/r300/radeon_nqssadce.h b/src/mesa/drivers/dri/r300/radeon_nqssadce.h index a4f94abcb62..8626f21c25e 100644 --- a/src/mesa/drivers/dri/r300/radeon_nqssadce.h +++ b/src/mesa/drivers/dri/r300/radeon_nqssadce.h @@ -58,6 +58,7 @@ struct nqssadce_state { */ struct register_state Temps[MAX_PROGRAM_TEMPS]; struct register_state Outputs[VERT_RESULT_MAX]; + struct register_state Address; }; @@ -83,14 +84,10 @@ struct radeon_nqssadce_descr { */ void (*BuildSwizzle)(struct nqssadce_state*, struct prog_dst_register dst, struct prog_src_register src); - /** - * Rewrite instructions that write to DEPR.z to write to DEPR.w - * instead (rewriting is done *before* the WriteMask test). - */ - GLboolean RewriteDepthOut; void *Data; }; void radeonNqssaDce(GLcontext *ctx, struct gl_program *p, struct radeon_nqssadce_descr* descr); +struct prog_src_register lmul_swizzle(GLuint swizzle, struct prog_src_register srcreg); #endif /* __RADEON_PROGRAM_NQSSADCE_H_ */ diff --git a/src/mesa/drivers/dri/r300/radeon_program.h b/src/mesa/drivers/dri/r300/radeon_program.h index b411f69bc88..88474d43a22 100644 --- a/src/mesa/drivers/dri/r300/radeon_program.h +++ b/src/mesa/drivers/dri/r300/radeon_program.h @@ -52,6 +52,38 @@ enum { #define SWIZZLE_0000 MAKE_SWIZZLE4(SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO) #define SWIZZLE_1111 MAKE_SWIZZLE4(SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE) +static inline GLuint get_swz(GLuint swz, GLuint idx) +{ + if (idx & 0x4) + return idx; + return GET_SWZ(swz, idx); +} + +static inline GLuint combine_swizzles4(GLuint src, GLuint swz_x, GLuint swz_y, GLuint swz_z, GLuint swz_w) +{ + GLuint ret = 0; + + ret |= get_swz(src, swz_x); + ret |= get_swz(src, swz_y) << 3; + ret |= get_swz(src, swz_z) << 6; + ret |= get_swz(src, swz_w) << 9; + + return ret; +} + +static inline GLuint combine_swizzles(GLuint src, GLuint swz) +{ + GLuint ret = 0; + + ret |= get_swz(src, GET_SWZ(swz, SWIZZLE_X)); + ret |= get_swz(src, GET_SWZ(swz, SWIZZLE_Y)) << 3; + ret |= get_swz(src, GET_SWZ(swz, SWIZZLE_Z)) << 6; + ret |= get_swz(src, GET_SWZ(swz, SWIZZLE_W)) << 9; + + return ret; +} + + /** * Transformation context that is passed to local transformations. * diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c b/src/mesa/drivers/dri/r300/radeon_program_pair.c index 906d36e5226..d6fb474cf23 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c @@ -870,7 +870,7 @@ GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program, _mesa_bzero(&s, sizeof(s)); s.Ctx = ctx; - s.Program = program; + s.Program = _mesa_clone_program(ctx, program); s.Handler = handler; s.UserData = userdata; s.Debug = (RADEON_DEBUG & DEBUG_PIXEL) ? GL_TRUE : GL_FALSE; @@ -904,6 +904,8 @@ GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program, _mesa_free(s.ValuePool); _mesa_free(s.ReaderPool); + _mesa_reference_program(ctx, &s.Program, NULL); + return !s.Error; } diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c index 7f25cb18682..ed51e428e9a 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.c +++ b/src/mesa/drivers/dri/r600/r600_emit.c @@ -98,13 +98,12 @@ shader_again_alloc: goto shader_again_alloc; } - radeon_validate_bo(radeonctx, pbo, RADEON_GEM_DOMAIN_GTT, 0); + if (radeon_cs_space_check_with_bo(radeonctx->cmdbuf.cs, + pbo, + RADEON_GEM_DOMAIN_GTT, 0)) + fprintf(stderr,"failure to revalidate BOs - badness\n"); + - if (radeon_revalidate_bos(radeonctx->glCtx) == GL_FALSE) - { - fprintf(stderr,"failure to revalidate BOs - badness\n"); - } - radeon_bo_map(pbo, 1); radeon_bo_ref(pbo); diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 5a249d4f14f..f56cc970d40 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -541,23 +541,26 @@ GLboolean r600ValidateBuffers(GLcontext * ctx) context_t *rmesa = R700_CONTEXT(ctx); struct radeon_renderbuffer *rrb; int i; + int ret; - radeon_validate_reset_bos(&rmesa->radeon); + radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs); rrb = radeon_get_colorbuffer(&rmesa->radeon); /* color buffer */ if (rrb && rrb->bo) { - radeon_validate_bo(&rmesa->radeon, rrb->bo, - 0, RADEON_GEM_DOMAIN_VRAM); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + rrb->bo, 0, + RADEON_GEM_DOMAIN_VRAM); } /* depth buffer */ rrb = radeon_get_depthbuffer(&rmesa->radeon); if (rrb && rrb->bo) { - radeon_validate_bo(&rmesa->radeon, rrb->bo, - 0, RADEON_GEM_DOMAIN_VRAM); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + rrb->bo, 0, + RADEON_GEM_DOMAIN_VRAM); } - + for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { radeonTexObj *t; @@ -571,17 +574,19 @@ GLboolean r600ValidateBuffers(GLcontext * ctx) } t = radeon_tex_obj(ctx->Texture.Unit[i]._Current); if (t->image_override && t->bo) - radeon_validate_bo(&rmesa->radeon, t->bo, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + t->bo, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); else if (t->mt->bo) - radeon_validate_bo(&rmesa->radeon, t->mt->bo, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, + t->mt->bo, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); } - if (rmesa->radeon.dma.current) - radeon_validate_bo(&rmesa->radeon, rmesa->radeon.dma.current, RADEON_GEM_DOMAIN_GTT, 0); - return radeon_revalidate_bos(ctx); + ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, rmesa->radeon.dma.current, RADEON_GEM_DOMAIN_GTT, 0); + if (ret) + return GL_FALSE; + return GL_TRUE; } void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname, @@ -714,7 +719,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo rImage->mt = NULL; } _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->width, rb->height, 1, 0, rb->cpp); + rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx, internalFormat, @@ -779,9 +784,9 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; SETfield(t->SQ_TEX_RESOURCE0, (pitch_val/8)-1, PITCH_shift, PITCH_mask); - SETfield(t->SQ_TEX_RESOURCE0, rb->width - 1, + SETfield(t->SQ_TEX_RESOURCE0, rb->base.Width - 1, TEX_WIDTH_shift, TEX_WIDTH_mask); - SETfield(t->SQ_TEX_RESOURCE1, rb->height - 1, + SETfield(t->SQ_TEX_RESOURCE1, rb->base.Height - 1, TEX_HEIGHT_shift, TEX_HEIGHT_mask); t->validated = GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/r700_clear.c b/src/mesa/drivers/dri/r600/r700_clear.c index 76967956761..e484845cc6c 100644 --- a/src/mesa/drivers/dri/r600/r700_clear.c +++ b/src/mesa/drivers/dri/r600/r700_clear.c @@ -44,11 +44,6 @@ static GLboolean r700ClearFast(context_t *context, GLbitfield mask) return GL_FALSE; } -static void r700UserClear(GLcontext *ctx, GLuint mask) -{ - radeon_clear_tris(ctx, mask); -} - #define R600_NEWPRIM( rmesa ) \ do { \ if ( rmesa->radeon.dma.flush ) \ @@ -80,6 +75,8 @@ void r700Clear(GLcontext * ctx, GLbitfield mask) if (colorMask == ~0) tri_mask |= (mask & BUFFER_BITS_COLOR); + else + tri_mask |= (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)); /* HW stencil */ @@ -109,8 +106,10 @@ void r700Clear(GLcontext * ctx, GLbitfield mask) /* SW fallback clearing */ swrast_mask = mask & ~tri_mask; - if (tri_mask) - r700UserClear(ctx, tri_mask); + if (tri_mask) { + radeonUserClear(ctx, tri_mask); + } + if (swrast_mask) { if (RADEON_DEBUG & DEBUG_FALLBACKS) fprintf(stderr, "%s: swrast clear, mask: %x\n", diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile index ba409ba8130..b59ad68f445 100644 --- a/src/mesa/drivers/dri/radeon/Makefile +++ b/src/mesa/drivers/dri/radeon/Makefile @@ -10,6 +10,10 @@ LIBNAME = radeon_dri.so MINIGLX_SOURCES = server/radeon_dri.c +ifeq ($(RADEON_LDFLAGS),) +CS_SOURCES = radeon_cs_space_drm.c +endif + RADEON_COMMON_SOURCES = \ radeon_texture.c \ radeon_common_context.c \ @@ -38,7 +42,8 @@ DRIVER_SOURCES = \ C_SOURCES = \ $(COMMON_SOURCES) \ - $(DRIVER_SOURCES) + $(DRIVER_SOURCES) \ + $(CS_SOURCES) DRIVER_DEFINES = -DRADEON_COMMON=0 diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_drm.h b/src/mesa/drivers/dri/radeon/radeon_bo_drm.h index 5720957c78a..655b52a6694 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bo_drm.h +++ b/src/mesa/drivers/dri/radeon/radeon_bo_drm.h @@ -82,6 +82,7 @@ struct radeon_bo_funcs { int (*bo_map)(struct radeon_bo *bo, int write); int (*bo_unmap)(struct radeon_bo *bo); int (*bo_wait)(struct radeon_bo *bo); + int (*bo_is_static)(struct radeon_bo *bo); }; struct radeon_bo_manager { @@ -185,6 +186,7 @@ static inline int _radeon_bo_wait(struct radeon_bo *bo, { return bo->bom->funcs->bo_wait(bo); } + #ifdef RADEON_DEBUG_BO #define radeon_bo_open(bom, h, s, a, d, f, u)\ _radeon_bo_open(bom, h, s, a, d, f, u, __FILE__, __FUNCTION__, __LINE__) diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c index 94c2d978256..992eb4611b1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c @@ -562,12 +562,21 @@ static int bo_unmap(struct radeon_bo *bo) return 0; } + +static int bo_is_static(struct radeon_bo *bo) +{ + struct bo_legacy *bo_legacy = (struct bo_legacy*)bo; + return bo_legacy->static_bo; +} + static struct radeon_bo_funcs bo_legacy_funcs = { bo_open, bo_ref, bo_unref, bo_map, - bo_unmap + bo_unmap, + NULL, + bo_is_static, }; static int bo_vram_validate(struct radeon_bo *bo, @@ -895,9 +904,3 @@ unsigned radeon_bo_legacy_relocs_size(struct radeon_bo *bo) return bo->size; } -int radeon_legacy_bo_is_static(struct radeon_bo *bo) -{ - struct bo_legacy *bo_legacy = (struct bo_legacy*)bo; - return bo_legacy->static_bo; -} - diff --git a/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h b/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h index 6f1a0b45358..e0c70dd9a11 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h +++ b/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h @@ -1,21 +1,6 @@ #ifndef RADEON_CS_WRAPPER_H #define RADEON_CS_WRAPPER_H -#ifndef RADEON_PARAM_DEVICE_ID -#define RADEON_PARAM_DEVICE_ID 16 -#endif - -#ifndef RADEON_INFO_DEVICE_ID -#define RADEON_INFO_DEVICE_ID 0 -#endif -#ifndef RADEON_INFO_NUM_GB_PIPES -#define RADEON_INFO_NUM_GB_PIPES 0 -#endif - -#ifndef DRM_RADEON_INFO -#define DRM_RADEON_INFO 0x1 -#endif - #ifdef HAVE_LIBDRM_RADEON #include "radeon_bo.h" @@ -50,6 +35,21 @@ struct drm_radeon_info { }; #endif +#ifndef RADEON_PARAM_DEVICE_ID +#define RADEON_PARAM_DEVICE_ID 16 +#endif + +#ifndef RADEON_INFO_DEVICE_ID +#define RADEON_INFO_DEVICE_ID 0 +#endif +#ifndef RADEON_INFO_NUM_GB_PIPES +#define RADEON_INFO_NUM_GB_PIPES 0 +#endif + +#ifndef DRM_RADEON_INFO +#define DRM_RADEON_INFO 0x1 +#endif + static inline uint32_t radeon_gem_name_bo(struct radeon_bo *dummy) { diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 59ae7814aa3..dde615a4d9d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -45,6 +45,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/glheader.h" #include "main/imports.h" #include "main/context.h" +#include "main/arrayobj.h" #include "main/api_arrayelt.h" #include "main/enums.h" #include "main/colormac.h" @@ -221,7 +222,7 @@ void radeonUpdateScissor( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - if ( radeon_get_drawable(rmesa) ) { + if ( !ctx->DrawBuffer->Name ) { __DRIdrawablePrivate *dPriv = radeon_get_drawable(rmesa); int x = ctx->Scissor.X; @@ -233,9 +234,14 @@ void radeonUpdateScissor( GLcontext *ctx ) rmesa->state.scissor.rect.y1 = y + dPriv->y; rmesa->state.scissor.rect.x2 = w + dPriv->x + 1; rmesa->state.scissor.rect.y2 = h + dPriv->y + 1; - - radeonRecalcScissorRects( rmesa ); + } else { + rmesa->state.scissor.rect.x1 = ctx->Scissor.X; + rmesa->state.scissor.rect.y1 = ctx->Scissor.Y; + rmesa->state.scissor.rect.x2 = ctx->Scissor.X + ctx->Scissor.Width; + rmesa->state.scissor.rect.y2 = ctx->Scissor.Y + ctx->Scissor.Height; } + + radeonRecalcScissorRects( rmesa ); } /* ============================================================= @@ -739,7 +745,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) } if (fb->_StencilBuffer && fb->_StencilBuffer->Wrapped) { - rrbStencil = radeon_renderbuffer(fb->_DepthBuffer->Wrapped); + rrbStencil = radeon_renderbuffer(fb->_StencilBuffer->Wrapped); if (rrbStencil && rrbStencil->bo) { radeon->vtbl.fallback(ctx, RADEON_FALLBACK_STENCIL_BUFFER, GL_FALSE); /* need to re-compute stencil hw state */ @@ -771,9 +777,8 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) ctx->Driver.Enable(ctx, GL_DEPTH_TEST, (ctx->Depth.Test && fb->Visual.depthBits > 0)); /* Need to update the derived ctx->Stencil._Enabled first */ - _mesa_update_stencil(ctx); ctx->Driver.Enable(ctx, GL_STENCIL_TEST, - (ctx->Stencil._Enabled && fb->Visual.stencilBits > 0)); + (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0)); } else { ctx->NewState |= (_NEW_DEPTH | _NEW_STENCIL); } @@ -844,6 +849,17 @@ void radeonDrawBuffer( GLcontext *ctx, GLenum mode ) void radeonReadBuffer( GLcontext *ctx, GLenum mode ) { + if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { + struct radeon_context *const rmesa = RADEON_CONTEXT(ctx); + const GLboolean was_front_buffer_reading = rmesa->is_front_buffer_reading; + rmesa->is_front_buffer_reading = (mode == GL_FRONT_LEFT) + || (mode == GL_FRONT); + + if (!was_front_buffer_reading && rmesa->is_front_buffer_reading) { + radeon_update_renderbuffers(rmesa->dri.context, + rmesa->dri.context->driReadablePriv); + } + } /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ if (ctx->ReadBuffer == ctx->DrawBuffer) { /* This will update FBO completeness status. @@ -887,9 +903,14 @@ void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei he if (!driContext->driScreenPriv->dri2.enabled) return; - radeon_update_renderbuffers(driContext, driContext->driDrawablePriv); - if (driContext->driDrawablePriv != driContext->driReadablePriv) - radeon_update_renderbuffers(driContext, driContext->driReadablePriv); + if (!radeon->meta.internal_viewport_call && ctx->DrawBuffer->Name == 0) { + if (radeon->is_front_buffer_rendering) { + radeonFlush(ctx); + } + radeon_update_renderbuffers(driContext, driContext->driDrawablePriv); + if (driContext->driDrawablePriv != driContext->driReadablePriv) + radeon_update_renderbuffers(driContext, driContext->driReadablePriv); + } old_viewport = ctx->Driver.Viewport; ctx->Driver.Viewport = NULL; @@ -989,52 +1010,17 @@ static INLINE void radeonEmitAtoms(radeonContextPtr radeon, GLboolean dirty) COMMIT_BATCH(); } -GLboolean radeon_revalidate_bos(GLcontext *ctx) +static GLboolean radeon_revalidate_bos(GLcontext *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); - int flushed = 0; int ret; -again: - ret = radeon_cs_space_check(radeon->cmdbuf.cs, radeon->state.bos, radeon->state.validated_bo_count); - if (ret == RADEON_CS_SPACE_OP_TO_BIG) + + ret = radeon_cs_space_check(radeon->cmdbuf.cs); + if (ret == RADEON_CS_SPACE_FLUSH) return GL_FALSE; - if (ret == RADEON_CS_SPACE_FLUSH) { - if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); /* +r6/r7 */ - if (flushed) - return GL_FALSE; - flushed = 1; - goto again; - } return GL_TRUE; } -void radeon_validate_reset_bos(radeonContextPtr radeon) -{ - int i; - - for (i = 0; i < radeon->state.validated_bo_count; i++) { - radeon_bo_unref(radeon->state.bos[i].bo); - radeon->state.bos[i].bo = NULL; - radeon->state.bos[i].read_domains = 0; - radeon->state.bos[i].write_domain = 0; - radeon->state.bos[i].new_accounted = 0; - } - radeon->state.validated_bo_count = 0; -} - -void radeon_validate_bo(radeonContextPtr radeon, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain) -{ - radeon_bo_ref(bo); - radeon->state.bos[radeon->state.validated_bo_count].bo = bo; - radeon->state.bos[radeon->state.validated_bo_count].read_domains = read_domains; - radeon->state.bos[radeon->state.validated_bo_count].write_domain = write_domain; - radeon->state.bos[radeon->state.validated_bo_count].new_accounted = 0; - radeon->state.validated_bo_count++; - - assert(radeon->state.validated_bo_count < RADEON_MAX_BOS); -} - void radeonEmitState(radeonContextPtr radeon) { if (RADEON_DEBUG & (DEBUG_STATE|DEBUG_PRIMS)) @@ -1249,6 +1235,9 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa) assert(rmesa->cmdbuf.cs != NULL); rmesa->cmdbuf.size = size; + radeon_cs_space_set_flush(rmesa->cmdbuf.cs, + (void (*)(void *))radeonFlush, rmesa->glCtx); + if (!rmesa->radeonScreen->kernel_mm) { radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_VRAM, rmesa->radeonScreen->texSize[0]); radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_GTT, rmesa->radeonScreen->gartTextures.size); @@ -1296,228 +1285,8 @@ void rcommonBeginBatch(radeonContextPtr rmesa, int n, } - - -static void -radeon_meta_set_passthrough_transform(radeonContextPtr radeon) -{ - GLcontext *ctx = radeon->glCtx; - - radeon->meta.saved_vp_x = ctx->Viewport.X; - radeon->meta.saved_vp_y = ctx->Viewport.Y; - radeon->meta.saved_vp_width = ctx->Viewport.Width; - radeon->meta.saved_vp_height = ctx->Viewport.Height; - radeon->meta.saved_matrix_mode = ctx->Transform.MatrixMode; - - _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); - - _mesa_MatrixMode(GL_PROJECTION); - _mesa_PushMatrix(); - _mesa_LoadIdentity(); - _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1); - - _mesa_MatrixMode(GL_MODELVIEW); - _mesa_PushMatrix(); - _mesa_LoadIdentity(); -} - -static void -radeon_meta_restore_transform(radeonContextPtr radeon) -{ - _mesa_MatrixMode(GL_PROJECTION); - _mesa_PopMatrix(); - _mesa_MatrixMode(GL_MODELVIEW); - _mesa_PopMatrix(); - - _mesa_MatrixMode(radeon->meta.saved_matrix_mode); - - _mesa_Viewport(radeon->meta.saved_vp_x, radeon->meta.saved_vp_y, - radeon->meta.saved_vp_width, radeon->meta.saved_vp_height); -} - - -/** - * Perform glClear where mask contains only color, depth, and/or stencil. - * - * The implementation is based on calling into Mesa to set GL state and - * performing normal triangle rendering. The intent of this path is to - * have as generic a path as possible, so that any driver could make use of - * it. - */ - - -void radeon_clear_tris(GLcontext *ctx, GLbitfield mask) +void radeonUserClear(GLcontext *ctx, GLuint mask) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - GLfloat vertices[4][3]; - GLfloat color[4][4]; - GLfloat dst_z; - struct gl_framebuffer *fb = ctx->DrawBuffer; - int i; - GLboolean saved_fp_enable = GL_FALSE, saved_vp_enable = GL_FALSE; - GLboolean saved_shader_program = 0; - unsigned int saved_active_texture; - - assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH | - BUFFER_BIT_STENCIL)) == 0); - - _mesa_PushAttrib(GL_COLOR_BUFFER_BIT | - GL_CURRENT_BIT | - GL_DEPTH_BUFFER_BIT | - GL_ENABLE_BIT | - GL_POLYGON_BIT | - GL_STENCIL_BUFFER_BIT | - GL_TRANSFORM_BIT | - GL_CURRENT_BIT); - _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); - saved_active_texture = ctx->Texture.CurrentUnit; - - /* Disable existing GL state we don't want to apply to a clear. */ - _mesa_Disable(GL_ALPHA_TEST); - _mesa_Disable(GL_BLEND); - _mesa_Disable(GL_CULL_FACE); - _mesa_Disable(GL_FOG); - _mesa_Disable(GL_POLYGON_SMOOTH); - _mesa_Disable(GL_POLYGON_STIPPLE); - _mesa_Disable(GL_POLYGON_OFFSET_FILL); - _mesa_Disable(GL_LIGHTING); - _mesa_Disable(GL_CLIP_PLANE0); - _mesa_Disable(GL_CLIP_PLANE1); - _mesa_Disable(GL_CLIP_PLANE2); - _mesa_Disable(GL_CLIP_PLANE3); - _mesa_Disable(GL_CLIP_PLANE4); - _mesa_Disable(GL_CLIP_PLANE5); - _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); - if (ctx->Extensions.ARB_fragment_program && ctx->FragmentProgram.Enabled) { - saved_fp_enable = GL_TRUE; - _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); - } - if (ctx->Extensions.ARB_vertex_program && ctx->VertexProgram.Enabled) { - saved_vp_enable = GL_TRUE; - _mesa_Disable(GL_VERTEX_PROGRAM_ARB); - } - if (ctx->Extensions.ARB_shader_objects && ctx->Shader.CurrentProgram) { - saved_shader_program = ctx->Shader.CurrentProgram->Name; - _mesa_UseProgramObjectARB(0); - } - - if (ctx->Texture._EnabledUnits != 0) { - int i; - - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - _mesa_ActiveTextureARB(GL_TEXTURE0 + i); - _mesa_Disable(GL_TEXTURE_1D); - _mesa_Disable(GL_TEXTURE_2D); - _mesa_Disable(GL_TEXTURE_3D); - if (ctx->Extensions.ARB_texture_cube_map) - _mesa_Disable(GL_TEXTURE_CUBE_MAP_ARB); - if (ctx->Extensions.NV_texture_rectangle) - _mesa_Disable(GL_TEXTURE_RECTANGLE_NV); - if (ctx->Extensions.MESA_texture_array) { - _mesa_Disable(GL_TEXTURE_1D_ARRAY_EXT); - _mesa_Disable(GL_TEXTURE_2D_ARRAY_EXT); - } - } - } - -#if FEATURE_ARB_vertex_buffer_object - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); -#endif - - radeon_meta_set_passthrough_transform(rmesa); - - for (i = 0; i < 4; i++) { - color[i][0] = ctx->Color.ClearColor[0]; - color[i][1] = ctx->Color.ClearColor[1]; - color[i][2] = ctx->Color.ClearColor[2]; - color[i][3] = ctx->Color.ClearColor[3]; - } - - /* convert clear Z from [0,1] to NDC coord in [-1,1] */ - - dst_z = -1.0 + 2.0 * ctx->Depth.Clear; - /* Prepare the vertices, which are the same regardless of which buffer we're - * drawing to. - */ - vertices[0][0] = fb->_Xmin; - vertices[0][1] = fb->_Ymin; - vertices[0][2] = dst_z; - vertices[1][0] = fb->_Xmax; - vertices[1][1] = fb->_Ymin; - vertices[1][2] = dst_z; - vertices[2][0] = fb->_Xmax; - vertices[2][1] = fb->_Ymax; - vertices[2][2] = dst_z; - vertices[3][0] = fb->_Xmin; - vertices[3][1] = fb->_Ymax; - vertices[3][2] = dst_z; - - _mesa_ColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &color); - _mesa_VertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), &vertices); - _mesa_Enable(GL_COLOR_ARRAY); - _mesa_Enable(GL_VERTEX_ARRAY); - - while (mask != 0) { - GLuint this_mask = 0; - GLuint color_bit; - - color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS); - if (color_bit != 0) - this_mask |= (1 << (color_bit - 1)); - - /* Clear depth/stencil in the same pass as color. */ - this_mask |= (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)); - - /* Select the current color buffer and use the color write mask if - * we have one, otherwise don't write any color channels. - */ - if (this_mask & BUFFER_BIT_FRONT_LEFT) - _mesa_DrawBuffer(GL_FRONT_LEFT); - else if (this_mask & BUFFER_BIT_BACK_LEFT) - _mesa_DrawBuffer(GL_BACK_LEFT); - else if (color_bit != 0) - _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0 + - (color_bit - BUFFER_COLOR0 - 1)); - else - _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - - /* Control writing of the depth clear value to depth. */ - if (this_mask & BUFFER_BIT_DEPTH) { - _mesa_DepthFunc(GL_ALWAYS); - _mesa_DepthMask(GL_TRUE); - _mesa_Enable(GL_DEPTH_TEST); - } else { - _mesa_Disable(GL_DEPTH_TEST); - _mesa_DepthMask(GL_FALSE); - } - - /* Control writing of the stencil clear value to stencil. */ - if (this_mask & BUFFER_BIT_STENCIL) { - _mesa_Enable(GL_STENCIL_TEST); - _mesa_StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, ctx->Stencil.Clear, - ctx->Stencil.WriteMask[0]); - } else { - _mesa_Disable(GL_STENCIL_TEST); - } - - CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); - - mask &= ~this_mask; - } - - radeon_meta_restore_transform(rmesa); - - _mesa_ActiveTextureARB(GL_TEXTURE0 + saved_active_texture); - if (saved_fp_enable) - _mesa_Enable(GL_FRAGMENT_PROGRAM_ARB); - if (saved_vp_enable) - _mesa_Enable(GL_VERTEX_PROGRAM_ARB); - - if (saved_shader_program) - _mesa_UseProgramObjectARB(saved_shader_program); - - _mesa_PopClientAttrib(); - _mesa_PopAttrib(); + meta_clear_tris(&rmesa->meta, mask); } diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h index 2cefb53fe04..cebae18b2d6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.h +++ b/src/mesa/drivers/dri/radeon/radeon_common.h @@ -5,23 +5,7 @@ #include "radeon_dma.h" #include "radeon_texture.h" -#ifndef HAVE_LIBDRM_RADEON -#ifndef RADEON_DEBUG_BO -#define RADEON_DEBUG_BO 1 -#endif -#endif - -#define TRI_CLEAR_COLOR_BITS (BUFFER_BIT_BACK_LEFT | \ - BUFFER_BIT_FRONT_LEFT | \ - BUFFER_BIT_COLOR0 | \ - BUFFER_BIT_COLOR1 | \ - BUFFER_BIT_COLOR2 | \ - BUFFER_BIT_COLOR3 | \ - BUFFER_BIT_COLOR4 | \ - BUFFER_BIT_COLOR5 | \ - BUFFER_BIT_COLOR6 | \ - BUFFER_BIT_COLOR7) - +void radeonUserClear(GLcontext *ctx, GLuint mask); void radeonRecalcScissorRects(radeonContextPtr radeon); void radeonSetCliprects(radeonContextPtr radeon); void radeonUpdateScissor( GLcontext *ctx ); @@ -52,10 +36,6 @@ void radeon_get_cliprects(radeonContextPtr radeon, struct drm_clip_rect **cliprects, unsigned int *num_cliprects, int *x_off, int *y_off); -GLboolean radeon_revalidate_bos(GLcontext *ctx); -void radeon_validate_bo(radeonContextPtr radeon, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain); -void radeon_validate_reset_bos(radeonContextPtr radeon); - void radeon_fbo_init(struct radeon_context *radeon); void radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb, diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 1c7faf048d0..bbe7225ee6c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -190,6 +190,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, ctx = radeon->glCtx; driContextPriv->driverPrivate = radeon; + meta_init_metaops(ctx, &radeon->meta); /* DRI fields */ radeon->dri.context = driContextPriv; radeon->dri.screen = sPriv; @@ -286,7 +287,7 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv ) } radeonReleaseArrays(radeon->glCtx, ~0); - + meta_destroy_metaops(&radeon->meta); if (radeon->vtbl.free_context) radeon->vtbl.free_context(radeon->glCtx); _swsetup_DestroyContext( radeon->glCtx ); @@ -596,8 +597,10 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) struct radeon_renderbuffer *stencil_rb; i = 0; - if ((radeon->is_front_buffer_rendering || !draw->color_rb[1]) - && draw->color_rb[0]) { + if ((radeon->is_front_buffer_rendering || + radeon->is_front_buffer_reading || + !draw->color_rb[1]) + && draw->color_rb[0]) { attachments[i++] = __DRI_BUFFER_FRONT_LEFT; attachments[i++] = radeon_bits_per_pixel(draw->color_rb[0]); } @@ -715,8 +718,8 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) rb->cpp = buffers[i].cpp; rb->pitch = buffers[i].pitch; - rb->width = drawable->w; - rb->height = drawable->h; + rb->base.Width = drawable->w; + rb->base.Height = drawable->h; rb->has_surface = 0; if (buffers[i].attachment == __DRI_BUFFER_STENCIL && depth_bo) { diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 43e705ee593..e4a8da05965 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -13,6 +13,7 @@ #include "dri_util.h" #include "tnl/t_vertex.h" +#include "dri_metaops.h" struct radeon_context; #include "radeon_bocs_wrapper.h" @@ -83,8 +84,6 @@ struct radeon_renderbuffer unsigned int cpp; /* unsigned int offset; */ unsigned int pitch; - unsigned int width; - unsigned int height; uint32_t draw_offset; /* FBO */ /* boo Xorg 6.8.2 compat */ @@ -482,19 +481,16 @@ struct radeon_context { */ GLboolean is_front_buffer_rendering; - struct { - struct gl_fragment_program *bitmap_fp; - struct gl_vertex_program *passthrough_vp; - - struct gl_fragment_program *saved_fp; - GLboolean saved_fp_enable; - struct gl_vertex_program *saved_vp; - GLboolean saved_vp_enable; + /** + * Track whether front-buffer is the current read target. + * + * This is closely associated with is_front_buffer_rendering, but may + * be set separately. The DRI2 fake front buffer must be referenced + * either way. + */ + GLboolean is_front_buffer_reading; - GLint saved_vp_x, saved_vp_y; - GLsizei saved_vp_width, saved_vp_height; - GLenum saved_matrix_mode; - } meta; + struct dri_metaops meta; struct { void (*get_lock)(radeonContextPtr radeon); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 8f780c443c9..c457fb654ea 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -285,8 +285,10 @@ r100CreateContext( const __GLcontextModes *glVisual, /* FIXME: When no memory manager is available we should set this * to some reasonable value based on texture memory pool size */ - /* FIXME: does r100 support 2048x2048 texture ? */ ctx->Const.MaxTextureLevels = 12; + ctx->Const.Max3DTextureLevels = 9; + ctx->Const.MaxCubeTextureLevels = 12; + ctx->Const.MaxTextureRectSize = 2048; ctx->Const.MaxTextureMaxAnisotropy = 16.0; @@ -316,6 +318,8 @@ r100CreateContext( const __GLcontextModes *glVisual, ctx->Const.MaxDrawBuffers = 1; + _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); + /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext( ctx ); @@ -361,7 +365,7 @@ r100CreateContext( const __GLcontextModes *glVisual, _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); } - if (rmesa->radeon.dri.drmMinor >= 9) + if (rmesa->radeon.radeonScreen->kernel_mm || rmesa->radeon.dri.drmMinor >= 9) _mesa_enable_extension( ctx, "GL_NV_texture_rectangle"); /* XXX these should really go right after _mesa_init_driver_functions() */ diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_drm.h b/src/mesa/drivers/dri/radeon/radeon_cs_drm.h index 984725a6c9d..ee403d173cc 100644 --- a/src/mesa/drivers/dri/radeon/radeon_cs_drm.h +++ b/src/mesa/drivers/dri/radeon/radeon_cs_drm.h @@ -56,6 +56,8 @@ struct radeon_cs_space_check { uint32_t new_accounted; }; +#define MAX_SPACE_BOS (32) + struct radeon_cs_manager; struct radeon_cs { @@ -72,7 +74,10 @@ struct radeon_cs { const char *section_file; const char *section_func; int section_line; - + struct radeon_cs_space_check bos[MAX_SPACE_BOS]; + int bo_count; + void (*space_flush_fn)(void *); + void *space_flush_data; }; /* cs functions */ @@ -98,16 +103,14 @@ struct radeon_cs_funcs { int (*cs_erase)(struct radeon_cs *cs); int (*cs_need_flush)(struct radeon_cs *cs); void (*cs_print)(struct radeon_cs *cs, FILE *file); - int (*cs_space_check)(struct radeon_cs *cs, struct radeon_cs_space_check *bos, - int num_bo); }; struct radeon_cs_manager { struct radeon_cs_funcs *funcs; int fd; - uint32_t vram_limit, gart_limit; - uint32_t vram_write_used, gart_write_used; - uint32_t read_used; + int32_t vram_limit, gart_limit; + int32_t vram_write_used, gart_write_used; + int32_t read_used; }; static inline struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm, @@ -171,13 +174,6 @@ static inline void radeon_cs_print(struct radeon_cs *cs, FILE *file) cs->csm->funcs->cs_print(cs, file); } -static inline int radeon_cs_space_check(struct radeon_cs *cs, - struct radeon_cs_space_check *bos, - int num_bo) -{ - return cs->csm->funcs->cs_space_check(cs, bos, num_bo); -} - static inline void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit) { @@ -204,4 +200,38 @@ static inline void radeon_cs_write_qword(struct radeon_cs *cs, uint64_t qword) cs->section_cdw+=2; } } + +static inline void radeon_cs_space_set_flush(struct radeon_cs *cs, void (*fn)(void *), void *data) +{ + cs->space_flush_fn = fn; + cs->space_flush_data = data; +} + + +/* + * add a persistent BO to the list + * a persistent BO is one that will be referenced across flushes, + * i.e. colorbuffer, textures etc. + * They get reset when a new "operation" happens, where an operation + * is a state emission with a color/textures etc followed by a bunch of vertices. + */ +void radeon_cs_space_add_persistent_bo(struct radeon_cs *cs, + struct radeon_bo *bo, + uint32_t read_domains, + uint32_t write_domain); + +/* reset the persistent BO list */ +void radeon_cs_space_reset_bos(struct radeon_cs *cs); + +/* do a space check with the current persistent BO list */ +int radeon_cs_space_check(struct radeon_cs *cs); + +/* do a space check with the current persistent BO list and a temporary BO + * a temporary BO is like a DMA buffer, which gets flushed with the + * command buffer */ +int radeon_cs_space_check_with_bo(struct radeon_cs *cs, + struct radeon_bo *bo, + uint32_t read_domains, + uint32_t write_domain); + #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c index a2727ef6f7f..4f1065ebcf3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c @@ -373,113 +373,6 @@ static void cs_print(struct radeon_cs *cs, FILE *file) { } -static int cs_check_space(struct radeon_cs *cs, struct radeon_cs_space_check *bos, int num_bo) -{ - struct radeon_cs_manager *csm = cs->csm; - int this_op_read = 0, this_op_gart_write = 0, this_op_vram_write = 0; - uint32_t read_domains, write_domain; - int i; - struct radeon_bo *bo; - - /* check the totals for this operation */ - - if (num_bo == 0) - return 0; - - /* prepare */ - for (i = 0; i < num_bo; i++) - { - bo = bos[i].bo; - - bos[i].new_accounted = 0; - read_domains = bos[i].read_domains; - write_domain = bos[i].write_domain; - - /* pinned bos don't count */ - if (radeon_legacy_bo_is_static(bo)) - continue; - - /* already accounted this bo */ - if (write_domain && (write_domain == bo->space_accounted)) - continue; - - if (read_domains && ((read_domains << 16) == bo->space_accounted)) - continue; - - if (bo->space_accounted == 0) - { - if (write_domain == RADEON_GEM_DOMAIN_VRAM) - this_op_vram_write += bo->size; - else if (write_domain == RADEON_GEM_DOMAIN_GTT) - this_op_gart_write += bo->size; - else - this_op_read += bo->size; - bos[i].new_accounted = (read_domains << 16) | write_domain; - } - else - { - uint16_t old_read, old_write; - - old_read = bo->space_accounted >> 16; - old_write = bo->space_accounted & 0xffff; - - if (write_domain && (old_read & write_domain)) - { - bos[i].new_accounted = write_domain; - /* moving from read to a write domain */ - if (write_domain == RADEON_GEM_DOMAIN_VRAM) - { - this_op_read -= bo->size; - this_op_vram_write += bo->size; - } - else if (write_domain == RADEON_GEM_DOMAIN_VRAM) - { - this_op_read -= bo->size; - this_op_gart_write += bo->size; - } - } - else if (read_domains & old_write) - { - bos[i].new_accounted = bo->space_accounted & 0xffff; - } - else - { - /* rewrite the domains */ - if (write_domain != old_write) - fprintf(stderr,"WRITE DOMAIN RELOC FAILURE 0x%x %d %d\n", bo->handle, write_domain, old_write); - if (read_domains != old_read) - fprintf(stderr,"READ DOMAIN RELOC FAILURE 0x%x %d %d\n", bo->handle, read_domains, old_read); - return RADEON_CS_SPACE_FLUSH; - } - } - } - - if (this_op_read < 0) - this_op_read = 0; - - /* check sizes - operation first */ - if ((this_op_read + this_op_gart_write > csm->gart_limit) || - (this_op_vram_write > csm->vram_limit)) { - return RADEON_CS_SPACE_OP_TO_BIG; - } - - if (((csm->vram_write_used + this_op_vram_write) > csm->vram_limit) || - ((csm->read_used + csm->gart_write_used + this_op_gart_write + this_op_read) > csm->gart_limit)) { - return RADEON_CS_SPACE_FLUSH; - } - - csm->gart_write_used += this_op_gart_write; - csm->vram_write_used += this_op_vram_write; - csm->read_used += this_op_read; - /* commit */ - for (i = 0; i < num_bo; i++) { - bo = bos[i].bo; - bo->space_accounted = bos[i].new_accounted; - } - - return RADEON_CS_SPACE_OK; -} - static struct radeon_cs_funcs radeon_cs_legacy_funcs = { cs_create, cs_write_reloc, @@ -490,7 +383,6 @@ static struct radeon_cs_funcs radeon_cs_legacy_funcs = { cs_erase, cs_need_flush, cs_print, - cs_check_space }; struct radeon_cs_manager *radeon_cs_manager_legacy_ctor(struct radeon_context *ctx) diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c b/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c new file mode 100644 index 00000000000..5a8df7bb8cd --- /dev/null +++ b/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c @@ -0,0 +1,234 @@ +/* + * Copyright © 2009 Red Hat Inc. + * 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 SOFTWARE IS PROVIDED "AS 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 COPYRIGHT HOLDERS, 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + */ +/* + */ +#include <assert.h> +#include <errno.h> +#include <stdlib.h> +#include "radeon_bocs_wrapper.h" + +struct rad_sizes { + int32_t op_read; + int32_t op_gart_write; + int32_t op_vram_write; +}; + +static inline int radeon_cs_setup_bo(struct radeon_cs_space_check *sc, struct rad_sizes *sizes) +{ + uint32_t read_domains, write_domain; + struct radeon_bo *bo; + + bo = sc->bo; + sc->new_accounted = 0; + read_domains = sc->read_domains; + write_domain = sc->write_domain; + + /* legacy needs a static check */ + if (radeon_bo_is_static(bo)) { + bo->space_accounted = sc->new_accounted = (read_domains << 16) | write_domain; + return 0; + } + + /* already accounted this bo */ + if (write_domain && (write_domain == bo->space_accounted)) { + sc->new_accounted = bo->space_accounted; + return 0; + } + if (read_domains && ((read_domains << 16) == bo->space_accounted)) { + sc->new_accounted = bo->space_accounted; + return 0; + } + + if (bo->space_accounted == 0) { + if (write_domain == RADEON_GEM_DOMAIN_VRAM) + sizes->op_vram_write += bo->size; + else if (write_domain == RADEON_GEM_DOMAIN_GTT) + sizes->op_gart_write += bo->size; + else + sizes->op_read += bo->size; + sc->new_accounted = (read_domains << 16) | write_domain; + } else { + uint16_t old_read, old_write; + + old_read = bo->space_accounted >> 16; + old_write = bo->space_accounted & 0xffff; + + if (write_domain && (old_read & write_domain)) { + sc->new_accounted = write_domain; + /* moving from read to a write domain */ + if (write_domain == RADEON_GEM_DOMAIN_VRAM) { + sizes->op_read -= bo->size; + sizes->op_vram_write += bo->size; + } else if (write_domain == RADEON_GEM_DOMAIN_VRAM) { + sizes->op_read -= bo->size; + sizes->op_gart_write += bo->size; + } + } else if (read_domains & old_write) { + sc->new_accounted = bo->space_accounted & 0xffff; + } else { + /* rewrite the domains */ + if (write_domain != old_write) + fprintf(stderr,"WRITE DOMAIN RELOC FAILURE 0x%x %d %d\n", bo->handle, write_domain, old_write); + if (read_domains != old_read) + fprintf(stderr,"READ DOMAIN RELOC FAILURE 0x%x %d %d\n", bo->handle, read_domains, old_read); + return RADEON_CS_SPACE_FLUSH; + } + } + return 0; +} + +static int radeon_cs_do_space_check(struct radeon_cs *cs, struct radeon_cs_space_check *new_tmp) +{ + struct radeon_cs_manager *csm = cs->csm; + int i; + struct radeon_bo *bo; + struct rad_sizes sizes; + int ret; + + /* check the totals for this operation */ + + if (cs->bo_count == 0 && !new_tmp) + return 0; + + memset(&sizes, 0, sizeof(struct rad_sizes)); + + /* prepare */ + for (i = 0; i < cs->bo_count; i++) { + ret = radeon_cs_setup_bo(&cs->bos[i], &sizes); + if (ret) + return ret; + } + + if (new_tmp) { + ret = radeon_cs_setup_bo(new_tmp, &sizes); + if (ret) + return ret; + } + + if (sizes.op_read < 0) + sizes.op_read = 0; + + /* check sizes - operation first */ + if ((sizes.op_read + sizes.op_gart_write > csm->gart_limit) || + (sizes.op_vram_write > csm->vram_limit)) { + return RADEON_CS_SPACE_OP_TO_BIG; + } + + if (((csm->vram_write_used + sizes.op_vram_write) > csm->vram_limit) || + ((csm->read_used + csm->gart_write_used + sizes.op_gart_write + sizes.op_read) > csm->gart_limit)) { + return RADEON_CS_SPACE_FLUSH; + } + + csm->gart_write_used += sizes.op_gart_write; + csm->vram_write_used += sizes.op_vram_write; + csm->read_used += sizes.op_read; + /* commit */ + for (i = 0; i < cs->bo_count; i++) { + bo = cs->bos[i].bo; + bo->space_accounted = cs->bos[i].new_accounted; + } + if (new_tmp) + new_tmp->bo->space_accounted = new_tmp->new_accounted; + + return RADEON_CS_SPACE_OK; +} + +void radeon_cs_space_add_persistent_bo(struct radeon_cs *cs, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain) +{ + int i; + for (i = 0; i < cs->bo_count; i++) { + if (cs->bos[i].bo == bo && + cs->bos[i].read_domains == read_domains && + cs->bos[i].write_domain == write_domain) + return; + } + radeon_bo_ref(bo); + i = cs->bo_count; + cs->bos[i].bo = bo; + cs->bos[i].read_domains = read_domains; + cs->bos[i].write_domain = write_domain; + cs->bos[i].new_accounted = 0; + cs->bo_count++; + + assert(cs->bo_count < MAX_SPACE_BOS); +} + +static int radeon_cs_check_space_internal(struct radeon_cs *cs, struct radeon_cs_space_check *tmp_bo) +{ + int ret; + int flushed = 0; + +again: + ret = radeon_cs_do_space_check(cs, tmp_bo); + if (ret == RADEON_CS_SPACE_OP_TO_BIG) + return -1; + if (ret == RADEON_CS_SPACE_FLUSH) { + (*cs->space_flush_fn)(cs->space_flush_data); + if (flushed) + return -1; + flushed = 1; + goto again; + } + return 0; +} + +int radeon_cs_space_check_with_bo(struct radeon_cs *cs, + struct radeon_bo *bo, + uint32_t read_domains, uint32_t write_domain) +{ + struct radeon_cs_space_check temp_bo; + int ret = 0; + + if (bo) { + temp_bo.bo = bo; + temp_bo.read_domains = read_domains; + temp_bo.write_domain = write_domain; + temp_bo.new_accounted = 0; + } + + ret = radeon_cs_check_space_internal(cs, bo ? &temp_bo : NULL); + return ret; +} + +int radeon_cs_space_check(struct radeon_cs *cs) +{ + return radeon_cs_check_space_internal(cs, NULL); +} + +void radeon_cs_space_reset_bos(struct radeon_cs *cs) +{ + int i; + for (i = 0; i < cs->bo_count; i++) { + radeon_bo_unref(cs->bos[i].bo); + cs->bos[i].bo = NULL; + cs->bos[i].read_domains = 0; + cs->bos[i].write_domain = 0; + cs->bos[i].new_accounted = 0; + } + cs->bo_count = 0; +} + + diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index 2fbf89bf6de..48114a00126 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -204,10 +204,10 @@ again_alloc: rmesa->dma.current_used = 0; rmesa->dma.current_vertexptr = 0; - radeon_validate_bo(rmesa, rmesa->dma.current, RADEON_GEM_DOMAIN_GTT, 0); - - if (radeon_revalidate_bos(rmesa->glCtx) == GL_FALSE) - fprintf(stderr,"failure to revalidate BOs - badness\n"); + if (radeon_cs_space_check_with_bo(rmesa->cmdbuf.cs, + rmesa->dma.current, + RADEON_GEM_DOMAIN_GTT, 0)) + fprintf(stderr,"failure to revalidate BOs - badness\n"); if (!rmesa->dma.current) { /* Cmd buff have been flushed in radeon_revalidate_bos */ @@ -305,7 +305,7 @@ restart: if (!rmesa->dma.flush) { /* make sure we have enough space to use this in cmdbuf */ rcommonEnsureCmdBufSpace(rmesa, - rmesa->hw.max_state_size + (12*sizeof(int)), + rmesa->hw.max_state_size + (20*sizeof(int)), __FUNCTION__); /* if cmdbuf flushed DMA restart */ if (!rmesa->dma.current) diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index ea18f1ee2db..f28efa33e9a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -146,8 +146,8 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; - rb->DataType = GL_UNSIGNED_INT_24_8_EXT; + rb->_ActualFormat = GL_DEPTH_COMPONENT24; + rb->DataType = GL_UNSIGNED_INT; rb->DepthBits = 24; cpp = 4; break; @@ -316,7 +316,7 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) rrb->base.DataType = GL_UNSIGNED_SHORT; break; case GL_DEPTH_COMPONENT24: - rrb->base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; + rrb->base._ActualFormat = GL_DEPTH_COMPONENT24; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; rrb->base.DepthBits = 24; rrb->base.DataType = GL_UNSIGNED_INT; @@ -410,6 +410,20 @@ restart: rrb->base.DataType = GL_UNSIGNED_SHORT; DBG("Render to RGB5 texture OK\n"); } + else if (texImage->TexFormat == &_mesa_texformat_argb1555) { + rrb->cpp = 2; + rrb->base._ActualFormat = GL_RGB5_A1; + rrb->base._BaseFormat = GL_RGBA; + rrb->base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to ARGB1555 texture OK\n"); + } + else if (texImage->TexFormat == &_mesa_texformat_argb4444) { + rrb->cpp = 2; + rrb->base._ActualFormat = GL_RGBA4; + rrb->base._BaseFormat = GL_RGBA; + rrb->base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to ARGB1555 texture OK\n"); + } else if (texImage->TexFormat == &_mesa_texformat_z16) { rrb->cpp = 2; rrb->base._ActualFormat = GL_DEPTH_COMPONENT16; @@ -448,6 +462,7 @@ restart: rrb->base.BlueBits = texImage->TexFormat->BlueBits; rrb->base.AlphaBits = texImage->TexFormat->AlphaBits; rrb->base.DepthBits = texImage->TexFormat->DepthBits; + rrb->base.StencilBits = texImage->TexFormat->StencilBits; rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_nop_alloc_storage; diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 01c45df2dfa..a5e4df79415 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -445,11 +445,6 @@ void radeonEmitAOS( r100ContextPtr rmesa, */ #define RADEON_MAX_CLEARS 256 -static void radeonUserClear(GLcontext *ctx, GLuint mask) -{ - radeon_clear_tris(ctx, mask); -} - static void radeonKernelClear(GLcontext *ctx, GLuint flags) { r100ContextPtr rmesa = R100_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index e28f28662b4..b2a468b4fd6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -51,54 +51,63 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb); -static GLubyte *radeon_ptr32(const struct radeon_renderbuffer * rrb, +/* radeon tiling on r300-r500 has 4 states, + macro-linear/micro-linear + macro-linear/micro-tiled + macro-tiled /micro-linear + macro-tiled /micro-tiled + 1 byte surface + 2 byte surface - two types - we only provide 8x2 microtiling + 4 byte surface + 8/16 byte (unused) +*/ + +static GLubyte *radeon_ptr_4byte(const struct radeon_renderbuffer * rrb, GLint x, GLint y) { GLubyte *ptr = rrb->bo->ptr; uint32_t mask = RADEON_BO_FLAGS_MACRO_TILE | RADEON_BO_FLAGS_MICRO_TILE; GLint offset; - GLint nmacroblkpl; - GLint nmicroblkpl; if (rrb->has_surface || !(rrb->bo->flags & mask)) { offset = x * rrb->cpp + y * rrb->pitch; } else { offset = 0; if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) { - if (rrb->bo->flags & RADEON_BO_FLAGS_MICRO_TILE) { - nmacroblkpl = rrb->pitch >> 5; - offset += ((y >> 4) * nmacroblkpl) << 11; - offset += ((y & 15) >> 1) << 8; - offset += (y & 1) << 4; - offset += (x >> 5) << 11; - offset += ((x & 31) >> 2) << 5; - offset += (x & 3) << 2; + if (rrb->bo->flags & RADEON_BO_FLAGS_MICRO_TILE) { + offset = ((y >> 4) * (rrb->pitch >> 7) + (x >> 5)) << 11; + offset += (((y >> 3) ^ (x >> 5)) & 0x1) << 10; + offset += (((y >> 4) ^ (x >> 4)) & 0x1) << 9; + offset += (((y >> 2) ^ (x >> 4)) & 0x1) << 8; + offset += (((y >> 3) ^ (x >> 3)) & 0x1) << 7; + offset += ((y >> 1) & 0x1) << 6; + offset += ((x >> 2) & 0x1) << 5; + offset += (y & 1) << 4; + offset += (x & 3) << 2; } else { - nmacroblkpl = rrb->pitch >> 6; - offset += ((y >> 3) * nmacroblkpl) << 11; - offset += (y & 7) << 8; - offset += (x >> 6) << 11; - offset += ((x & 63) >> 3) << 5; - offset += (x & 7) << 2; + offset = ((y >> 3) * (rrb->pitch >> 8) + (x >> 6)) << 11; + offset += (((y >> 2) ^ (x >> 6)) & 0x1) << 10; + offset += (((y >> 3) ^ (x >> 5)) & 0x1) << 9; + offset += (((y >> 1) ^ (x >> 5)) & 0x1) << 8; + offset += (((y >> 2) ^ (x >> 4)) & 0x1) << 7; + offset += (y & 1) << 6; + offset += (x & 15) << 2; } } else { - nmicroblkpl = ((rrb->pitch + 31) & ~31) >> 5; - offset += (y * nmicroblkpl) << 5; - offset += (x >> 3) << 5; - offset += (x & 7) << 2; + offset = ((y >> 1) * (rrb->pitch >> 4) + (x >> 2)) << 5; + offset += (y & 1) << 4; + offset += (x & 3) << 2; } } return &ptr[offset]; } -static GLubyte *radeon_ptr16(const struct radeon_renderbuffer * rrb, - GLint x, GLint y) +static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, + GLint x, GLint y) { GLubyte *ptr = rrb->bo->ptr; uint32_t mask = RADEON_BO_FLAGS_MACRO_TILE | RADEON_BO_FLAGS_MICRO_TILE; GLint offset; - GLint nmacroblkpl; - GLint nmicroblkpl; if (rrb->has_surface || !(rrb->bo->flags & mask)) { offset = x * rrb->cpp + y * rrb->pitch; @@ -106,73 +115,29 @@ static GLubyte *radeon_ptr16(const struct radeon_renderbuffer * rrb, offset = 0; if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) { if (rrb->bo->flags & RADEON_BO_FLAGS_MICRO_TILE) { - nmacroblkpl = rrb->pitch >> 6; - offset += ((y >> 4) * nmacroblkpl) << 11; - offset += ((y & 15) >> 1) << 8; - offset += (y & 1) << 4; - offset += (x >> 6) << 11; - offset += ((x & 63) >> 3) << 5; - offset += (x & 7) << 1; + offset = ((y >> 4) * (rrb->pitch >> 7) + (x >> 6)) << 11; + offset += (((y >> 3) ^ (x >> 6)) & 0x1) << 10; + offset += (((y >> 4) ^ (x >> 5)) & 0x1) << 9; + offset += (((y >> 2) ^ (x >> 5)) & 0x1) << 8; + offset += (((y >> 3) ^ (x >> 4)) & 0x1) << 7; + offset += ((y >> 1) & 0x1) << 6; + offset += ((x >> 3) & 0x1) << 5; + offset += (y & 1) << 4; + offset += (x & 3) << 2; } else { - nmacroblkpl = rrb->pitch >> 7; - offset += ((y >> 3) * nmacroblkpl) << 11; - offset += (y & 7) << 8; - offset += (x >> 7) << 11; - offset += ((x & 127) >> 4) << 5; + offset = ((y >> 3) * (rrb->pitch >> 8) + (x >> 7)) << 11; + offset += (((y >> 2) ^ (x >> 7)) & 0x1) << 10; + offset += (((y >> 3) ^ (x >> 6)) & 0x1) << 9; + offset += (((y >> 1) ^ (x >> 6)) & 0x1) << 8; + offset += (((y >> 2) ^ (x >> 5)) & 0x1) << 7; + offset += (y & 1) << 6; + offset += ((x >> 4) & 0x1) << 5; offset += (x & 15) << 2; } } else { - nmicroblkpl = ((rrb->pitch + 31) & ~31) >> 5; - offset += (y * nmicroblkpl) << 5; - offset += (x >> 4) << 5; - offset += (x & 15) << 2; - } - } - return &ptr[offset]; -} - -static GLubyte *radeon_ptr(const struct radeon_renderbuffer * rrb, - GLint x, GLint y) -{ - GLubyte *ptr = rrb->bo->ptr; - uint32_t mask = RADEON_BO_FLAGS_MACRO_TILE | RADEON_BO_FLAGS_MICRO_TILE; - GLint offset; - GLint microblkxs; - GLint macroblkxs; - GLint nmacroblkpl; - GLint nmicroblkpl; - - if (rrb->has_surface || !(rrb->bo->flags & mask)) { - offset = x * rrb->cpp + y * rrb->pitch; - } else { - offset = 0; - if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) { - if (rrb->bo->flags & RADEON_BO_FLAGS_MICRO_TILE) { - microblkxs = 16 / rrb->cpp; - macroblkxs = 128 / rrb->cpp; - nmacroblkpl = rrb->pitch / macroblkxs; - offset += ((y >> 4) * nmacroblkpl) << 11; - offset += ((y & 15) >> 1) << 8; - offset += (y & 1) << 4; - offset += (x / macroblkxs) << 11; - offset += ((x & (macroblkxs - 1)) / microblkxs) << 5; - offset += (x & (microblkxs - 1)) * rrb->cpp; - } else { - microblkxs = 32 / rrb->cpp; - macroblkxs = 256 / rrb->cpp; - nmacroblkpl = rrb->pitch / macroblkxs; - offset += ((y >> 3) * nmacroblkpl) << 11; - offset += (y & 7) << 8; - offset += (x / macroblkxs) << 11; - offset += ((x & (macroblkxs - 1)) / microblkxs) << 5; - offset += (x & (microblkxs - 1)) * rrb->cpp; - } - } else { - microblkxs = 32 / rrb->cpp; - nmicroblkpl = ((rrb->pitch + 31) & ~31) >> 5; - offset += (y * nmicroblkpl) << 5; - offset += (x / microblkxs) << 5; - offset += (x & (microblkxs - 1)) * rrb->cpp; + offset = ((y >> 1) * (rrb->pitch >> 4) + (x >> 3)) << 5; + offset += (y & 0x1) << 4; + offset += (x & 0x7) << 1; } } return &ptr[offset]; @@ -239,7 +204,7 @@ s8z24_to_z24s8(uint32_t val) int miny = cliprects[_nc].y1 - y_off; \ int maxx = cliprects[_nc].x2 - x_off; \ int maxy = cliprects[_nc].y2 - y_off; - + /* ================================================================ * Color buffer */ @@ -251,7 +216,27 @@ s8z24_to_z24s8(uint32_t val) #define TAG(x) radeon##x##_RGB565 #define TAG2(x,y) radeon##x##_RGB565##y -#define GET_PTR(X,Y) radeon_ptr16(rrb, (X) + x_off, (Y) + y_off) +#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#include "spantmp2.h" + +/* 16 bit, ARGB1555 color spanline and pixel functions + */ +#define SPANTMP_PIXEL_FMT GL_BGRA +#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_1_5_5_5_REV + +#define TAG(x) radeon##x##_ARGB1555 +#define TAG2(x,y) radeon##x##_ARGB1555##y +#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#include "spantmp2.h" + +/* 16 bit, RGBA4 color spanline and pixel functions + */ +#define SPANTMP_PIXEL_FMT GL_BGRA +#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_4_4_4_4_REV + +#define TAG(x) radeon##x##_ARGB4444 +#define TAG2(x,y) radeon##x##_ARGB4444##y +#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) #include "spantmp2.h" /* 32 bit, xRGB8888 color spanline and pixel functions @@ -261,9 +246,9 @@ s8z24_to_z24s8(uint32_t val) #define TAG(x) radeon##x##_xRGB8888 #define TAG2(x,y) radeon##x##_xRGB8888##y -#define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr32(rrb, _x + x_off, _y + y_off)) | 0xff000000)) +#define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0xff000000)) #define PUT_VALUE(_x, _y, d) { \ - GLuint *_ptr = (GLuint*)radeon_ptr32( rrb, _x + x_off, _y + y_off ); \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ *_ptr = d; \ } while (0) #include "spantmp2.h" @@ -275,7 +260,11 @@ s8z24_to_z24s8(uint32_t val) #define TAG(x) radeon##x##_ARGB8888 #define TAG2(x,y) radeon##x##_ARGB8888##y -#define GET_PTR(X,Y) radeon_ptr32(rrb, (X) + x_off, (Y) + y_off) +#define GET_VALUE(_x, _y) (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))) +#define PUT_VALUE(_x, _y, d) { \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ + *_ptr = d; \ +} while (0) #include "spantmp2.h" /* ================================================================ @@ -297,10 +286,10 @@ s8z24_to_z24s8(uint32_t val) #define VALUE_TYPE GLushort #define WRITE_DEPTH( _x, _y, d ) \ - *(GLushort *)radeon_ptr(rrb, _x + x_off, _y + y_off) = d + *(GLushort *)radeon_ptr_2byte_8x2(rrb, _x + x_off, _y + y_off) = d #define READ_DEPTH( d, _x, _y ) \ - d = *(GLushort *)radeon_ptr(rrb, _x + x_off, _y + y_off) + d = *(GLushort *)radeon_ptr_2byte_8x2(rrb, _x + x_off, _y + y_off) #define TAG(x) radeon##x##_z16 #include "depthtmp.h" @@ -315,7 +304,7 @@ s8z24_to_z24s8(uint32_t val) #ifdef COMPILE_R300 #define WRITE_DEPTH( _x, _y, d ) \ do { \ - GLuint *_ptr = (GLuint*)radeon_ptr32( rrb, _x + x_off, _y + y_off ); \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ GLuint tmp = *_ptr; \ tmp &= 0x000000ff; \ tmp |= ((d << 8) & 0xffffff00); \ @@ -324,7 +313,7 @@ do { \ #else #define WRITE_DEPTH( _x, _y, d ) \ do { \ - GLuint *_ptr = (GLuint*)radeon_ptr32( rrb, _x + x_off, _y + y_off ); \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ GLuint tmp = *_ptr; \ tmp &= 0xff000000; \ tmp |= ((d) & 0x00ffffff); \ @@ -335,11 +324,11 @@ do { \ #ifdef COMPILE_R300 #define READ_DEPTH( d, _x, _y ) \ do { \ - d = (*(GLuint*)(radeon_ptr32(rrb, _x + x_off, _y + y_off)) & 0xffffff00) >> 8; \ + d = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) & 0xffffff00) >> 8; \ }while(0) #else #define READ_DEPTH( d, _x, _y ) \ - d = *(GLuint*)(radeon_ptr32(rrb, _x + x_off, _y + y_off)) & 0x00ffffff; + d = *(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) & 0x00ffffff; #endif /* fprintf(stderr, "dval(%d, %d, %d, %d)=0x%08X\n", _x, xo, _y, yo, d);\ @@ -359,13 +348,13 @@ do { \ #ifdef COMPILE_R300 #define WRITE_DEPTH( _x, _y, d ) \ do { \ - GLuint *_ptr = (GLuint*)radeon_ptr32( rrb, _x + x_off, _y + y_off ); \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ *_ptr = d; \ } while (0) #else #define WRITE_DEPTH( _x, _y, d ) \ do { \ - GLuint *_ptr = (GLuint*)radeon_ptr32( rrb, _x + x_off, _y + y_off ); \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ GLuint tmp = z24s8_to_s8z24(d); \ *_ptr = tmp; \ } while (0) @@ -374,11 +363,11 @@ do { \ #ifdef COMPILE_R300 #define READ_DEPTH( d, _x, _y ) \ do { \ - d = (*(GLuint*)(radeon_ptr32(rrb, _x + x_off, _y + y_off))); \ + d = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \ }while(0) #else #define READ_DEPTH( d, _x, _y ) do { \ - d = s8z24_to_z24s8(*(GLuint*)(radeon_ptr32(rrb, _x + x_off, _y + y_off ))); \ + d = s8z24_to_z24s8(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off ))); \ } while (0) #endif /* @@ -397,7 +386,7 @@ do { \ #ifdef COMPILE_R300 #define WRITE_STENCIL( _x, _y, d ) \ do { \ - GLuint *_ptr = (GLuint*)radeon_ptr32(rrb, _x + x_off, _y + y_off); \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte(rrb, _x + x_off, _y + y_off); \ GLuint tmp = *_ptr; \ tmp &= 0xffffff00; \ tmp |= (d) & 0xff; \ @@ -406,7 +395,7 @@ do { \ #else #define WRITE_STENCIL( _x, _y, d ) \ do { \ - GLuint *_ptr = (GLuint*)radeon_ptr32(rrb, _x + x_off, _y + y_off); \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte(rrb, _x + x_off, _y + y_off); \ GLuint tmp = *_ptr; \ tmp &= 0x00ffffff; \ tmp |= (((d) & 0xff) << 24); \ @@ -417,14 +406,14 @@ do { \ #ifdef COMPILE_R300 #define READ_STENCIL( d, _x, _y ) \ do { \ - GLuint *_ptr = (GLuint*)radeon_ptr32( rrb, _x + x_off, _y + y_off ); \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ GLuint tmp = *_ptr; \ d = tmp & 0x000000ff; \ } while (0) #else #define READ_STENCIL( d, _x, _y ) \ do { \ - GLuint *_ptr = (GLuint*)radeon_ptr32( rrb, _x + x_off, _y + y_off ); \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ GLuint tmp = *_ptr; \ d = (tmp & 0xff000000) >> 24; \ } while (0) @@ -438,11 +427,13 @@ static void map_unmap_rb(struct gl_renderbuffer *rb, int flag) { struct radeon_renderbuffer *rrb = radeon_renderbuffer(rb); int r; - + if (rrb == NULL || !rrb->bo) return; if (flag) { + if (rrb->bo->bom->funcs->bo_wait) + radeon_bo_wait(rrb->bo); r = radeon_bo_map(rrb->bo, 1); if (r) { fprintf(stderr, "(%s) error(%d) mapping buffer.\n", @@ -472,25 +463,30 @@ radeon_map_unmap_buffers(GLcontext *ctx, GLboolean map) ctx->DrawBuffer->Attachment + i; struct gl_texture_object *tex = att->Texture; if (tex) { - /* render to texture */ + /* Render to texture. Note that a mipmapped texture need not + * be complete for render to texture, so we must restrict to + * mapping only the attached image. + */ + radeon_texture_image *image = get_radeon_texture_image(tex->Image[att->CubeMapFace][att->TextureLevel]); ASSERT(att->Renderbuffer); + if (map) - ctx->Driver.MapTexture(ctx, tex); + radeon_teximage_map(image, GL_TRUE); else - ctx->Driver.UnmapTexture(ctx, tex); + radeon_teximage_unmap(image); } } - + map_unmap_rb(ctx->ReadBuffer->_ColorReadBuffer, map); /* depth buffer (Note wrapper!) */ if (ctx->DrawBuffer->_DepthBuffer) map_unmap_rb(ctx->DrawBuffer->_DepthBuffer->Wrapped, map); - + if (ctx->DrawBuffer->_StencilBuffer) map_unmap_rb(ctx->DrawBuffer->_StencilBuffer->Wrapped, map); - } + static void radeonSpanRenderStart(GLcontext * ctx) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -507,15 +503,13 @@ static void radeonSpanRenderStart(GLcontext * ctx) LOCK_HARDWARE(rmesa); radeonWaitForIdleLocked(rmesa); } + for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { if (ctx->Texture.Unit[i]._ReallyEnabled) ctx->Driver.MapTexture(ctx, ctx->Texture.Unit[i]._Current); } radeon_map_unmap_buffers(ctx, 1); - - - } static void radeonSpanRenderFinish(GLcontext * ctx) @@ -553,6 +547,10 @@ static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb) radeonInitPointers_xRGB8888(&rrb->base); } else if (rrb->base._ActualFormat == GL_RGBA8) { radeonInitPointers_ARGB8888(&rrb->base); + } else if (rrb->base._ActualFormat == GL_RGBA4) { + radeonInitPointers_ARGB4444(&rrb->base); + } else if (rrb->base._ActualFormat == GL_RGB5_A1) { + radeonInitPointers_ARGB1555(&rrb->base); } else if (rrb->base._ActualFormat == GL_DEPTH_COMPONENT16) { radeonInitDepthPointers_z16(&rrb->base); } else if (rrb->base._ActualFormat == GL_DEPTH_COMPONENT24) { @@ -561,5 +559,7 @@ static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb) radeonInitDepthPointers_z24_s8(&rrb->base); } else if (rrb->base._ActualFormat == GL_STENCIL_INDEX8_EXT) { radeonInitStencilPointers_z24_s8(&rrb->base); + } else { + fprintf(stderr, "radeonSetSpanFunctions: bad actual format: 0x%04X\n", rrb->base._ActualFormat); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 06b8c299368..0d1728b747a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -458,6 +458,10 @@ static void radeonFrontFace( GLcontext *ctx, GLenum mode ) RADEON_STATECHANGE( rmesa, tcl ); rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_CULL_FRONT_IS_CCW; + /* Winding is inverted when rendering to FBO */ + if (ctx->DrawBuffer && ctx->DrawBuffer->Name) + mode = (mode == GL_CW) ? GL_CCW : GL_CW; + switch ( mode ) { case GL_CW: rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_FFACE_CULL_CW; @@ -508,11 +512,18 @@ static void radeonColorMask( GLcontext *ctx, GLboolean b, GLboolean a ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); - GLuint mask = radeonPackColor( rmesa->radeon.radeonScreen->cpp, - ctx->Color.ColorMask[RCOMP], - ctx->Color.ColorMask[GCOMP], - ctx->Color.ColorMask[BCOMP], - ctx->Color.ColorMask[ACOMP] ); + struct radeon_renderbuffer *rrb; + GLuint mask; + + rrb = radeon_get_colorbuffer(&rmesa->radeon); + if (!rrb) + return; + + mask = radeonPackColor( rrb->cpp, + ctx->Color.ColorMask[RCOMP], + ctx->Color.ColorMask[GCOMP], + ctx->Color.ColorMask[BCOMP], + ctx->Color.ColorMask[ACOMP] ); if ( rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] != mask ) { RADEON_STATECHANGE( rmesa, msk ); @@ -1500,11 +1511,17 @@ static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLubyte c[4]; + struct radeon_renderbuffer *rrb; + + rrb = radeon_get_colorbuffer(&rmesa->radeon); + if (!rrb) + return; + CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]); CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]); CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]); - rmesa->radeon.state.color.clear = radeonPackColor( rmesa->radeon.radeonScreen->cpp, + rmesa->radeon.state.color.clear = radeonPackColor( rrb->cpp, c[0], c[1], c[2], c[3] ); } @@ -2048,23 +2065,23 @@ static GLboolean r100ValidateBuffers(GLcontext *ctx) { r100ContextPtr rmesa = R100_CONTEXT(ctx); struct radeon_renderbuffer *rrb; - int i; + int i, ret; - radeon_validate_reset_bos(&rmesa->radeon); + radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs); rrb = radeon_get_colorbuffer(&rmesa->radeon); /* color buffer */ if (rrb && rrb->bo) { - radeon_validate_bo(&rmesa->radeon, rrb->bo, - 0, RADEON_GEM_DOMAIN_VRAM); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, rrb->bo, + 0, RADEON_GEM_DOMAIN_VRAM); } /* depth buffer */ rrb = radeon_get_depthbuffer(&rmesa->radeon); /* color buffer */ if (rrb && rrb->bo) { - radeon_validate_bo(&rmesa->radeon, rrb->bo, - 0, RADEON_GEM_DOMAIN_VRAM); + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, rrb->bo, + 0, RADEON_GEM_DOMAIN_VRAM); } for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { @@ -2073,20 +2090,19 @@ static GLboolean r100ValidateBuffers(GLcontext *ctx) if (!ctx->Texture.Unit[i]._ReallyEnabled) continue; - t = radeon_tex_obj(ctx->Texture.Unit[i]._Current); + t = rmesa->state.texture.unit[i].texobj; if (t->image_override && t->bo) - radeon_validate_bo(&rmesa->radeon, t->bo, + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, t->bo, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); else if (t->mt->bo) - radeon_validate_bo(&rmesa->radeon, t->mt->bo, + radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, t->mt->bo, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); } - if (rmesa->radeon.dma.current) - radeon_validate_bo(&rmesa->radeon, rmesa->radeon.dma.current, - RADEON_GEM_DOMAIN_GTT, 0); - - return radeon_revalidate_bos(ctx); + ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs, rmesa->radeon.dma.current, RADEON_GEM_DOMAIN_GTT, 0); + if (ret) + return GL_FALSE; + return GL_TRUE; } GLboolean radeonValidateState( GLcontext *ctx ) diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index f5d4189d669..aaa82b1d6a4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -390,8 +390,17 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) atom->cmd[CTX_RB3D_CNTL] &= ~(0xf << 10); if (rrb->cpp == 4) atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB8888; - else + else switch (rrb->base._ActualFormat) { + case GL_RGB5: atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_RGB565; + break; + case GL_RGBA4: + atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB4444; + break; + case GL_RGB5_A1: + atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB1555; + break; + } cbpitch = (rrb->pitch / rrb->cpp); if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) @@ -453,8 +462,8 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) OUT_BATCH(0); OUT_BATCH(CP_PACKET0(RADEON_RE_WIDTH_HEIGHT, 0)); if (rrb) { - OUT_BATCH(((rrb->width - 1) << RADEON_RE_WIDTH_SHIFT) | - ((rrb->height - 1) << RADEON_RE_HEIGHT_SHIFT)); + OUT_BATCH(((rrb->base.Width - 1) << RADEON_RE_WIDTH_SHIFT) | + ((rrb->base.Height - 1) << RADEON_RE_HEIGHT_SHIFT)); } else { OUT_BATCH(0); } @@ -465,6 +474,34 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); + uint32_t dwords = 3; + int i = atom->idx, j; + radeonTexObj *t = r100->state.texture.unit[i].texobj; + radeon_mipmap_level *lvl; + + if (!(ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_CUBE_BIT)) + return; + + if (!t) + return; + + if (!t->mt) + return; + + BEGIN_BATCH_NO_AUTOSTATE(dwords + (5 * 3)); + OUT_BATCH_TABLE(atom->cmd, 3); + lvl = &t->mt->levels[0]; + for (j = 0; j < 5; j++) { + OUT_BATCH_RELOC(lvl->faces[j].offset, t->mt->bo, lvl->faces[j].offset, + RADEON_GEM_DOMAIN_VRAM, 0, 0); + } + END_BATCH(); +} + +static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +{ + r100ContextPtr r100 = R100_CONTEXT(ctx); + BATCH_LOCALS(&r100->radeon); uint32_t dwords = 2; int i = atom->idx, j; radeonTexObj *t = r100->state.texture.unit[i].texobj; @@ -490,7 +527,7 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) OUT_BATCH_TABLE(atom->cmd, 2); lvl = &t->mt->levels[0]; for (j = 0; j < 5; j++) { - OUT_BATCH(CP_PACKET0(base_reg + (4 * (j-1)), 0)); + OUT_BATCH(CP_PACKET0(base_reg + (4 * j), 0)); OUT_BATCH_RELOC(lvl->faces[j].offset, t->mt->bo, lvl->faces[j].offset, RADEON_GEM_DOMAIN_VRAM, 0, 0); } @@ -661,7 +698,10 @@ void radeonInitState( r100ContextPtr rmesa ) ALLOC_STATE_IDX( cube[1], cube1, CUBE_STATE_SIZE, "CUBE/cube-1", 0, 1 ); ALLOC_STATE_IDX( cube[2], cube2, CUBE_STATE_SIZE, "CUBE/cube-2", 0, 2 ); for (i = 0; i < 3; i++) - rmesa->hw.cube[i].emit = cube_emit; + if (rmesa->radeon.radeonScreen->kernel_mm) + rmesa->hw.cube[i].emit = cube_emit_cs; + else + rmesa->hw.cube[i].emit = cube_emit; } else { diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 279bcd4df6a..c29105d7b85 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -706,7 +706,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ rImage->mt = NULL; } _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->width, rb->height, 1, 0, rb->cpp); + rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx, internalFormat, @@ -738,8 +738,8 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ t->pp_txfilter |= tx_table[MESA_FORMAT_RGB565].filter; break; } - t->pp_txsize = ((rb->width - 1) << RADEON_TEX_USIZE_SHIFT) - | ((rb->height - 1) << RADEON_TEX_VSIZE_SHIFT); + t->pp_txsize = ((rb->base.Width - 1) << RADEON_TEX_USIZE_SHIFT) + | ((rb->base.Height - 1) << RADEON_TEX_VSIZE_SHIFT); t->pp_txformat |= RADEON_TXFORMAT_NON_POWER2; t->pp_txpitch = pitch_val; t->pp_txpitch -= 32; @@ -1143,12 +1143,14 @@ static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit ) r100ContextPtr rmesa = R100_CONTEXT(ctx); if (ctx->Texture.Unit[unit]._ReallyEnabled & TEXTURE_3D_BIT) { + rmesa->state.texture.unit[unit].texobj = NULL; return GL_FALSE; } if (!ctx->Texture.Unit[unit]._ReallyEnabled) { /* disable the unit */ disable_tex_obj_state(rmesa, unit); + rmesa->state.texture.unit[unit].texobj = NULL; return GL_TRUE; } @@ -1156,8 +1158,8 @@ static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit ) _mesa_warning(ctx, "failed to validate texture for unit %d.\n", unit); - rmesa->state.texture.unit[unit].texobj = NULL; - return GL_FALSE; + rmesa->state.texture.unit[unit].texobj = NULL; + return GL_FALSE; } rmesa->state.texture.unit[unit].texobj = radeon_tex_obj(ctx->Texture.Unit[unit]._Current); return GL_TRUE; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index ee66fc2ea0d..ad501c454ce 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -477,6 +477,26 @@ const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: return &_mesa_texformat_s8_z24; + + /* EXT_texture_sRGB */ + case GL_SRGB: + case GL_SRGB8: + case GL_SRGB_ALPHA: + case GL_SRGB8_ALPHA8: + case GL_COMPRESSED_SRGB: + case GL_COMPRESSED_SRGB_ALPHA: + return &_mesa_texformat_srgba8; + + case GL_SLUMINANCE: + case GL_SLUMINANCE8: + case GL_COMPRESSED_SLUMINANCE: + return &_mesa_texformat_sl8; + + case GL_SLUMINANCE_ALPHA: + case GL_SLUMINANCE8_ALPHA8: + case GL_COMPRESSED_SLUMINANCE_ALPHA: + return &_mesa_texformat_sla8; + default: _mesa_problem(ctx, "unexpected internalFormat 0x%x in %s", @@ -492,7 +512,7 @@ const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, */ static void radeon_teximage( GLcontext *ctx, int dims, - GLint face, GLint level, + GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLsizei imageSize, @@ -509,6 +529,7 @@ static void radeon_teximage( GLint postConvWidth = width; GLint postConvHeight = height; GLuint texelBytes; + GLuint face = radeon_face_for_target(target); radeon_firevertices(rmesa); @@ -594,6 +615,8 @@ static void radeon_teximage( memcpy(texImage->Data, pixels, imageSize); } else { GLuint dstRowStride; + GLuint *dstImageOffsets; + if (image->mt) { radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; @@ -601,20 +624,37 @@ static void radeon_teximage( dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes; } + if (dims == 3) { + int i; + + dstImageOffsets = _mesa_malloc(depth * sizeof(GLuint)) ; + if (!dstImageOffsets) + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); + + for (i = 0; i < depth; ++i) { + dstImageOffsets[i] = dstRowStride/texImage->TexFormat->TexelBytes * height * i; + } + } else { + dstImageOffsets = texImage->ImageOffsets; + } + if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, - texImage->ImageOffsets, + dstImageOffsets, width, height, depth, format, type, pixels, packing)) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); + + if (dims == 3) + _mesa_free(dstImageOffsets); } /* SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - radeon_generate_mipmap(ctx, texObj->Target, texObj); + radeon_generate_mipmap(ctx, target, texObj); } } @@ -634,7 +674,7 @@ void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - radeon_teximage(ctx, 1, 0, level, internalFormat, width, 1, 1, + radeon_teximage(ctx, 1, target, level, internalFormat, width, 1, 1, 0, format, type, pixels, packing, texObj, texImage, 0); } @@ -647,9 +687,7 @@ void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_image *texImage) { - GLuint face = radeon_face_for_target(target); - - radeon_teximage(ctx, 2, face, level, internalFormat, width, height, 1, + radeon_teximage(ctx, 2, target, level, internalFormat, width, height, 1, 0, format, type, pixels, packing, texObj, texImage, 0); } @@ -660,9 +698,7 @@ void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - GLuint face = radeon_face_for_target(target); - - radeon_teximage(ctx, 2, face, level, internalFormat, width, height, 1, + radeon_teximage(ctx, 2, target, level, internalFormat, width, height, 1, imageSize, 0, 0, data, &ctx->Unpack, texObj, texImage, 1); } @@ -675,14 +711,14 @@ void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - radeon_teximage(ctx, 3, 0, level, internalFormat, width, height, depth, + radeon_teximage(ctx, 3, target, level, internalFormat, width, height, depth, 0, format, type, pixels, packing, texObj, texImage, 0); } /** * Update a subregion of the given texture image. */ -static void radeon_texsubimage(GLcontext* ctx, int dims, int level, +static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, @@ -742,7 +778,7 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, int level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - radeon_generate_mipmap(ctx, texObj->Target, texObj); + radeon_generate_mipmap(ctx, target, texObj); } } @@ -762,7 +798,7 @@ void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - radeon_texsubimage(ctx, 1, level, xoffset, 0, 0, width, 1, 1, 0, + radeon_texsubimage(ctx, 1, target, level, xoffset, 0, 0, width, 1, 1, 0, format, type, pixels, packing, texObj, texImage, 0); } @@ -775,7 +811,7 @@ void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - radeon_texsubimage(ctx, 2, level, xoffset, yoffset, 0, width, height, 1, + radeon_texsubimage(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels, packing, texObj, texImage, 0); } @@ -788,7 +824,7 @@ void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - radeon_texsubimage(ctx, 2, level, xoffset, yoffset, 0, width, height, 1, + radeon_texsubimage(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, imageSize, format, 0, data, &ctx->Unpack, texObj, texImage, 1); } @@ -802,7 +838,7 @@ void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - radeon_texsubimage(ctx, 3, level, xoffset, yoffset, zoffset, width, height, depth, 0, + radeon_texsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, 0, format, type, pixels, packing, texObj, texImage, 0); } diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 3b004a3ee25..34e0b8bc8d7 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -2218,7 +2218,7 @@ Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap, if (!dpy || !config || !pixmap) return 0; - for (attr = attribList; *attr; attr++) { + for (attr = attribList; attr && *attr; attr++) { switch (*attr) { case GLX_TEXTURE_FORMAT_EXT: attr++; diff --git a/src/mesa/glapi/ARB_map_buffer_range.xml b/src/mesa/glapi/ARB_map_buffer_range.xml new file mode 100644 index 00000000000..afcb9b6ba6d --- /dev/null +++ b/src/mesa/glapi/ARB_map_buffer_range.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + + +<OpenGLAPI> + +<category name="GL_ARB_map_buffer_range" number="50"> + + <enum name="MAP_READ_BIT" value="0x0001"/> + <enum name="MAP_WRITE_BIT" value="0x0002"/> + <enum name="MAP_INVALIDATE_RANGE_BIT" value="0x0004"/> + <enum name="MAP_INVALIDATE_BUFFER_BIT" value="0x0008"/> + <enum name="MAP_FLUSH_EXPLICIT_BIT" value="0x0010"/> + <enum name="MAP_UNSYNCHRONIZED_BIT" value="0x0020"/> + + <function name="MapBufferRange" offset="assign"> + <param name="target" type="GLenum"/> + <param name="offset" type="GLintptr"/> + <param name="length" type="GLsizeiptr"/> + <param name="access" type="GLbitfield"/> + <return type="GLvoid *"/> + </function> + + <function name="FlushMappedBufferRange" offset="assign"> + <param name="target" type="GLenum"/> + <param name="offset" type="GLintptr"/> + <param name="length" type="GLsizeiptr"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/src/mesa/glapi/ARB_vertex_array_object.xml b/src/mesa/glapi/ARB_vertex_array_object.xml new file mode 100644 index 00000000000..3b4ab64f557 --- /dev/null +++ b/src/mesa/glapi/ARB_vertex_array_object.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + + +<OpenGLAPI> + +<category name="GL_ARB_vertex_array_object" number="54"> + + <enum name="VERTEX_ARRAY_BINDING" value="0x85B5"/> + + <function name="BindVertexArray" offset="assign"> + <param name="array" type="GLuint"/> + </function> + + <function name="DeleteVertexArrays" alias="DeleteVertexArraysAPPLE"> + <param name="n" type="GLsizei"/> + <param name="arrays" type="const GLuint *"/> + </function> + + <function name="GenVertexArrays" offset="assign"> + <param name="n" type="GLsizei"/> + <param name="arrays" type="GLuint *"/> + </function> + + <function name="IsVertexArray" alias="IsVertexArrayAPPLE"> + <param name="array" type="GLuint"/> + <return type="GLboolean"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/src/mesa/glapi/EXT_provoking_vertex.xml b/src/mesa/glapi/EXT_provoking_vertex.xml new file mode 100644 index 00000000000..f528a2c7d36 --- /dev/null +++ b/src/mesa/glapi/EXT_provoking_vertex.xml @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + + +<OpenGLAPI> + +<category name="GL_EXT_provoking_vertex" number="364"> + + <enum name="FIRST_VERTEX_CONVENTION_EXT" value="0x8E4D"/> + <enum name="LAST_VERTEX_CONVENTION_EXT" value="0x8E4E"/> + <enum name="PROVOKING_VERTEX_EXT" value="0x8E4F"/> + <enum name="QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT" value="0x8E4C"/> + + <function name="ProvokingVertexEXT" offset="assign"> + <param name="mode" type="GLenum"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile index a0c1f9aa8a3..2178eacef5e 100644 --- a/src/mesa/glapi/Makefile +++ b/src/mesa/glapi/Makefile @@ -49,7 +49,10 @@ API_XML = gl_API.xml \ EXT_framebuffer_object.xml \ ARB_copy_buffer.xml \ ARB_framebuffer_object.xml \ - APPLE_vertex_array_object.xml + ARB_map_buffer_range.xml \ + ARB_vertex_array_object.xml \ + APPLE_vertex_array_object.xml \ + EXT_provoking_vertex.xml COMMON = gl_XML.py glX_XML.py license.py $(API_XML) typeexpr.py COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index 39ccf62f232..b3f1aed1a40 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -1746,6 +1746,18 @@ #define CALL_RenderbufferStorageMultisample(disp, parameters) (*((disp)->RenderbufferStorageMultisample)) parameters #define GET_RenderbufferStorageMultisample(disp) ((disp)->RenderbufferStorageMultisample) #define SET_RenderbufferStorageMultisample(disp, fn) ((disp)->RenderbufferStorageMultisample = fn) +#define CALL_FlushMappedBufferRange(disp, parameters) (*((disp)->FlushMappedBufferRange)) parameters +#define GET_FlushMappedBufferRange(disp) ((disp)->FlushMappedBufferRange) +#define SET_FlushMappedBufferRange(disp, fn) ((disp)->FlushMappedBufferRange = fn) +#define CALL_MapBufferRange(disp, parameters) (*((disp)->MapBufferRange)) parameters +#define GET_MapBufferRange(disp) ((disp)->MapBufferRange) +#define SET_MapBufferRange(disp, fn) ((disp)->MapBufferRange = fn) +#define CALL_BindVertexArray(disp, parameters) (*((disp)->BindVertexArray)) parameters +#define GET_BindVertexArray(disp) ((disp)->BindVertexArray) +#define SET_BindVertexArray(disp, fn) ((disp)->BindVertexArray = fn) +#define CALL_GenVertexArrays(disp, parameters) (*((disp)->GenVertexArrays)) parameters +#define GET_GenVertexArrays(disp) ((disp)->GenVertexArrays) +#define SET_GenVertexArrays(disp, fn) ((disp)->GenVertexArrays = fn) #define CALL_CopyBufferSubData(disp, parameters) (*((disp)->CopyBufferSubData)) parameters #define GET_CopyBufferSubData(disp) ((disp)->CopyBufferSubData) #define SET_CopyBufferSubData(disp, fn) ((disp)->CopyBufferSubData = fn) @@ -2373,6 +2385,9 @@ #define CALL_FramebufferTextureLayerEXT(disp, parameters) (*((disp)->FramebufferTextureLayerEXT)) parameters #define GET_FramebufferTextureLayerEXT(disp) ((disp)->FramebufferTextureLayerEXT) #define SET_FramebufferTextureLayerEXT(disp, fn) ((disp)->FramebufferTextureLayerEXT = fn) +#define CALL_ProvokingVertexEXT(disp, parameters) (*((disp)->ProvokingVertexEXT)) parameters +#define GET_ProvokingVertexEXT(disp) ((disp)->ProvokingVertexEXT) +#define SET_ProvokingVertexEXT(disp, fn) ((disp)->ProvokingVertexEXT = fn) #define CALL_StencilFuncSeparateATI(disp, parameters) (*((disp)->StencilFuncSeparateATI)) parameters #define GET_StencilFuncSeparateATI(disp) ((disp)->StencilFuncSeparateATI) #define SET_StencilFuncSeparateATI(disp, fn) ((disp)->StencilFuncSeparateATI = fn) @@ -2391,7 +2406,7 @@ #else -#define driDispatchRemapTable_size 368 +#define driDispatchRemapTable_size 373 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2548,220 +2563,225 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define GetAttribLocationARB_remap_index 151 #define DrawBuffersARB_remap_index 152 #define RenderbufferStorageMultisample_remap_index 153 -#define CopyBufferSubData_remap_index 154 -#define PolygonOffsetEXT_remap_index 155 -#define GetPixelTexGenParameterfvSGIS_remap_index 156 -#define GetPixelTexGenParameterivSGIS_remap_index 157 -#define PixelTexGenParameterfSGIS_remap_index 158 -#define PixelTexGenParameterfvSGIS_remap_index 159 -#define PixelTexGenParameteriSGIS_remap_index 160 -#define PixelTexGenParameterivSGIS_remap_index 161 -#define SampleMaskSGIS_remap_index 162 -#define SamplePatternSGIS_remap_index 163 -#define ColorPointerEXT_remap_index 164 -#define EdgeFlagPointerEXT_remap_index 165 -#define IndexPointerEXT_remap_index 166 -#define NormalPointerEXT_remap_index 167 -#define TexCoordPointerEXT_remap_index 168 -#define VertexPointerEXT_remap_index 169 -#define PointParameterfEXT_remap_index 170 -#define PointParameterfvEXT_remap_index 171 -#define LockArraysEXT_remap_index 172 -#define UnlockArraysEXT_remap_index 173 -#define CullParameterdvEXT_remap_index 174 -#define CullParameterfvEXT_remap_index 175 -#define SecondaryColor3bEXT_remap_index 176 -#define SecondaryColor3bvEXT_remap_index 177 -#define SecondaryColor3dEXT_remap_index 178 -#define SecondaryColor3dvEXT_remap_index 179 -#define SecondaryColor3fEXT_remap_index 180 -#define SecondaryColor3fvEXT_remap_index 181 -#define SecondaryColor3iEXT_remap_index 182 -#define SecondaryColor3ivEXT_remap_index 183 -#define SecondaryColor3sEXT_remap_index 184 -#define SecondaryColor3svEXT_remap_index 185 -#define SecondaryColor3ubEXT_remap_index 186 -#define SecondaryColor3ubvEXT_remap_index 187 -#define SecondaryColor3uiEXT_remap_index 188 -#define SecondaryColor3uivEXT_remap_index 189 -#define SecondaryColor3usEXT_remap_index 190 -#define SecondaryColor3usvEXT_remap_index 191 -#define SecondaryColorPointerEXT_remap_index 192 -#define MultiDrawArraysEXT_remap_index 193 -#define MultiDrawElementsEXT_remap_index 194 -#define FogCoordPointerEXT_remap_index 195 -#define FogCoorddEXT_remap_index 196 -#define FogCoorddvEXT_remap_index 197 -#define FogCoordfEXT_remap_index 198 -#define FogCoordfvEXT_remap_index 199 -#define PixelTexGenSGIX_remap_index 200 -#define BlendFuncSeparateEXT_remap_index 201 -#define FlushVertexArrayRangeNV_remap_index 202 -#define VertexArrayRangeNV_remap_index 203 -#define CombinerInputNV_remap_index 204 -#define CombinerOutputNV_remap_index 205 -#define CombinerParameterfNV_remap_index 206 -#define CombinerParameterfvNV_remap_index 207 -#define CombinerParameteriNV_remap_index 208 -#define CombinerParameterivNV_remap_index 209 -#define FinalCombinerInputNV_remap_index 210 -#define GetCombinerInputParameterfvNV_remap_index 211 -#define GetCombinerInputParameterivNV_remap_index 212 -#define GetCombinerOutputParameterfvNV_remap_index 213 -#define GetCombinerOutputParameterivNV_remap_index 214 -#define GetFinalCombinerInputParameterfvNV_remap_index 215 -#define GetFinalCombinerInputParameterivNV_remap_index 216 -#define ResizeBuffersMESA_remap_index 217 -#define WindowPos2dMESA_remap_index 218 -#define WindowPos2dvMESA_remap_index 219 -#define WindowPos2fMESA_remap_index 220 -#define WindowPos2fvMESA_remap_index 221 -#define WindowPos2iMESA_remap_index 222 -#define WindowPos2ivMESA_remap_index 223 -#define WindowPos2sMESA_remap_index 224 -#define WindowPos2svMESA_remap_index 225 -#define WindowPos3dMESA_remap_index 226 -#define WindowPos3dvMESA_remap_index 227 -#define WindowPos3fMESA_remap_index 228 -#define WindowPos3fvMESA_remap_index 229 -#define WindowPos3iMESA_remap_index 230 -#define WindowPos3ivMESA_remap_index 231 -#define WindowPos3sMESA_remap_index 232 -#define WindowPos3svMESA_remap_index 233 -#define WindowPos4dMESA_remap_index 234 -#define WindowPos4dvMESA_remap_index 235 -#define WindowPos4fMESA_remap_index 236 -#define WindowPos4fvMESA_remap_index 237 -#define WindowPos4iMESA_remap_index 238 -#define WindowPos4ivMESA_remap_index 239 -#define WindowPos4sMESA_remap_index 240 -#define WindowPos4svMESA_remap_index 241 -#define MultiModeDrawArraysIBM_remap_index 242 -#define MultiModeDrawElementsIBM_remap_index 243 -#define DeleteFencesNV_remap_index 244 -#define FinishFenceNV_remap_index 245 -#define GenFencesNV_remap_index 246 -#define GetFenceivNV_remap_index 247 -#define IsFenceNV_remap_index 248 -#define SetFenceNV_remap_index 249 -#define TestFenceNV_remap_index 250 -#define AreProgramsResidentNV_remap_index 251 -#define BindProgramNV_remap_index 252 -#define DeleteProgramsNV_remap_index 253 -#define ExecuteProgramNV_remap_index 254 -#define GenProgramsNV_remap_index 255 -#define GetProgramParameterdvNV_remap_index 256 -#define GetProgramParameterfvNV_remap_index 257 -#define GetProgramStringNV_remap_index 258 -#define GetProgramivNV_remap_index 259 -#define GetTrackMatrixivNV_remap_index 260 -#define GetVertexAttribPointervNV_remap_index 261 -#define GetVertexAttribdvNV_remap_index 262 -#define GetVertexAttribfvNV_remap_index 263 -#define GetVertexAttribivNV_remap_index 264 -#define IsProgramNV_remap_index 265 -#define LoadProgramNV_remap_index 266 -#define ProgramParameters4dvNV_remap_index 267 -#define ProgramParameters4fvNV_remap_index 268 -#define RequestResidentProgramsNV_remap_index 269 -#define TrackMatrixNV_remap_index 270 -#define VertexAttrib1dNV_remap_index 271 -#define VertexAttrib1dvNV_remap_index 272 -#define VertexAttrib1fNV_remap_index 273 -#define VertexAttrib1fvNV_remap_index 274 -#define VertexAttrib1sNV_remap_index 275 -#define VertexAttrib1svNV_remap_index 276 -#define VertexAttrib2dNV_remap_index 277 -#define VertexAttrib2dvNV_remap_index 278 -#define VertexAttrib2fNV_remap_index 279 -#define VertexAttrib2fvNV_remap_index 280 -#define VertexAttrib2sNV_remap_index 281 -#define VertexAttrib2svNV_remap_index 282 -#define VertexAttrib3dNV_remap_index 283 -#define VertexAttrib3dvNV_remap_index 284 -#define VertexAttrib3fNV_remap_index 285 -#define VertexAttrib3fvNV_remap_index 286 -#define VertexAttrib3sNV_remap_index 287 -#define VertexAttrib3svNV_remap_index 288 -#define VertexAttrib4dNV_remap_index 289 -#define VertexAttrib4dvNV_remap_index 290 -#define VertexAttrib4fNV_remap_index 291 -#define VertexAttrib4fvNV_remap_index 292 -#define VertexAttrib4sNV_remap_index 293 -#define VertexAttrib4svNV_remap_index 294 -#define VertexAttrib4ubNV_remap_index 295 -#define VertexAttrib4ubvNV_remap_index 296 -#define VertexAttribPointerNV_remap_index 297 -#define VertexAttribs1dvNV_remap_index 298 -#define VertexAttribs1fvNV_remap_index 299 -#define VertexAttribs1svNV_remap_index 300 -#define VertexAttribs2dvNV_remap_index 301 -#define VertexAttribs2fvNV_remap_index 302 -#define VertexAttribs2svNV_remap_index 303 -#define VertexAttribs3dvNV_remap_index 304 -#define VertexAttribs3fvNV_remap_index 305 -#define VertexAttribs3svNV_remap_index 306 -#define VertexAttribs4dvNV_remap_index 307 -#define VertexAttribs4fvNV_remap_index 308 -#define VertexAttribs4svNV_remap_index 309 -#define VertexAttribs4ubvNV_remap_index 310 -#define GetTexBumpParameterfvATI_remap_index 311 -#define GetTexBumpParameterivATI_remap_index 312 -#define TexBumpParameterfvATI_remap_index 313 -#define TexBumpParameterivATI_remap_index 314 -#define AlphaFragmentOp1ATI_remap_index 315 -#define AlphaFragmentOp2ATI_remap_index 316 -#define AlphaFragmentOp3ATI_remap_index 317 -#define BeginFragmentShaderATI_remap_index 318 -#define BindFragmentShaderATI_remap_index 319 -#define ColorFragmentOp1ATI_remap_index 320 -#define ColorFragmentOp2ATI_remap_index 321 -#define ColorFragmentOp3ATI_remap_index 322 -#define DeleteFragmentShaderATI_remap_index 323 -#define EndFragmentShaderATI_remap_index 324 -#define GenFragmentShadersATI_remap_index 325 -#define PassTexCoordATI_remap_index 326 -#define SampleMapATI_remap_index 327 -#define SetFragmentShaderConstantATI_remap_index 328 -#define PointParameteriNV_remap_index 329 -#define PointParameterivNV_remap_index 330 -#define ActiveStencilFaceEXT_remap_index 331 -#define BindVertexArrayAPPLE_remap_index 332 -#define DeleteVertexArraysAPPLE_remap_index 333 -#define GenVertexArraysAPPLE_remap_index 334 -#define IsVertexArrayAPPLE_remap_index 335 -#define GetProgramNamedParameterdvNV_remap_index 336 -#define GetProgramNamedParameterfvNV_remap_index 337 -#define ProgramNamedParameter4dNV_remap_index 338 -#define ProgramNamedParameter4dvNV_remap_index 339 -#define ProgramNamedParameter4fNV_remap_index 340 -#define ProgramNamedParameter4fvNV_remap_index 341 -#define DepthBoundsEXT_remap_index 342 -#define BlendEquationSeparateEXT_remap_index 343 -#define BindFramebufferEXT_remap_index 344 -#define BindRenderbufferEXT_remap_index 345 -#define CheckFramebufferStatusEXT_remap_index 346 -#define DeleteFramebuffersEXT_remap_index 347 -#define DeleteRenderbuffersEXT_remap_index 348 -#define FramebufferRenderbufferEXT_remap_index 349 -#define FramebufferTexture1DEXT_remap_index 350 -#define FramebufferTexture2DEXT_remap_index 351 -#define FramebufferTexture3DEXT_remap_index 352 -#define GenFramebuffersEXT_remap_index 353 -#define GenRenderbuffersEXT_remap_index 354 -#define GenerateMipmapEXT_remap_index 355 -#define GetFramebufferAttachmentParameterivEXT_remap_index 356 -#define GetRenderbufferParameterivEXT_remap_index 357 -#define IsFramebufferEXT_remap_index 358 -#define IsRenderbufferEXT_remap_index 359 -#define RenderbufferStorageEXT_remap_index 360 -#define BlitFramebufferEXT_remap_index 361 -#define FramebufferTextureLayerEXT_remap_index 362 -#define StencilFuncSeparateATI_remap_index 363 -#define ProgramEnvParameters4fvEXT_remap_index 364 -#define ProgramLocalParameters4fvEXT_remap_index 365 -#define GetQueryObjecti64vEXT_remap_index 366 -#define GetQueryObjectui64vEXT_remap_index 367 +#define FlushMappedBufferRange_remap_index 154 +#define MapBufferRange_remap_index 155 +#define BindVertexArray_remap_index 156 +#define GenVertexArrays_remap_index 157 +#define CopyBufferSubData_remap_index 158 +#define PolygonOffsetEXT_remap_index 159 +#define GetPixelTexGenParameterfvSGIS_remap_index 160 +#define GetPixelTexGenParameterivSGIS_remap_index 161 +#define PixelTexGenParameterfSGIS_remap_index 162 +#define PixelTexGenParameterfvSGIS_remap_index 163 +#define PixelTexGenParameteriSGIS_remap_index 164 +#define PixelTexGenParameterivSGIS_remap_index 165 +#define SampleMaskSGIS_remap_index 166 +#define SamplePatternSGIS_remap_index 167 +#define ColorPointerEXT_remap_index 168 +#define EdgeFlagPointerEXT_remap_index 169 +#define IndexPointerEXT_remap_index 170 +#define NormalPointerEXT_remap_index 171 +#define TexCoordPointerEXT_remap_index 172 +#define VertexPointerEXT_remap_index 173 +#define PointParameterfEXT_remap_index 174 +#define PointParameterfvEXT_remap_index 175 +#define LockArraysEXT_remap_index 176 +#define UnlockArraysEXT_remap_index 177 +#define CullParameterdvEXT_remap_index 178 +#define CullParameterfvEXT_remap_index 179 +#define SecondaryColor3bEXT_remap_index 180 +#define SecondaryColor3bvEXT_remap_index 181 +#define SecondaryColor3dEXT_remap_index 182 +#define SecondaryColor3dvEXT_remap_index 183 +#define SecondaryColor3fEXT_remap_index 184 +#define SecondaryColor3fvEXT_remap_index 185 +#define SecondaryColor3iEXT_remap_index 186 +#define SecondaryColor3ivEXT_remap_index 187 +#define SecondaryColor3sEXT_remap_index 188 +#define SecondaryColor3svEXT_remap_index 189 +#define SecondaryColor3ubEXT_remap_index 190 +#define SecondaryColor3ubvEXT_remap_index 191 +#define SecondaryColor3uiEXT_remap_index 192 +#define SecondaryColor3uivEXT_remap_index 193 +#define SecondaryColor3usEXT_remap_index 194 +#define SecondaryColor3usvEXT_remap_index 195 +#define SecondaryColorPointerEXT_remap_index 196 +#define MultiDrawArraysEXT_remap_index 197 +#define MultiDrawElementsEXT_remap_index 198 +#define FogCoordPointerEXT_remap_index 199 +#define FogCoorddEXT_remap_index 200 +#define FogCoorddvEXT_remap_index 201 +#define FogCoordfEXT_remap_index 202 +#define FogCoordfvEXT_remap_index 203 +#define PixelTexGenSGIX_remap_index 204 +#define BlendFuncSeparateEXT_remap_index 205 +#define FlushVertexArrayRangeNV_remap_index 206 +#define VertexArrayRangeNV_remap_index 207 +#define CombinerInputNV_remap_index 208 +#define CombinerOutputNV_remap_index 209 +#define CombinerParameterfNV_remap_index 210 +#define CombinerParameterfvNV_remap_index 211 +#define CombinerParameteriNV_remap_index 212 +#define CombinerParameterivNV_remap_index 213 +#define FinalCombinerInputNV_remap_index 214 +#define GetCombinerInputParameterfvNV_remap_index 215 +#define GetCombinerInputParameterivNV_remap_index 216 +#define GetCombinerOutputParameterfvNV_remap_index 217 +#define GetCombinerOutputParameterivNV_remap_index 218 +#define GetFinalCombinerInputParameterfvNV_remap_index 219 +#define GetFinalCombinerInputParameterivNV_remap_index 220 +#define ResizeBuffersMESA_remap_index 221 +#define WindowPos2dMESA_remap_index 222 +#define WindowPos2dvMESA_remap_index 223 +#define WindowPos2fMESA_remap_index 224 +#define WindowPos2fvMESA_remap_index 225 +#define WindowPos2iMESA_remap_index 226 +#define WindowPos2ivMESA_remap_index 227 +#define WindowPos2sMESA_remap_index 228 +#define WindowPos2svMESA_remap_index 229 +#define WindowPos3dMESA_remap_index 230 +#define WindowPos3dvMESA_remap_index 231 +#define WindowPos3fMESA_remap_index 232 +#define WindowPos3fvMESA_remap_index 233 +#define WindowPos3iMESA_remap_index 234 +#define WindowPos3ivMESA_remap_index 235 +#define WindowPos3sMESA_remap_index 236 +#define WindowPos3svMESA_remap_index 237 +#define WindowPos4dMESA_remap_index 238 +#define WindowPos4dvMESA_remap_index 239 +#define WindowPos4fMESA_remap_index 240 +#define WindowPos4fvMESA_remap_index 241 +#define WindowPos4iMESA_remap_index 242 +#define WindowPos4ivMESA_remap_index 243 +#define WindowPos4sMESA_remap_index 244 +#define WindowPos4svMESA_remap_index 245 +#define MultiModeDrawArraysIBM_remap_index 246 +#define MultiModeDrawElementsIBM_remap_index 247 +#define DeleteFencesNV_remap_index 248 +#define FinishFenceNV_remap_index 249 +#define GenFencesNV_remap_index 250 +#define GetFenceivNV_remap_index 251 +#define IsFenceNV_remap_index 252 +#define SetFenceNV_remap_index 253 +#define TestFenceNV_remap_index 254 +#define AreProgramsResidentNV_remap_index 255 +#define BindProgramNV_remap_index 256 +#define DeleteProgramsNV_remap_index 257 +#define ExecuteProgramNV_remap_index 258 +#define GenProgramsNV_remap_index 259 +#define GetProgramParameterdvNV_remap_index 260 +#define GetProgramParameterfvNV_remap_index 261 +#define GetProgramStringNV_remap_index 262 +#define GetProgramivNV_remap_index 263 +#define GetTrackMatrixivNV_remap_index 264 +#define GetVertexAttribPointervNV_remap_index 265 +#define GetVertexAttribdvNV_remap_index 266 +#define GetVertexAttribfvNV_remap_index 267 +#define GetVertexAttribivNV_remap_index 268 +#define IsProgramNV_remap_index 269 +#define LoadProgramNV_remap_index 270 +#define ProgramParameters4dvNV_remap_index 271 +#define ProgramParameters4fvNV_remap_index 272 +#define RequestResidentProgramsNV_remap_index 273 +#define TrackMatrixNV_remap_index 274 +#define VertexAttrib1dNV_remap_index 275 +#define VertexAttrib1dvNV_remap_index 276 +#define VertexAttrib1fNV_remap_index 277 +#define VertexAttrib1fvNV_remap_index 278 +#define VertexAttrib1sNV_remap_index 279 +#define VertexAttrib1svNV_remap_index 280 +#define VertexAttrib2dNV_remap_index 281 +#define VertexAttrib2dvNV_remap_index 282 +#define VertexAttrib2fNV_remap_index 283 +#define VertexAttrib2fvNV_remap_index 284 +#define VertexAttrib2sNV_remap_index 285 +#define VertexAttrib2svNV_remap_index 286 +#define VertexAttrib3dNV_remap_index 287 +#define VertexAttrib3dvNV_remap_index 288 +#define VertexAttrib3fNV_remap_index 289 +#define VertexAttrib3fvNV_remap_index 290 +#define VertexAttrib3sNV_remap_index 291 +#define VertexAttrib3svNV_remap_index 292 +#define VertexAttrib4dNV_remap_index 293 +#define VertexAttrib4dvNV_remap_index 294 +#define VertexAttrib4fNV_remap_index 295 +#define VertexAttrib4fvNV_remap_index 296 +#define VertexAttrib4sNV_remap_index 297 +#define VertexAttrib4svNV_remap_index 298 +#define VertexAttrib4ubNV_remap_index 299 +#define VertexAttrib4ubvNV_remap_index 300 +#define VertexAttribPointerNV_remap_index 301 +#define VertexAttribs1dvNV_remap_index 302 +#define VertexAttribs1fvNV_remap_index 303 +#define VertexAttribs1svNV_remap_index 304 +#define VertexAttribs2dvNV_remap_index 305 +#define VertexAttribs2fvNV_remap_index 306 +#define VertexAttribs2svNV_remap_index 307 +#define VertexAttribs3dvNV_remap_index 308 +#define VertexAttribs3fvNV_remap_index 309 +#define VertexAttribs3svNV_remap_index 310 +#define VertexAttribs4dvNV_remap_index 311 +#define VertexAttribs4fvNV_remap_index 312 +#define VertexAttribs4svNV_remap_index 313 +#define VertexAttribs4ubvNV_remap_index 314 +#define GetTexBumpParameterfvATI_remap_index 315 +#define GetTexBumpParameterivATI_remap_index 316 +#define TexBumpParameterfvATI_remap_index 317 +#define TexBumpParameterivATI_remap_index 318 +#define AlphaFragmentOp1ATI_remap_index 319 +#define AlphaFragmentOp2ATI_remap_index 320 +#define AlphaFragmentOp3ATI_remap_index 321 +#define BeginFragmentShaderATI_remap_index 322 +#define BindFragmentShaderATI_remap_index 323 +#define ColorFragmentOp1ATI_remap_index 324 +#define ColorFragmentOp2ATI_remap_index 325 +#define ColorFragmentOp3ATI_remap_index 326 +#define DeleteFragmentShaderATI_remap_index 327 +#define EndFragmentShaderATI_remap_index 328 +#define GenFragmentShadersATI_remap_index 329 +#define PassTexCoordATI_remap_index 330 +#define SampleMapATI_remap_index 331 +#define SetFragmentShaderConstantATI_remap_index 332 +#define PointParameteriNV_remap_index 333 +#define PointParameterivNV_remap_index 334 +#define ActiveStencilFaceEXT_remap_index 335 +#define BindVertexArrayAPPLE_remap_index 336 +#define DeleteVertexArraysAPPLE_remap_index 337 +#define GenVertexArraysAPPLE_remap_index 338 +#define IsVertexArrayAPPLE_remap_index 339 +#define GetProgramNamedParameterdvNV_remap_index 340 +#define GetProgramNamedParameterfvNV_remap_index 341 +#define ProgramNamedParameter4dNV_remap_index 342 +#define ProgramNamedParameter4dvNV_remap_index 343 +#define ProgramNamedParameter4fNV_remap_index 344 +#define ProgramNamedParameter4fvNV_remap_index 345 +#define DepthBoundsEXT_remap_index 346 +#define BlendEquationSeparateEXT_remap_index 347 +#define BindFramebufferEXT_remap_index 348 +#define BindRenderbufferEXT_remap_index 349 +#define CheckFramebufferStatusEXT_remap_index 350 +#define DeleteFramebuffersEXT_remap_index 351 +#define DeleteRenderbuffersEXT_remap_index 352 +#define FramebufferRenderbufferEXT_remap_index 353 +#define FramebufferTexture1DEXT_remap_index 354 +#define FramebufferTexture2DEXT_remap_index 355 +#define FramebufferTexture3DEXT_remap_index 356 +#define GenFramebuffersEXT_remap_index 357 +#define GenRenderbuffersEXT_remap_index 358 +#define GenerateMipmapEXT_remap_index 359 +#define GetFramebufferAttachmentParameterivEXT_remap_index 360 +#define GetRenderbufferParameterivEXT_remap_index 361 +#define IsFramebufferEXT_remap_index 362 +#define IsRenderbufferEXT_remap_index 363 +#define RenderbufferStorageEXT_remap_index 364 +#define BlitFramebufferEXT_remap_index 365 +#define FramebufferTextureLayerEXT_remap_index 366 +#define ProvokingVertexEXT_remap_index 367 +#define StencilFuncSeparateATI_remap_index 368 +#define ProgramEnvParameters4fvEXT_remap_index 369 +#define ProgramLocalParameters4fvEXT_remap_index 370 +#define GetQueryObjecti64vEXT_remap_index 371 +#define GetQueryObjectui64vEXT_remap_index 372 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -3225,6 +3245,18 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_RenderbufferStorageMultisample(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)), driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], parameters) #define GET_RenderbufferStorageMultisample(disp) GET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index]) #define SET_RenderbufferStorageMultisample(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], fn) +#define CALL_FlushMappedBufferRange(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptr, GLsizeiptr)), driDispatchRemapTable[FlushMappedBufferRange_remap_index], parameters) +#define GET_FlushMappedBufferRange(disp) GET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRange_remap_index]) +#define SET_FlushMappedBufferRange(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRange_remap_index], fn) +#define CALL_MapBufferRange(disp, parameters) CALL_by_offset(disp, (GLvoid * (GLAPIENTRYP)(GLenum, GLintptr, GLsizeiptr, GLbitfield)), driDispatchRemapTable[MapBufferRange_remap_index], parameters) +#define GET_MapBufferRange(disp) GET_by_offset(disp, driDispatchRemapTable[MapBufferRange_remap_index]) +#define SET_MapBufferRange(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MapBufferRange_remap_index], fn) +#define CALL_BindVertexArray(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[BindVertexArray_remap_index], parameters) +#define GET_BindVertexArray(disp) GET_by_offset(disp, driDispatchRemapTable[BindVertexArray_remap_index]) +#define SET_BindVertexArray(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindVertexArray_remap_index], fn) +#define CALL_GenVertexArrays(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenVertexArrays_remap_index], parameters) +#define GET_GenVertexArrays(disp) GET_by_offset(disp, driDispatchRemapTable[GenVertexArrays_remap_index]) +#define SET_GenVertexArrays(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenVertexArrays_remap_index], fn) #define CALL_CopyBufferSubData(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr)), driDispatchRemapTable[CopyBufferSubData_remap_index], parameters) #define GET_CopyBufferSubData(disp) GET_by_offset(disp, driDispatchRemapTable[CopyBufferSubData_remap_index]) #define SET_CopyBufferSubData(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CopyBufferSubData_remap_index], fn) @@ -3852,6 +3884,9 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_FramebufferTextureLayerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLuint, GLint, GLint)), driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], parameters) #define GET_FramebufferTextureLayerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index]) #define SET_FramebufferTextureLayerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], fn) +#define CALL_ProvokingVertexEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[ProvokingVertexEXT_remap_index], parameters) +#define GET_ProvokingVertexEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index]) +#define SET_ProvokingVertexEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index], fn) #define CALL_StencilFuncSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparateATI_remap_index], parameters) #define GET_StencilFuncSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index]) #define SET_StencilFuncSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index], fn) diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index aa893b1e020..06560d175af 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -7950,6 +7950,10 @@ <xi:include href="ARB_copy_buffer.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<xi:include href="ARB_map_buffer_range.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<xi:include href="ARB_vertex_array_object.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + <!-- Non-ARB extensions sorted by extension number. --> @@ -12226,6 +12230,8 @@ <xi:include href="EXT_framebuffer_object.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<xi:include href="EXT_provoking_vertex.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + <category name="GL_EXT_framebuffer_blit" number="316"> <enum name="READ_FRAMEBUFFER_EXT" value="0x8CA8"/> <enum name="DRAW_FRAMEBUFFER_EXT" value="0x8CA9"/> diff --git a/src/mesa/glapi/gl_enums.py b/src/mesa/glapi/gl_enums.py index b32e0126631..27ab119537e 100644 --- a/src/mesa/glapi/gl_enums.py +++ b/src/mesa/glapi/gl_enums.py @@ -110,6 +110,29 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } } +/* Get the name of an enum given that it is a primitive type. Avoids + * GL_FALSE/GL_POINTS ambiguity and others. + */ +const char *_mesa_lookup_prim_by_nr( int nr ) +{ + switch (nr) { + case GL_POINTS: return "GL_POINTS"; + case GL_LINES: return "GL_LINES"; + case GL_LINE_STRIP: return "GL_LINE_STRIP"; + case GL_LINE_LOOP: return "GL_LINE_LOOP"; + case GL_TRIANGLES: return "GL_TRIANGLES"; + case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP"; + case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN"; + case GL_QUADS: return "GL_QUADS"; + case GL_QUAD_STRIP: return "GL_QUAD_STRIP"; + case GL_POLYGON: return "GL_POLYGON"; + case GL_POLYGON+1: return "OUTSIDE_BEGIN_END"; + default: return "<invalid>"; + } +} + + + int _mesa_lookup_enum_by_name( const char *symbol ) { enum_elt * f = NULL; diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h index e29e2e3bfa2..9ed67a645f4 100644 --- a/src/mesa/glapi/glapioffsets.h +++ b/src/mesa/glapi/glapioffsets.h @@ -594,221 +594,226 @@ #define _gloffset_GetAttribLocationARB 559 #define _gloffset_DrawBuffersARB 560 #define _gloffset_RenderbufferStorageMultisample 561 -#define _gloffset_CopyBufferSubData 562 -#define _gloffset_PolygonOffsetEXT 563 -#define _gloffset_GetPixelTexGenParameterfvSGIS 564 -#define _gloffset_GetPixelTexGenParameterivSGIS 565 -#define _gloffset_PixelTexGenParameterfSGIS 566 -#define _gloffset_PixelTexGenParameterfvSGIS 567 -#define _gloffset_PixelTexGenParameteriSGIS 568 -#define _gloffset_PixelTexGenParameterivSGIS 569 -#define _gloffset_SampleMaskSGIS 570 -#define _gloffset_SamplePatternSGIS 571 -#define _gloffset_ColorPointerEXT 572 -#define _gloffset_EdgeFlagPointerEXT 573 -#define _gloffset_IndexPointerEXT 574 -#define _gloffset_NormalPointerEXT 575 -#define _gloffset_TexCoordPointerEXT 576 -#define _gloffset_VertexPointerEXT 577 -#define _gloffset_PointParameterfEXT 578 -#define _gloffset_PointParameterfvEXT 579 -#define _gloffset_LockArraysEXT 580 -#define _gloffset_UnlockArraysEXT 581 -#define _gloffset_CullParameterdvEXT 582 -#define _gloffset_CullParameterfvEXT 583 -#define _gloffset_SecondaryColor3bEXT 584 -#define _gloffset_SecondaryColor3bvEXT 585 -#define _gloffset_SecondaryColor3dEXT 586 -#define _gloffset_SecondaryColor3dvEXT 587 -#define _gloffset_SecondaryColor3fEXT 588 -#define _gloffset_SecondaryColor3fvEXT 589 -#define _gloffset_SecondaryColor3iEXT 590 -#define _gloffset_SecondaryColor3ivEXT 591 -#define _gloffset_SecondaryColor3sEXT 592 -#define _gloffset_SecondaryColor3svEXT 593 -#define _gloffset_SecondaryColor3ubEXT 594 -#define _gloffset_SecondaryColor3ubvEXT 595 -#define _gloffset_SecondaryColor3uiEXT 596 -#define _gloffset_SecondaryColor3uivEXT 597 -#define _gloffset_SecondaryColor3usEXT 598 -#define _gloffset_SecondaryColor3usvEXT 599 -#define _gloffset_SecondaryColorPointerEXT 600 -#define _gloffset_MultiDrawArraysEXT 601 -#define _gloffset_MultiDrawElementsEXT 602 -#define _gloffset_FogCoordPointerEXT 603 -#define _gloffset_FogCoorddEXT 604 -#define _gloffset_FogCoorddvEXT 605 -#define _gloffset_FogCoordfEXT 606 -#define _gloffset_FogCoordfvEXT 607 -#define _gloffset_PixelTexGenSGIX 608 -#define _gloffset_BlendFuncSeparateEXT 609 -#define _gloffset_FlushVertexArrayRangeNV 610 -#define _gloffset_VertexArrayRangeNV 611 -#define _gloffset_CombinerInputNV 612 -#define _gloffset_CombinerOutputNV 613 -#define _gloffset_CombinerParameterfNV 614 -#define _gloffset_CombinerParameterfvNV 615 -#define _gloffset_CombinerParameteriNV 616 -#define _gloffset_CombinerParameterivNV 617 -#define _gloffset_FinalCombinerInputNV 618 -#define _gloffset_GetCombinerInputParameterfvNV 619 -#define _gloffset_GetCombinerInputParameterivNV 620 -#define _gloffset_GetCombinerOutputParameterfvNV 621 -#define _gloffset_GetCombinerOutputParameterivNV 622 -#define _gloffset_GetFinalCombinerInputParameterfvNV 623 -#define _gloffset_GetFinalCombinerInputParameterivNV 624 -#define _gloffset_ResizeBuffersMESA 625 -#define _gloffset_WindowPos2dMESA 626 -#define _gloffset_WindowPos2dvMESA 627 -#define _gloffset_WindowPos2fMESA 628 -#define _gloffset_WindowPos2fvMESA 629 -#define _gloffset_WindowPos2iMESA 630 -#define _gloffset_WindowPos2ivMESA 631 -#define _gloffset_WindowPos2sMESA 632 -#define _gloffset_WindowPos2svMESA 633 -#define _gloffset_WindowPos3dMESA 634 -#define _gloffset_WindowPos3dvMESA 635 -#define _gloffset_WindowPos3fMESA 636 -#define _gloffset_WindowPos3fvMESA 637 -#define _gloffset_WindowPos3iMESA 638 -#define _gloffset_WindowPos3ivMESA 639 -#define _gloffset_WindowPos3sMESA 640 -#define _gloffset_WindowPos3svMESA 641 -#define _gloffset_WindowPos4dMESA 642 -#define _gloffset_WindowPos4dvMESA 643 -#define _gloffset_WindowPos4fMESA 644 -#define _gloffset_WindowPos4fvMESA 645 -#define _gloffset_WindowPos4iMESA 646 -#define _gloffset_WindowPos4ivMESA 647 -#define _gloffset_WindowPos4sMESA 648 -#define _gloffset_WindowPos4svMESA 649 -#define _gloffset_MultiModeDrawArraysIBM 650 -#define _gloffset_MultiModeDrawElementsIBM 651 -#define _gloffset_DeleteFencesNV 652 -#define _gloffset_FinishFenceNV 653 -#define _gloffset_GenFencesNV 654 -#define _gloffset_GetFenceivNV 655 -#define _gloffset_IsFenceNV 656 -#define _gloffset_SetFenceNV 657 -#define _gloffset_TestFenceNV 658 -#define _gloffset_AreProgramsResidentNV 659 -#define _gloffset_BindProgramNV 660 -#define _gloffset_DeleteProgramsNV 661 -#define _gloffset_ExecuteProgramNV 662 -#define _gloffset_GenProgramsNV 663 -#define _gloffset_GetProgramParameterdvNV 664 -#define _gloffset_GetProgramParameterfvNV 665 -#define _gloffset_GetProgramStringNV 666 -#define _gloffset_GetProgramivNV 667 -#define _gloffset_GetTrackMatrixivNV 668 -#define _gloffset_GetVertexAttribPointervNV 669 -#define _gloffset_GetVertexAttribdvNV 670 -#define _gloffset_GetVertexAttribfvNV 671 -#define _gloffset_GetVertexAttribivNV 672 -#define _gloffset_IsProgramNV 673 -#define _gloffset_LoadProgramNV 674 -#define _gloffset_ProgramParameters4dvNV 675 -#define _gloffset_ProgramParameters4fvNV 676 -#define _gloffset_RequestResidentProgramsNV 677 -#define _gloffset_TrackMatrixNV 678 -#define _gloffset_VertexAttrib1dNV 679 -#define _gloffset_VertexAttrib1dvNV 680 -#define _gloffset_VertexAttrib1fNV 681 -#define _gloffset_VertexAttrib1fvNV 682 -#define _gloffset_VertexAttrib1sNV 683 -#define _gloffset_VertexAttrib1svNV 684 -#define _gloffset_VertexAttrib2dNV 685 -#define _gloffset_VertexAttrib2dvNV 686 -#define _gloffset_VertexAttrib2fNV 687 -#define _gloffset_VertexAttrib2fvNV 688 -#define _gloffset_VertexAttrib2sNV 689 -#define _gloffset_VertexAttrib2svNV 690 -#define _gloffset_VertexAttrib3dNV 691 -#define _gloffset_VertexAttrib3dvNV 692 -#define _gloffset_VertexAttrib3fNV 693 -#define _gloffset_VertexAttrib3fvNV 694 -#define _gloffset_VertexAttrib3sNV 695 -#define _gloffset_VertexAttrib3svNV 696 -#define _gloffset_VertexAttrib4dNV 697 -#define _gloffset_VertexAttrib4dvNV 698 -#define _gloffset_VertexAttrib4fNV 699 -#define _gloffset_VertexAttrib4fvNV 700 -#define _gloffset_VertexAttrib4sNV 701 -#define _gloffset_VertexAttrib4svNV 702 -#define _gloffset_VertexAttrib4ubNV 703 -#define _gloffset_VertexAttrib4ubvNV 704 -#define _gloffset_VertexAttribPointerNV 705 -#define _gloffset_VertexAttribs1dvNV 706 -#define _gloffset_VertexAttribs1fvNV 707 -#define _gloffset_VertexAttribs1svNV 708 -#define _gloffset_VertexAttribs2dvNV 709 -#define _gloffset_VertexAttribs2fvNV 710 -#define _gloffset_VertexAttribs2svNV 711 -#define _gloffset_VertexAttribs3dvNV 712 -#define _gloffset_VertexAttribs3fvNV 713 -#define _gloffset_VertexAttribs3svNV 714 -#define _gloffset_VertexAttribs4dvNV 715 -#define _gloffset_VertexAttribs4fvNV 716 -#define _gloffset_VertexAttribs4svNV 717 -#define _gloffset_VertexAttribs4ubvNV 718 -#define _gloffset_GetTexBumpParameterfvATI 719 -#define _gloffset_GetTexBumpParameterivATI 720 -#define _gloffset_TexBumpParameterfvATI 721 -#define _gloffset_TexBumpParameterivATI 722 -#define _gloffset_AlphaFragmentOp1ATI 723 -#define _gloffset_AlphaFragmentOp2ATI 724 -#define _gloffset_AlphaFragmentOp3ATI 725 -#define _gloffset_BeginFragmentShaderATI 726 -#define _gloffset_BindFragmentShaderATI 727 -#define _gloffset_ColorFragmentOp1ATI 728 -#define _gloffset_ColorFragmentOp2ATI 729 -#define _gloffset_ColorFragmentOp3ATI 730 -#define _gloffset_DeleteFragmentShaderATI 731 -#define _gloffset_EndFragmentShaderATI 732 -#define _gloffset_GenFragmentShadersATI 733 -#define _gloffset_PassTexCoordATI 734 -#define _gloffset_SampleMapATI 735 -#define _gloffset_SetFragmentShaderConstantATI 736 -#define _gloffset_PointParameteriNV 737 -#define _gloffset_PointParameterivNV 738 -#define _gloffset_ActiveStencilFaceEXT 739 -#define _gloffset_BindVertexArrayAPPLE 740 -#define _gloffset_DeleteVertexArraysAPPLE 741 -#define _gloffset_GenVertexArraysAPPLE 742 -#define _gloffset_IsVertexArrayAPPLE 743 -#define _gloffset_GetProgramNamedParameterdvNV 744 -#define _gloffset_GetProgramNamedParameterfvNV 745 -#define _gloffset_ProgramNamedParameter4dNV 746 -#define _gloffset_ProgramNamedParameter4dvNV 747 -#define _gloffset_ProgramNamedParameter4fNV 748 -#define _gloffset_ProgramNamedParameter4fvNV 749 -#define _gloffset_DepthBoundsEXT 750 -#define _gloffset_BlendEquationSeparateEXT 751 -#define _gloffset_BindFramebufferEXT 752 -#define _gloffset_BindRenderbufferEXT 753 -#define _gloffset_CheckFramebufferStatusEXT 754 -#define _gloffset_DeleteFramebuffersEXT 755 -#define _gloffset_DeleteRenderbuffersEXT 756 -#define _gloffset_FramebufferRenderbufferEXT 757 -#define _gloffset_FramebufferTexture1DEXT 758 -#define _gloffset_FramebufferTexture2DEXT 759 -#define _gloffset_FramebufferTexture3DEXT 760 -#define _gloffset_GenFramebuffersEXT 761 -#define _gloffset_GenRenderbuffersEXT 762 -#define _gloffset_GenerateMipmapEXT 763 -#define _gloffset_GetFramebufferAttachmentParameterivEXT 764 -#define _gloffset_GetRenderbufferParameterivEXT 765 -#define _gloffset_IsFramebufferEXT 766 -#define _gloffset_IsRenderbufferEXT 767 -#define _gloffset_RenderbufferStorageEXT 768 -#define _gloffset_BlitFramebufferEXT 769 -#define _gloffset_FramebufferTextureLayerEXT 770 -#define _gloffset_StencilFuncSeparateATI 771 -#define _gloffset_ProgramEnvParameters4fvEXT 772 -#define _gloffset_ProgramLocalParameters4fvEXT 773 -#define _gloffset_GetQueryObjecti64vEXT 774 -#define _gloffset_GetQueryObjectui64vEXT 775 -#define _gloffset_FIRST_DYNAMIC 776 +#define _gloffset_FlushMappedBufferRange 562 +#define _gloffset_MapBufferRange 563 +#define _gloffset_BindVertexArray 564 +#define _gloffset_GenVertexArrays 565 +#define _gloffset_CopyBufferSubData 566 +#define _gloffset_PolygonOffsetEXT 567 +#define _gloffset_GetPixelTexGenParameterfvSGIS 568 +#define _gloffset_GetPixelTexGenParameterivSGIS 569 +#define _gloffset_PixelTexGenParameterfSGIS 570 +#define _gloffset_PixelTexGenParameterfvSGIS 571 +#define _gloffset_PixelTexGenParameteriSGIS 572 +#define _gloffset_PixelTexGenParameterivSGIS 573 +#define _gloffset_SampleMaskSGIS 574 +#define _gloffset_SamplePatternSGIS 575 +#define _gloffset_ColorPointerEXT 576 +#define _gloffset_EdgeFlagPointerEXT 577 +#define _gloffset_IndexPointerEXT 578 +#define _gloffset_NormalPointerEXT 579 +#define _gloffset_TexCoordPointerEXT 580 +#define _gloffset_VertexPointerEXT 581 +#define _gloffset_PointParameterfEXT 582 +#define _gloffset_PointParameterfvEXT 583 +#define _gloffset_LockArraysEXT 584 +#define _gloffset_UnlockArraysEXT 585 +#define _gloffset_CullParameterdvEXT 586 +#define _gloffset_CullParameterfvEXT 587 +#define _gloffset_SecondaryColor3bEXT 588 +#define _gloffset_SecondaryColor3bvEXT 589 +#define _gloffset_SecondaryColor3dEXT 590 +#define _gloffset_SecondaryColor3dvEXT 591 +#define _gloffset_SecondaryColor3fEXT 592 +#define _gloffset_SecondaryColor3fvEXT 593 +#define _gloffset_SecondaryColor3iEXT 594 +#define _gloffset_SecondaryColor3ivEXT 595 +#define _gloffset_SecondaryColor3sEXT 596 +#define _gloffset_SecondaryColor3svEXT 597 +#define _gloffset_SecondaryColor3ubEXT 598 +#define _gloffset_SecondaryColor3ubvEXT 599 +#define _gloffset_SecondaryColor3uiEXT 600 +#define _gloffset_SecondaryColor3uivEXT 601 +#define _gloffset_SecondaryColor3usEXT 602 +#define _gloffset_SecondaryColor3usvEXT 603 +#define _gloffset_SecondaryColorPointerEXT 604 +#define _gloffset_MultiDrawArraysEXT 605 +#define _gloffset_MultiDrawElementsEXT 606 +#define _gloffset_FogCoordPointerEXT 607 +#define _gloffset_FogCoorddEXT 608 +#define _gloffset_FogCoorddvEXT 609 +#define _gloffset_FogCoordfEXT 610 +#define _gloffset_FogCoordfvEXT 611 +#define _gloffset_PixelTexGenSGIX 612 +#define _gloffset_BlendFuncSeparateEXT 613 +#define _gloffset_FlushVertexArrayRangeNV 614 +#define _gloffset_VertexArrayRangeNV 615 +#define _gloffset_CombinerInputNV 616 +#define _gloffset_CombinerOutputNV 617 +#define _gloffset_CombinerParameterfNV 618 +#define _gloffset_CombinerParameterfvNV 619 +#define _gloffset_CombinerParameteriNV 620 +#define _gloffset_CombinerParameterivNV 621 +#define _gloffset_FinalCombinerInputNV 622 +#define _gloffset_GetCombinerInputParameterfvNV 623 +#define _gloffset_GetCombinerInputParameterivNV 624 +#define _gloffset_GetCombinerOutputParameterfvNV 625 +#define _gloffset_GetCombinerOutputParameterivNV 626 +#define _gloffset_GetFinalCombinerInputParameterfvNV 627 +#define _gloffset_GetFinalCombinerInputParameterivNV 628 +#define _gloffset_ResizeBuffersMESA 629 +#define _gloffset_WindowPos2dMESA 630 +#define _gloffset_WindowPos2dvMESA 631 +#define _gloffset_WindowPos2fMESA 632 +#define _gloffset_WindowPos2fvMESA 633 +#define _gloffset_WindowPos2iMESA 634 +#define _gloffset_WindowPos2ivMESA 635 +#define _gloffset_WindowPos2sMESA 636 +#define _gloffset_WindowPos2svMESA 637 +#define _gloffset_WindowPos3dMESA 638 +#define _gloffset_WindowPos3dvMESA 639 +#define _gloffset_WindowPos3fMESA 640 +#define _gloffset_WindowPos3fvMESA 641 +#define _gloffset_WindowPos3iMESA 642 +#define _gloffset_WindowPos3ivMESA 643 +#define _gloffset_WindowPos3sMESA 644 +#define _gloffset_WindowPos3svMESA 645 +#define _gloffset_WindowPos4dMESA 646 +#define _gloffset_WindowPos4dvMESA 647 +#define _gloffset_WindowPos4fMESA 648 +#define _gloffset_WindowPos4fvMESA 649 +#define _gloffset_WindowPos4iMESA 650 +#define _gloffset_WindowPos4ivMESA 651 +#define _gloffset_WindowPos4sMESA 652 +#define _gloffset_WindowPos4svMESA 653 +#define _gloffset_MultiModeDrawArraysIBM 654 +#define _gloffset_MultiModeDrawElementsIBM 655 +#define _gloffset_DeleteFencesNV 656 +#define _gloffset_FinishFenceNV 657 +#define _gloffset_GenFencesNV 658 +#define _gloffset_GetFenceivNV 659 +#define _gloffset_IsFenceNV 660 +#define _gloffset_SetFenceNV 661 +#define _gloffset_TestFenceNV 662 +#define _gloffset_AreProgramsResidentNV 663 +#define _gloffset_BindProgramNV 664 +#define _gloffset_DeleteProgramsNV 665 +#define _gloffset_ExecuteProgramNV 666 +#define _gloffset_GenProgramsNV 667 +#define _gloffset_GetProgramParameterdvNV 668 +#define _gloffset_GetProgramParameterfvNV 669 +#define _gloffset_GetProgramStringNV 670 +#define _gloffset_GetProgramivNV 671 +#define _gloffset_GetTrackMatrixivNV 672 +#define _gloffset_GetVertexAttribPointervNV 673 +#define _gloffset_GetVertexAttribdvNV 674 +#define _gloffset_GetVertexAttribfvNV 675 +#define _gloffset_GetVertexAttribivNV 676 +#define _gloffset_IsProgramNV 677 +#define _gloffset_LoadProgramNV 678 +#define _gloffset_ProgramParameters4dvNV 679 +#define _gloffset_ProgramParameters4fvNV 680 +#define _gloffset_RequestResidentProgramsNV 681 +#define _gloffset_TrackMatrixNV 682 +#define _gloffset_VertexAttrib1dNV 683 +#define _gloffset_VertexAttrib1dvNV 684 +#define _gloffset_VertexAttrib1fNV 685 +#define _gloffset_VertexAttrib1fvNV 686 +#define _gloffset_VertexAttrib1sNV 687 +#define _gloffset_VertexAttrib1svNV 688 +#define _gloffset_VertexAttrib2dNV 689 +#define _gloffset_VertexAttrib2dvNV 690 +#define _gloffset_VertexAttrib2fNV 691 +#define _gloffset_VertexAttrib2fvNV 692 +#define _gloffset_VertexAttrib2sNV 693 +#define _gloffset_VertexAttrib2svNV 694 +#define _gloffset_VertexAttrib3dNV 695 +#define _gloffset_VertexAttrib3dvNV 696 +#define _gloffset_VertexAttrib3fNV 697 +#define _gloffset_VertexAttrib3fvNV 698 +#define _gloffset_VertexAttrib3sNV 699 +#define _gloffset_VertexAttrib3svNV 700 +#define _gloffset_VertexAttrib4dNV 701 +#define _gloffset_VertexAttrib4dvNV 702 +#define _gloffset_VertexAttrib4fNV 703 +#define _gloffset_VertexAttrib4fvNV 704 +#define _gloffset_VertexAttrib4sNV 705 +#define _gloffset_VertexAttrib4svNV 706 +#define _gloffset_VertexAttrib4ubNV 707 +#define _gloffset_VertexAttrib4ubvNV 708 +#define _gloffset_VertexAttribPointerNV 709 +#define _gloffset_VertexAttribs1dvNV 710 +#define _gloffset_VertexAttribs1fvNV 711 +#define _gloffset_VertexAttribs1svNV 712 +#define _gloffset_VertexAttribs2dvNV 713 +#define _gloffset_VertexAttribs2fvNV 714 +#define _gloffset_VertexAttribs2svNV 715 +#define _gloffset_VertexAttribs3dvNV 716 +#define _gloffset_VertexAttribs3fvNV 717 +#define _gloffset_VertexAttribs3svNV 718 +#define _gloffset_VertexAttribs4dvNV 719 +#define _gloffset_VertexAttribs4fvNV 720 +#define _gloffset_VertexAttribs4svNV 721 +#define _gloffset_VertexAttribs4ubvNV 722 +#define _gloffset_GetTexBumpParameterfvATI 723 +#define _gloffset_GetTexBumpParameterivATI 724 +#define _gloffset_TexBumpParameterfvATI 725 +#define _gloffset_TexBumpParameterivATI 726 +#define _gloffset_AlphaFragmentOp1ATI 727 +#define _gloffset_AlphaFragmentOp2ATI 728 +#define _gloffset_AlphaFragmentOp3ATI 729 +#define _gloffset_BeginFragmentShaderATI 730 +#define _gloffset_BindFragmentShaderATI 731 +#define _gloffset_ColorFragmentOp1ATI 732 +#define _gloffset_ColorFragmentOp2ATI 733 +#define _gloffset_ColorFragmentOp3ATI 734 +#define _gloffset_DeleteFragmentShaderATI 735 +#define _gloffset_EndFragmentShaderATI 736 +#define _gloffset_GenFragmentShadersATI 737 +#define _gloffset_PassTexCoordATI 738 +#define _gloffset_SampleMapATI 739 +#define _gloffset_SetFragmentShaderConstantATI 740 +#define _gloffset_PointParameteriNV 741 +#define _gloffset_PointParameterivNV 742 +#define _gloffset_ActiveStencilFaceEXT 743 +#define _gloffset_BindVertexArrayAPPLE 744 +#define _gloffset_DeleteVertexArraysAPPLE 745 +#define _gloffset_GenVertexArraysAPPLE 746 +#define _gloffset_IsVertexArrayAPPLE 747 +#define _gloffset_GetProgramNamedParameterdvNV 748 +#define _gloffset_GetProgramNamedParameterfvNV 749 +#define _gloffset_ProgramNamedParameter4dNV 750 +#define _gloffset_ProgramNamedParameter4dvNV 751 +#define _gloffset_ProgramNamedParameter4fNV 752 +#define _gloffset_ProgramNamedParameter4fvNV 753 +#define _gloffset_DepthBoundsEXT 754 +#define _gloffset_BlendEquationSeparateEXT 755 +#define _gloffset_BindFramebufferEXT 756 +#define _gloffset_BindRenderbufferEXT 757 +#define _gloffset_CheckFramebufferStatusEXT 758 +#define _gloffset_DeleteFramebuffersEXT 759 +#define _gloffset_DeleteRenderbuffersEXT 760 +#define _gloffset_FramebufferRenderbufferEXT 761 +#define _gloffset_FramebufferTexture1DEXT 762 +#define _gloffset_FramebufferTexture2DEXT 763 +#define _gloffset_FramebufferTexture3DEXT 764 +#define _gloffset_GenFramebuffersEXT 765 +#define _gloffset_GenRenderbuffersEXT 766 +#define _gloffset_GenerateMipmapEXT 767 +#define _gloffset_GetFramebufferAttachmentParameterivEXT 768 +#define _gloffset_GetRenderbufferParameterivEXT 769 +#define _gloffset_IsFramebufferEXT 770 +#define _gloffset_IsRenderbufferEXT 771 +#define _gloffset_RenderbufferStorageEXT 772 +#define _gloffset_BlitFramebufferEXT 773 +#define _gloffset_FramebufferTextureLayerEXT 774 +#define _gloffset_ProvokingVertexEXT 775 +#define _gloffset_StencilFuncSeparateATI 776 +#define _gloffset_ProgramEnvParameters4fvEXT 777 +#define _gloffset_ProgramLocalParameters4fvEXT 778 +#define _gloffset_GetQueryObjecti64vEXT 779 +#define _gloffset_GetQueryObjectui64vEXT 780 +#define _gloffset_FIRST_DYNAMIC 781 #else @@ -966,6 +971,10 @@ #define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index] #define _gloffset_DrawBuffersARB driDispatchRemapTable[DrawBuffersARB_remap_index] #define _gloffset_RenderbufferStorageMultisample driDispatchRemapTable[RenderbufferStorageMultisample_remap_index] +#define _gloffset_FlushMappedBufferRange driDispatchRemapTable[FlushMappedBufferRange_remap_index] +#define _gloffset_MapBufferRange driDispatchRemapTable[MapBufferRange_remap_index] +#define _gloffset_BindVertexArray driDispatchRemapTable[BindVertexArray_remap_index] +#define _gloffset_GenVertexArrays driDispatchRemapTable[GenVertexArrays_remap_index] #define _gloffset_CopyBufferSubData driDispatchRemapTable[CopyBufferSubData_remap_index] #define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index] #define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index] @@ -1175,6 +1184,7 @@ #define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index] #define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index] #define _gloffset_FramebufferTextureLayerEXT driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index] +#define _gloffset_ProvokingVertexEXT driDispatchRemapTable[ProvokingVertexEXT_remap_index] #define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index] #define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index] #define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index] diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h index c782c900878..308de4facc9 100644 --- a/src/mesa/glapi/glapitable.h +++ b/src/mesa/glapi/glapitable.h @@ -602,220 +602,225 @@ struct _glapi_table GLint (GLAPIENTRYP GetAttribLocationARB)(GLhandleARB program, const GLcharARB * name); /* 559 */ void (GLAPIENTRYP DrawBuffersARB)(GLsizei n, const GLenum * bufs); /* 560 */ void (GLAPIENTRYP RenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); /* 561 */ - void (GLAPIENTRYP CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); /* 562 */ - void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 563 */ - void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 564 */ - void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 565 */ - void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 566 */ - void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 567 */ - void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 568 */ - void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 569 */ - void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 570 */ - void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 571 */ - void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 572 */ - void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 573 */ - void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 574 */ - void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 575 */ - void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 576 */ - void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 577 */ - void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 578 */ - void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 579 */ - void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 580 */ - void (GLAPIENTRYP UnlockArraysEXT)(void); /* 581 */ - void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 582 */ - void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 583 */ - void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 584 */ - void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 585 */ - void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 586 */ - void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 587 */ - void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 588 */ - void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 589 */ - void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 590 */ - void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 591 */ - void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 592 */ - void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 593 */ - void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 594 */ - void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 595 */ - void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 596 */ - void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 597 */ - void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 598 */ - void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 599 */ - void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 600 */ - void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 601 */ - void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 602 */ - void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 603 */ - void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 604 */ - void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 605 */ - void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 606 */ - void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 607 */ - void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 608 */ - void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 609 */ - void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 610 */ - void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 611 */ - void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 612 */ - void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 613 */ - void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 614 */ - void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 615 */ - void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 616 */ - void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 617 */ - void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 618 */ - void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 619 */ - void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 620 */ - void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 621 */ - void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 622 */ - void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 623 */ - void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 624 */ - void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 625 */ - void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 626 */ - void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 627 */ - void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 628 */ - void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 629 */ - void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 630 */ - void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 631 */ - void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 632 */ - void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 633 */ - void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 634 */ - void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 635 */ - void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 636 */ - void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 637 */ - void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 638 */ - void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 639 */ - void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 640 */ - void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 641 */ - void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 642 */ - void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 643 */ - void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 644 */ - void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 645 */ - void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 646 */ - void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 647 */ - void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 648 */ - void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 649 */ - void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 650 */ - void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 651 */ - void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 652 */ - void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 653 */ - void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 654 */ - void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 655 */ - GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 656 */ - void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 657 */ - GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 658 */ - GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 659 */ - void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 660 */ - void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 661 */ - void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 662 */ - void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 663 */ - void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 664 */ - void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 665 */ - void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 666 */ - void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 667 */ - void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 668 */ - void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 669 */ - void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 670 */ - void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 671 */ - void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 672 */ - GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 673 */ - void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 674 */ - void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 675 */ - void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 676 */ - void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 677 */ - void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 678 */ - void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 679 */ - void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 680 */ - void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 681 */ - void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 682 */ - void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 683 */ - void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 684 */ - void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 685 */ - void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 686 */ - void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 687 */ - void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 688 */ - void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 689 */ - void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 690 */ - void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 691 */ - void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 692 */ - void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 693 */ - void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 694 */ - void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 695 */ - void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 696 */ - void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 697 */ - void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 698 */ - void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 699 */ - void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 700 */ - void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 701 */ - void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 702 */ - void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 703 */ - void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 704 */ - void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 705 */ - void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 706 */ - void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 707 */ - void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 708 */ - void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 709 */ - void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 710 */ - void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 711 */ - void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 712 */ - void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 713 */ - void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 714 */ - void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 715 */ - void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 716 */ - void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 717 */ - void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 718 */ - void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 719 */ - void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 720 */ - void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 721 */ - void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 722 */ - void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 723 */ - void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 724 */ - void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 725 */ - void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 726 */ - void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 727 */ - void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 728 */ - void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 729 */ - void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 730 */ - void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 731 */ - void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 732 */ - GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 733 */ - void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 734 */ - void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 735 */ - void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 736 */ - void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 737 */ - void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 738 */ - void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 739 */ - void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 740 */ - void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 741 */ - void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 742 */ - GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 743 */ - void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 744 */ - void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 745 */ - void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 746 */ - void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 747 */ - void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 748 */ - void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 749 */ - void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 750 */ - void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 751 */ - void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 752 */ - void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 753 */ - GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 754 */ - void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 755 */ - void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 756 */ - void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 757 */ - void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 758 */ - void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 759 */ - void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 760 */ - void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 761 */ - void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 762 */ - void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 763 */ - void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 764 */ - void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 765 */ - GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 766 */ - GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 767 */ - void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 768 */ - void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 769 */ - void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 770 */ - void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 771 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 772 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 773 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 774 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 775 */ + void (GLAPIENTRYP FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length); /* 562 */ + GLvoid * (GLAPIENTRYP MapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); /* 563 */ + void (GLAPIENTRYP BindVertexArray)(GLuint array); /* 564 */ + void (GLAPIENTRYP GenVertexArrays)(GLsizei n, GLuint * arrays); /* 565 */ + void (GLAPIENTRYP CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); /* 566 */ + void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 567 */ + void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 568 */ + void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 569 */ + void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 570 */ + void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 571 */ + void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 572 */ + void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 573 */ + void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 574 */ + void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 575 */ + void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 576 */ + void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 577 */ + void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 578 */ + void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 579 */ + void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 580 */ + void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 581 */ + void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 582 */ + void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 583 */ + void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 584 */ + void (GLAPIENTRYP UnlockArraysEXT)(void); /* 585 */ + void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 586 */ + void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 587 */ + void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 588 */ + void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 589 */ + void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 590 */ + void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 591 */ + void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 592 */ + void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 593 */ + void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 594 */ + void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 595 */ + void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 596 */ + void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 597 */ + void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 598 */ + void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 599 */ + void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 600 */ + void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 601 */ + void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 602 */ + void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 603 */ + void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 604 */ + void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 605 */ + void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 606 */ + void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 607 */ + void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 608 */ + void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 609 */ + void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 610 */ + void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 611 */ + void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 612 */ + void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 613 */ + void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 614 */ + void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 615 */ + void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 616 */ + void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 617 */ + void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 618 */ + void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 619 */ + void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 620 */ + void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 621 */ + void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 622 */ + void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 623 */ + void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 624 */ + void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 625 */ + void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 626 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 627 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 628 */ + void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 629 */ + void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 630 */ + void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 631 */ + void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 632 */ + void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 633 */ + void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 634 */ + void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 635 */ + void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 636 */ + void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 637 */ + void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 638 */ + void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 639 */ + void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 640 */ + void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 641 */ + void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 642 */ + void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 643 */ + void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 644 */ + void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 645 */ + void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 646 */ + void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 647 */ + void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 648 */ + void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 649 */ + void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 650 */ + void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 651 */ + void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 652 */ + void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 653 */ + void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 654 */ + void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 655 */ + void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 656 */ + void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 657 */ + void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 658 */ + void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 659 */ + GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 660 */ + void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 661 */ + GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 662 */ + GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 663 */ + void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 664 */ + void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 665 */ + void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 666 */ + void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 667 */ + void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 668 */ + void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 669 */ + void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 670 */ + void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 671 */ + void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 672 */ + void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 673 */ + void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 674 */ + void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 675 */ + void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 676 */ + GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 677 */ + void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 678 */ + void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 679 */ + void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 680 */ + void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 681 */ + void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 682 */ + void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 683 */ + void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 684 */ + void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 685 */ + void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 686 */ + void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 687 */ + void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 688 */ + void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 689 */ + void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 690 */ + void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 691 */ + void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 692 */ + void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 693 */ + void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 694 */ + void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 695 */ + void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 696 */ + void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 697 */ + void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 698 */ + void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 699 */ + void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 700 */ + void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 701 */ + void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 702 */ + void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 703 */ + void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 704 */ + void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 705 */ + void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 706 */ + void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 707 */ + void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 708 */ + void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 709 */ + void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 710 */ + void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 711 */ + void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 712 */ + void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 713 */ + void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 714 */ + void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 715 */ + void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 716 */ + void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 717 */ + void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 718 */ + void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 719 */ + void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 720 */ + void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 721 */ + void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 722 */ + void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 723 */ + void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 724 */ + void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 725 */ + void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 726 */ + void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 727 */ + void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 728 */ + void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 729 */ + void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 730 */ + void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 731 */ + void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 732 */ + void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 733 */ + void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 734 */ + void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 735 */ + void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 736 */ + GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 737 */ + void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 738 */ + void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 739 */ + void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 740 */ + void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 741 */ + void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 742 */ + void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 743 */ + void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 744 */ + void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 745 */ + void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 746 */ + GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 747 */ + void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 748 */ + void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 749 */ + void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 750 */ + void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 751 */ + void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 752 */ + void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 753 */ + void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 754 */ + void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 755 */ + void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 756 */ + void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 757 */ + GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 758 */ + void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 759 */ + void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 760 */ + void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 761 */ + void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 762 */ + void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 763 */ + void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 764 */ + void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 765 */ + void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 766 */ + void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 767 */ + void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 768 */ + void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 769 */ + GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 770 */ + GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 771 */ + void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 772 */ + void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 773 */ + void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 774 */ + void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 775 */ + void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 776 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 777 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 778 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 779 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 780 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index c37aed7bcd8..86fda613f07 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -4011,6 +4011,26 @@ KEYWORD1 void KEYWORD2 NAME(RenderbufferStorageMultisample)(GLenum target, GLsiz DISPATCH(RenderbufferStorageMultisample, (target, samples, internalformat, width, height), (F, "glRenderbufferStorageMultisample(0x%x, %d, 0x%x, %d, %d);\n", target, samples, internalformat, width, height)); } +KEYWORD1 void KEYWORD2 NAME(FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length) +{ + DISPATCH(FlushMappedBufferRange, (target, offset, length), (F, "glFlushMappedBufferRange(0x%x, %d, %d);\n", target, offset, length)); +} + +KEYWORD1 GLvoid * KEYWORD2 NAME(MapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) +{ + RETURN_DISPATCH(MapBufferRange, (target, offset, length, access), (F, "glMapBufferRange(0x%x, %d, %d, %d);\n", target, offset, length, access)); +} + +KEYWORD1 void KEYWORD2 NAME(BindVertexArray)(GLuint array) +{ + DISPATCH(BindVertexArray, (array), (F, "glBindVertexArray(%d);\n", array)); +} + +KEYWORD1 void KEYWORD2 NAME(GenVertexArrays)(GLsizei n, GLuint * arrays) +{ + DISPATCH(GenVertexArrays, (n, arrays), (F, "glGenVertexArrays(%d, %p);\n", n, (const void *) arrays)); +} + KEYWORD1 void KEYWORD2 NAME(CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { DISPATCH(CopyBufferSubData, (readTarget, writeTarget, readOffset, writeOffset, size), (F, "glCopyBufferSubData(0x%x, 0x%x, %d, %d, %d);\n", readTarget, writeTarget, readOffset, writeOffset, size)); @@ -4021,58 +4041,58 @@ KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_564)(GLenum pname, GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_568)(GLenum pname, GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_564)(GLenum pname, GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_568)(GLenum pname, GLfloat * params) { DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_565)(GLenum pname, GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_569)(GLenum pname, GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_565)(GLenum pname, GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_569)(GLenum pname, GLint * params) { DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_566)(GLenum pname, GLfloat param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_570)(GLenum pname, GLfloat param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_566)(GLenum pname, GLfloat param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_570)(GLenum pname, GLfloat param) { DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_567)(GLenum pname, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_571)(GLenum pname, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_567)(GLenum pname, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_571)(GLenum pname, const GLfloat * params) { DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_568)(GLenum pname, GLint param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_572)(GLenum pname, GLint param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_568)(GLenum pname, GLint param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_572)(GLenum pname, GLint param) { DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_569)(GLenum pname, const GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_573)(GLenum pname, const GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_569)(GLenum pname, const GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_573)(GLenum pname, const GLint * params) { DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_570)(GLclampf value, GLboolean invert); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_574)(GLclampf value, GLboolean invert); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_570)(GLclampf value, GLboolean invert) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_574)(GLclampf value, GLboolean invert) { DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_571)(GLenum pattern); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_575)(GLenum pattern); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_571)(GLenum pattern) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_575)(GLenum pattern) { DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern)); } @@ -4122,9 +4142,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param) DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_578)(GLenum pname, GLfloat param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLfloat param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_578)(GLenum pname, GLfloat param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLfloat param) { DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param)); } @@ -4144,9 +4164,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * p DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_579)(GLenum pname, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_583)(GLenum pname, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_579)(GLenum pname, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_583)(GLenum pname, const GLfloat * params) { DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } @@ -4161,16 +4181,16 @@ KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) DISPATCH(UnlockArraysEXT, (), (F, "glUnlockArraysEXT();\n")); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLdouble * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_586)(GLenum pname, GLdouble * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLdouble * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_586)(GLenum pname, GLdouble * params) { DISPATCH(CullParameterdvEXT, (pname, params), (F, "glCullParameterdvEXT(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_583)(GLenum pname, GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_587)(GLenum pname, GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_583)(GLenum pname, GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_587)(GLenum pname, GLfloat * params) { DISPATCH(CullParameterfvEXT, (pname, params), (F, "glCullParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); } @@ -4415,9 +4435,9 @@ KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (const void *) coord)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum mode); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_612)(GLenum mode); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum mode) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_612)(GLenum mode) { DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode)); } @@ -4432,9 +4452,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfac DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_613)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_613)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } @@ -4799,65 +4819,65 @@ KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v) DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (const void *) v)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_650)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_650)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawArraysIBM, (mode, first, count, primcount, modestride), (F, "glMultiModeDrawArraysIBM(%p, %p, %p, %d, %d);\n", (const void *) mode, (const void *) first, (const void *) count, primcount, modestride)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_651)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_655)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_651)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_655)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawElementsIBM, (mode, count, type, indices, primcount, modestride), (F, "glMultiModeDrawElementsIBM(%p, %p, 0x%x, %p, %d, %d);\n", (const void *) mode, (const void *) count, type, (const void *) indices, primcount, modestride)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_652)(GLsizei n, const GLuint * fences); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_656)(GLsizei n, const GLuint * fences); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_652)(GLsizei n, const GLuint * fences) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_656)(GLsizei n, const GLuint * fences) { DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (const void *) fences)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_653)(GLuint fence); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_657)(GLuint fence); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_653)(GLuint fence) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_657)(GLuint fence) { DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(GLsizei n, GLuint * fences); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_658)(GLsizei n, GLuint * fences); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(GLsizei n, GLuint * fences) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_658)(GLsizei n, GLuint * fences) { DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (const void *) fences)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_655)(GLuint fence, GLenum pname, GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_659)(GLuint fence, GLenum pname, GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_655)(GLuint fence, GLenum pname, GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_659)(GLuint fence, GLenum pname, GLint * params) { DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (const void *) params)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_656)(GLuint fence); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_660)(GLuint fence); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_656)(GLuint fence) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_660)(GLuint fence) { RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_657)(GLuint fence, GLenum condition); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_661)(GLuint fence, GLenum condition); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_657)(GLuint fence, GLenum condition) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_661)(GLuint fence, GLenum condition) { DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_658)(GLuint fence); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_662)(GLuint fence); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_658)(GLuint fence) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_662)(GLuint fence) { RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence)); } @@ -5302,37 +5322,47 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * para DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_739)(GLenum face); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_743)(GLenum face); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_739)(GLenum face) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_743)(GLenum face) { DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_740)(GLuint array); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_744)(GLuint array); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_740)(GLuint array) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_744)(GLuint array) { DISPATCH(BindVertexArrayAPPLE, (array), (F, "glBindVertexArrayAPPLE(%d);\n", array)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_741)(GLsizei n, const GLuint * arrays); +KEYWORD1 void KEYWORD2 NAME(DeleteVertexArrays)(GLsizei n, const GLuint * arrays) +{ + DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArrays(%d, %p);\n", n, (const void *) arrays)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_745)(GLsizei n, const GLuint * arrays); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_741)(GLsizei n, const GLuint * arrays) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_745)(GLsizei n, const GLuint * arrays) { DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_742)(GLsizei n, GLuint * arrays); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_746)(GLsizei n, GLuint * arrays); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_742)(GLsizei n, GLuint * arrays) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_746)(GLsizei n, GLuint * arrays) { DISPATCH(GenVertexArraysAPPLE, (n, arrays), (F, "glGenVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_743)(GLuint array); +KEYWORD1 GLboolean KEYWORD2 NAME(IsVertexArray)(GLuint array) +{ + RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArray(%d);\n", array)); +} + +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_747)(GLuint array); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_743)(GLuint array) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_747)(GLuint array) { RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArrayAPPLE(%d);\n", array)); } @@ -5367,9 +5397,9 @@ KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, DISPATCH(ProgramNamedParameter4fvNV, (id, len, name, v), (F, "glProgramNamedParameter4fvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_750)(GLclampd zmin, GLclampd zmax); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_754)(GLclampd zmin, GLclampd zmax); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_750)(GLclampd zmin, GLclampd zmax) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_754)(GLclampd zmin, GLclampd zmax) { DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax)); } @@ -5379,9 +5409,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA) DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparate(0x%x, 0x%x);\n", modeRGB, modeA)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_751)(GLenum modeRGB, GLenum modeA); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_755)(GLenum modeRGB, GLenum modeA); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_751)(GLenum modeRGB, GLenum modeA) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_755)(GLenum modeRGB, GLenum modeA) { DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA)); } @@ -5561,9 +5591,9 @@ KEYWORD1 void KEYWORD2 NAME(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint src DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebufferEXT(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } @@ -5578,37 +5608,42 @@ KEYWORD1 void KEYWORD2 NAME(FramebufferTextureLayerEXT)(GLenum target, GLenum at DISPATCH(FramebufferTextureLayerEXT, (target, attachment, texture, level, layer), (F, "glFramebufferTextureLayerEXT(0x%x, 0x%x, %d, %d, %d);\n", target, attachment, texture, level, layer)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +KEYWORD1 void KEYWORD2 NAME(ProvokingVertexEXT)(GLenum mode) +{ + DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertexEXT(0x%x);\n", mode)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_776)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_776)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) { DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_777)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_777)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_778)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_778)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_779)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_779)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_775)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_780)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_775)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_780)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6189,16 +6224,20 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(GetAttribLocationARB), TABLE_ENTRY(DrawBuffersARB), TABLE_ENTRY(RenderbufferStorageMultisample), + TABLE_ENTRY(FlushMappedBufferRange), + TABLE_ENTRY(MapBufferRange), + TABLE_ENTRY(BindVertexArray), + TABLE_ENTRY(GenVertexArrays), TABLE_ENTRY(CopyBufferSubData), TABLE_ENTRY(PolygonOffsetEXT), - TABLE_ENTRY(_dispatch_stub_564), - TABLE_ENTRY(_dispatch_stub_565), - TABLE_ENTRY(_dispatch_stub_566), - TABLE_ENTRY(_dispatch_stub_567), TABLE_ENTRY(_dispatch_stub_568), TABLE_ENTRY(_dispatch_stub_569), TABLE_ENTRY(_dispatch_stub_570), TABLE_ENTRY(_dispatch_stub_571), + TABLE_ENTRY(_dispatch_stub_572), + TABLE_ENTRY(_dispatch_stub_573), + TABLE_ENTRY(_dispatch_stub_574), + TABLE_ENTRY(_dispatch_stub_575), TABLE_ENTRY(ColorPointerEXT), TABLE_ENTRY(EdgeFlagPointerEXT), TABLE_ENTRY(IndexPointerEXT), @@ -6209,8 +6248,8 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(PointParameterfvEXT), TABLE_ENTRY(LockArraysEXT), TABLE_ENTRY(UnlockArraysEXT), - TABLE_ENTRY(_dispatch_stub_582), - TABLE_ENTRY(_dispatch_stub_583), + TABLE_ENTRY(_dispatch_stub_586), + TABLE_ENTRY(_dispatch_stub_587), TABLE_ENTRY(SecondaryColor3bEXT), TABLE_ENTRY(SecondaryColor3bvEXT), TABLE_ENTRY(SecondaryColor3dEXT), @@ -6235,7 +6274,7 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(FogCoorddvEXT), TABLE_ENTRY(FogCoordfEXT), TABLE_ENTRY(FogCoordfvEXT), - TABLE_ENTRY(_dispatch_stub_608), + TABLE_ENTRY(_dispatch_stub_612), TABLE_ENTRY(BlendFuncSeparateEXT), TABLE_ENTRY(FlushVertexArrayRangeNV), TABLE_ENTRY(VertexArrayRangeNV), @@ -6277,15 +6316,15 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(WindowPos4ivMESA), TABLE_ENTRY(WindowPos4sMESA), TABLE_ENTRY(WindowPos4svMESA), - TABLE_ENTRY(_dispatch_stub_650), - TABLE_ENTRY(_dispatch_stub_651), - TABLE_ENTRY(_dispatch_stub_652), - TABLE_ENTRY(_dispatch_stub_653), TABLE_ENTRY(_dispatch_stub_654), TABLE_ENTRY(_dispatch_stub_655), TABLE_ENTRY(_dispatch_stub_656), TABLE_ENTRY(_dispatch_stub_657), TABLE_ENTRY(_dispatch_stub_658), + TABLE_ENTRY(_dispatch_stub_659), + TABLE_ENTRY(_dispatch_stub_660), + TABLE_ENTRY(_dispatch_stub_661), + TABLE_ENTRY(_dispatch_stub_662), TABLE_ENTRY(AreProgramsResidentNV), TABLE_ENTRY(BindProgramNV), TABLE_ENTRY(DeleteProgramsNV), @@ -6366,19 +6405,19 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(SetFragmentShaderConstantATI), TABLE_ENTRY(PointParameteriNV), TABLE_ENTRY(PointParameterivNV), - TABLE_ENTRY(_dispatch_stub_739), - TABLE_ENTRY(_dispatch_stub_740), - TABLE_ENTRY(_dispatch_stub_741), - TABLE_ENTRY(_dispatch_stub_742), TABLE_ENTRY(_dispatch_stub_743), + TABLE_ENTRY(_dispatch_stub_744), + TABLE_ENTRY(_dispatch_stub_745), + TABLE_ENTRY(_dispatch_stub_746), + TABLE_ENTRY(_dispatch_stub_747), TABLE_ENTRY(GetProgramNamedParameterdvNV), TABLE_ENTRY(GetProgramNamedParameterfvNV), TABLE_ENTRY(ProgramNamedParameter4dNV), TABLE_ENTRY(ProgramNamedParameter4dvNV), TABLE_ENTRY(ProgramNamedParameter4fNV), TABLE_ENTRY(ProgramNamedParameter4fvNV), - TABLE_ENTRY(_dispatch_stub_750), - TABLE_ENTRY(_dispatch_stub_751), + TABLE_ENTRY(_dispatch_stub_754), + TABLE_ENTRY(_dispatch_stub_755), TABLE_ENTRY(BindFramebufferEXT), TABLE_ENTRY(BindRenderbufferEXT), TABLE_ENTRY(CheckFramebufferStatusEXT), @@ -6396,13 +6435,14 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(IsFramebufferEXT), TABLE_ENTRY(IsRenderbufferEXT), TABLE_ENTRY(RenderbufferStorageEXT), - TABLE_ENTRY(_dispatch_stub_769), - TABLE_ENTRY(FramebufferTextureLayerEXT), - TABLE_ENTRY(_dispatch_stub_771), - TABLE_ENTRY(_dispatch_stub_772), TABLE_ENTRY(_dispatch_stub_773), - TABLE_ENTRY(_dispatch_stub_774), - TABLE_ENTRY(_dispatch_stub_775), + TABLE_ENTRY(FramebufferTextureLayerEXT), + TABLE_ENTRY(ProvokingVertexEXT), + TABLE_ENTRY(_dispatch_stub_776), + TABLE_ENTRY(_dispatch_stub_777), + TABLE_ENTRY(_dispatch_stub_778), + TABLE_ENTRY(_dispatch_stub_779), + TABLE_ENTRY(_dispatch_stub_780), /* A whole bunch of no-op functions. These might be called * when someone tries to call a dynamically-registered * extension function without a current rendering context. @@ -6769,6 +6809,8 @@ static _glapi_proc UNUSED_TABLE_NAME[] = { TABLE_ENTRY(IsProgramARB), TABLE_ENTRY(PointParameteri), TABLE_ENTRY(PointParameteriv), + TABLE_ENTRY(DeleteVertexArrays), + TABLE_ENTRY(IsVertexArray), TABLE_ENTRY(BlendEquationSeparate), TABLE_ENTRY(BindFramebuffer), TABLE_ENTRY(BindRenderbuffer), diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h index 648609a35d3..bd3ebc8872f 100644 --- a/src/mesa/glapi/glprocs.h +++ b/src/mesa/glapi/glprocs.h @@ -614,6 +614,10 @@ static const char gl_string_table[] = "glGetAttribLocationARB\0" "glDrawBuffersARB\0" "glRenderbufferStorageMultisample\0" + "glFlushMappedBufferRange\0" + "glMapBufferRange\0" + "glBindVertexArray\0" + "glGenVertexArrays\0" "glCopyBufferSubData\0" "glPolygonOffsetEXT\0" "glGetPixelTexGenParameterfvSGIS\0" @@ -823,6 +827,7 @@ static const char gl_string_table[] = "glRenderbufferStorageEXT\0" "glBlitFramebufferEXT\0" "glFramebufferTextureLayerEXT\0" + "glProvokingVertexEXT\0" "glStencilFuncSeparateATI\0" "glProgramEnvParameters4fvEXT\0" "glProgramLocalParameters4fvEXT\0" @@ -1105,6 +1110,8 @@ static const char gl_string_table[] = "glIsProgramARB\0" "glPointParameteri\0" "glPointParameteriv\0" + "glDeleteVertexArrays\0" + "glIsVertexArray\0" "glBlendEquationSeparate\0" "glBlendEquationSeparateATI\0" "glBindFramebuffer\0" @@ -1143,39 +1150,39 @@ static const char gl_string_table[] = #define gl_dispatch_stub_364 mgl_dispatch_stub_364 #define gl_dispatch_stub_365 mgl_dispatch_stub_365 #define gl_dispatch_stub_366 mgl_dispatch_stub_366 -#define gl_dispatch_stub_564 mgl_dispatch_stub_564 -#define gl_dispatch_stub_565 mgl_dispatch_stub_565 -#define gl_dispatch_stub_566 mgl_dispatch_stub_566 -#define gl_dispatch_stub_567 mgl_dispatch_stub_567 #define gl_dispatch_stub_568 mgl_dispatch_stub_568 #define gl_dispatch_stub_569 mgl_dispatch_stub_569 #define gl_dispatch_stub_570 mgl_dispatch_stub_570 #define gl_dispatch_stub_571 mgl_dispatch_stub_571 -#define gl_dispatch_stub_582 mgl_dispatch_stub_582 -#define gl_dispatch_stub_583 mgl_dispatch_stub_583 -#define gl_dispatch_stub_608 mgl_dispatch_stub_608 -#define gl_dispatch_stub_650 mgl_dispatch_stub_650 -#define gl_dispatch_stub_651 mgl_dispatch_stub_651 -#define gl_dispatch_stub_652 mgl_dispatch_stub_652 -#define gl_dispatch_stub_653 mgl_dispatch_stub_653 +#define gl_dispatch_stub_572 mgl_dispatch_stub_572 +#define gl_dispatch_stub_573 mgl_dispatch_stub_573 +#define gl_dispatch_stub_574 mgl_dispatch_stub_574 +#define gl_dispatch_stub_575 mgl_dispatch_stub_575 +#define gl_dispatch_stub_586 mgl_dispatch_stub_586 +#define gl_dispatch_stub_587 mgl_dispatch_stub_587 +#define gl_dispatch_stub_612 mgl_dispatch_stub_612 #define gl_dispatch_stub_654 mgl_dispatch_stub_654 #define gl_dispatch_stub_655 mgl_dispatch_stub_655 #define gl_dispatch_stub_656 mgl_dispatch_stub_656 #define gl_dispatch_stub_657 mgl_dispatch_stub_657 #define gl_dispatch_stub_658 mgl_dispatch_stub_658 -#define gl_dispatch_stub_739 mgl_dispatch_stub_739 -#define gl_dispatch_stub_740 mgl_dispatch_stub_740 -#define gl_dispatch_stub_741 mgl_dispatch_stub_741 -#define gl_dispatch_stub_742 mgl_dispatch_stub_742 +#define gl_dispatch_stub_659 mgl_dispatch_stub_659 +#define gl_dispatch_stub_660 mgl_dispatch_stub_660 +#define gl_dispatch_stub_661 mgl_dispatch_stub_661 +#define gl_dispatch_stub_662 mgl_dispatch_stub_662 #define gl_dispatch_stub_743 mgl_dispatch_stub_743 -#define gl_dispatch_stub_750 mgl_dispatch_stub_750 -#define gl_dispatch_stub_751 mgl_dispatch_stub_751 -#define gl_dispatch_stub_769 mgl_dispatch_stub_769 -#define gl_dispatch_stub_771 mgl_dispatch_stub_771 -#define gl_dispatch_stub_772 mgl_dispatch_stub_772 +#define gl_dispatch_stub_744 mgl_dispatch_stub_744 +#define gl_dispatch_stub_745 mgl_dispatch_stub_745 +#define gl_dispatch_stub_746 mgl_dispatch_stub_746 +#define gl_dispatch_stub_747 mgl_dispatch_stub_747 +#define gl_dispatch_stub_754 mgl_dispatch_stub_754 +#define gl_dispatch_stub_755 mgl_dispatch_stub_755 #define gl_dispatch_stub_773 mgl_dispatch_stub_773 -#define gl_dispatch_stub_774 mgl_dispatch_stub_774 -#define gl_dispatch_stub_775 mgl_dispatch_stub_775 +#define gl_dispatch_stub_776 mgl_dispatch_stub_776 +#define gl_dispatch_stub_777 mgl_dispatch_stub_777 +#define gl_dispatch_stub_778 mgl_dispatch_stub_778 +#define gl_dispatch_stub_779 mgl_dispatch_stub_779 +#define gl_dispatch_stub_780 mgl_dispatch_stub_780 #endif /* USE_MGL_NAMESPACE */ @@ -1193,39 +1200,39 @@ void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params); void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params); -void GLAPIENTRY gl_dispatch_stub_564(GLenum pname, GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_565(GLenum pname, GLint * params); -void GLAPIENTRY gl_dispatch_stub_566(GLenum pname, GLfloat param); -void GLAPIENTRY gl_dispatch_stub_567(GLenum pname, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_568(GLenum pname, GLint param); -void GLAPIENTRY gl_dispatch_stub_569(GLenum pname, const GLint * params); -void GLAPIENTRY gl_dispatch_stub_570(GLclampf value, GLboolean invert); -void GLAPIENTRY gl_dispatch_stub_571(GLenum pattern); -void GLAPIENTRY gl_dispatch_stub_582(GLenum pname, GLdouble * params); -void GLAPIENTRY gl_dispatch_stub_583(GLenum pname, GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_608(GLenum mode); -void GLAPIENTRY gl_dispatch_stub_650(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); -void GLAPIENTRY gl_dispatch_stub_651(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); -void GLAPIENTRY gl_dispatch_stub_652(GLsizei n, const GLuint * fences); -void GLAPIENTRY gl_dispatch_stub_653(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_654(GLsizei n, GLuint * fences); -void GLAPIENTRY gl_dispatch_stub_655(GLuint fence, GLenum pname, GLint * params); -GLboolean GLAPIENTRY gl_dispatch_stub_656(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_657(GLuint fence, GLenum condition); -GLboolean GLAPIENTRY gl_dispatch_stub_658(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_739(GLenum face); -void GLAPIENTRY gl_dispatch_stub_740(GLuint array); -void GLAPIENTRY gl_dispatch_stub_741(GLsizei n, const GLuint * arrays); -void GLAPIENTRY gl_dispatch_stub_742(GLsizei n, GLuint * arrays); -GLboolean GLAPIENTRY gl_dispatch_stub_743(GLuint array); -void GLAPIENTRY gl_dispatch_stub_750(GLclampd zmin, GLclampd zmax); -void GLAPIENTRY gl_dispatch_stub_751(GLenum modeRGB, GLenum modeA); -void GLAPIENTRY gl_dispatch_stub_769(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -void GLAPIENTRY gl_dispatch_stub_771(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -void GLAPIENTRY gl_dispatch_stub_772(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_773(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_774(GLuint id, GLenum pname, GLint64EXT * params); -void GLAPIENTRY gl_dispatch_stub_775(GLuint id, GLenum pname, GLuint64EXT * params); +void GLAPIENTRY gl_dispatch_stub_568(GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_569(GLenum pname, GLint * params); +void GLAPIENTRY gl_dispatch_stub_570(GLenum pname, GLfloat param); +void GLAPIENTRY gl_dispatch_stub_571(GLenum pname, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_572(GLenum pname, GLint param); +void GLAPIENTRY gl_dispatch_stub_573(GLenum pname, const GLint * params); +void GLAPIENTRY gl_dispatch_stub_574(GLclampf value, GLboolean invert); +void GLAPIENTRY gl_dispatch_stub_575(GLenum pattern); +void GLAPIENTRY gl_dispatch_stub_586(GLenum pname, GLdouble * params); +void GLAPIENTRY gl_dispatch_stub_587(GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_612(GLenum mode); +void GLAPIENTRY gl_dispatch_stub_654(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_655(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_656(GLsizei n, const GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_657(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_658(GLsizei n, GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_659(GLuint fence, GLenum pname, GLint * params); +GLboolean GLAPIENTRY gl_dispatch_stub_660(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_661(GLuint fence, GLenum condition); +GLboolean GLAPIENTRY gl_dispatch_stub_662(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_743(GLenum face); +void GLAPIENTRY gl_dispatch_stub_744(GLuint array); +void GLAPIENTRY gl_dispatch_stub_745(GLsizei n, const GLuint * arrays); +void GLAPIENTRY gl_dispatch_stub_746(GLsizei n, GLuint * arrays); +GLboolean GLAPIENTRY gl_dispatch_stub_747(GLuint array); +void GLAPIENTRY gl_dispatch_stub_754(GLclampd zmin, GLclampd zmax); +void GLAPIENTRY gl_dispatch_stub_755(GLenum modeRGB, GLenum modeA); +void GLAPIENTRY gl_dispatch_stub_773(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +void GLAPIENTRY gl_dispatch_stub_776(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +void GLAPIENTRY gl_dispatch_stub_777(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_778(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_779(GLuint id, GLenum pname, GLint64EXT * params); +void GLAPIENTRY gl_dispatch_stub_780(GLuint id, GLenum pname, GLuint64EXT * params); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1791,518 +1798,525 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET( 8911, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), NAME_FUNC_OFFSET( 8934, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), NAME_FUNC_OFFSET( 8951, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample), - NAME_FUNC_OFFSET( 8984, glCopyBufferSubData, glCopyBufferSubData, NULL, _gloffset_CopyBufferSubData), - NAME_FUNC_OFFSET( 9004, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, _gloffset_PolygonOffsetEXT), - NAME_FUNC_OFFSET( 9023, gl_dispatch_stub_564, gl_dispatch_stub_564, NULL, _gloffset_GetPixelTexGenParameterfvSGIS), - NAME_FUNC_OFFSET( 9055, gl_dispatch_stub_565, gl_dispatch_stub_565, NULL, _gloffset_GetPixelTexGenParameterivSGIS), - NAME_FUNC_OFFSET( 9087, gl_dispatch_stub_566, gl_dispatch_stub_566, NULL, _gloffset_PixelTexGenParameterfSGIS), - NAME_FUNC_OFFSET( 9115, gl_dispatch_stub_567, gl_dispatch_stub_567, NULL, _gloffset_PixelTexGenParameterfvSGIS), - NAME_FUNC_OFFSET( 9144, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_PixelTexGenParameteriSGIS), - NAME_FUNC_OFFSET( 9172, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_PixelTexGenParameterivSGIS), - NAME_FUNC_OFFSET( 9201, gl_dispatch_stub_570, gl_dispatch_stub_570, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET( 9218, gl_dispatch_stub_571, gl_dispatch_stub_571, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET( 9238, glColorPointerEXT, glColorPointerEXT, NULL, _gloffset_ColorPointerEXT), - NAME_FUNC_OFFSET( 9256, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, _gloffset_EdgeFlagPointerEXT), - NAME_FUNC_OFFSET( 9277, glIndexPointerEXT, glIndexPointerEXT, NULL, _gloffset_IndexPointerEXT), - NAME_FUNC_OFFSET( 9295, glNormalPointerEXT, glNormalPointerEXT, NULL, _gloffset_NormalPointerEXT), - NAME_FUNC_OFFSET( 9314, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, _gloffset_TexCoordPointerEXT), - NAME_FUNC_OFFSET( 9335, glVertexPointerEXT, glVertexPointerEXT, NULL, _gloffset_VertexPointerEXT), - NAME_FUNC_OFFSET( 9354, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET( 9375, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET( 9397, glLockArraysEXT, glLockArraysEXT, NULL, _gloffset_LockArraysEXT), - NAME_FUNC_OFFSET( 9413, glUnlockArraysEXT, glUnlockArraysEXT, NULL, _gloffset_UnlockArraysEXT), - NAME_FUNC_OFFSET( 9431, gl_dispatch_stub_582, gl_dispatch_stub_582, NULL, _gloffset_CullParameterdvEXT), - NAME_FUNC_OFFSET( 9452, gl_dispatch_stub_583, gl_dispatch_stub_583, NULL, _gloffset_CullParameterfvEXT), - NAME_FUNC_OFFSET( 9473, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET( 9495, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET( 9518, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET( 9540, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET( 9563, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET( 9585, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET( 9608, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET( 9630, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET( 9653, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET( 9675, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET( 9698, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET( 9721, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET( 9745, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET( 9768, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET( 9792, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET( 9815, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET( 9839, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET( 9866, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET( 9887, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET( 9910, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET( 9931, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET( 9946, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET( 9962, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET( 9977, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET( 9993, gl_dispatch_stub_608, gl_dispatch_stub_608, NULL, _gloffset_PixelTexGenSGIX), - NAME_FUNC_OFFSET(10011, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(10034, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, _gloffset_FlushVertexArrayRangeNV), - NAME_FUNC_OFFSET(10060, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, _gloffset_VertexArrayRangeNV), - NAME_FUNC_OFFSET(10081, glCombinerInputNV, glCombinerInputNV, NULL, _gloffset_CombinerInputNV), - NAME_FUNC_OFFSET(10099, glCombinerOutputNV, glCombinerOutputNV, NULL, _gloffset_CombinerOutputNV), - NAME_FUNC_OFFSET(10118, glCombinerParameterfNV, glCombinerParameterfNV, NULL, _gloffset_CombinerParameterfNV), - NAME_FUNC_OFFSET(10141, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, _gloffset_CombinerParameterfvNV), - NAME_FUNC_OFFSET(10165, glCombinerParameteriNV, glCombinerParameteriNV, NULL, _gloffset_CombinerParameteriNV), - NAME_FUNC_OFFSET(10188, glCombinerParameterivNV, glCombinerParameterivNV, NULL, _gloffset_CombinerParameterivNV), - NAME_FUNC_OFFSET(10212, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, _gloffset_FinalCombinerInputNV), - NAME_FUNC_OFFSET(10235, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, _gloffset_GetCombinerInputParameterfvNV), - NAME_FUNC_OFFSET(10267, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, _gloffset_GetCombinerInputParameterivNV), - NAME_FUNC_OFFSET(10299, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, _gloffset_GetCombinerOutputParameterfvNV), - NAME_FUNC_OFFSET(10332, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, _gloffset_GetCombinerOutputParameterivNV), - NAME_FUNC_OFFSET(10365, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, _gloffset_GetFinalCombinerInputParameterfvNV), - NAME_FUNC_OFFSET(10402, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, _gloffset_GetFinalCombinerInputParameterivNV), - NAME_FUNC_OFFSET(10439, glResizeBuffersMESA, glResizeBuffersMESA, NULL, _gloffset_ResizeBuffersMESA), - NAME_FUNC_OFFSET(10459, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(10477, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(10496, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(10514, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(10533, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(10551, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(10570, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(10588, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(10607, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(10625, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(10644, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(10662, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(10681, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(10699, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(10718, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(10736, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(10755, glWindowPos4dMESA, glWindowPos4dMESA, NULL, _gloffset_WindowPos4dMESA), - NAME_FUNC_OFFSET(10773, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, _gloffset_WindowPos4dvMESA), - NAME_FUNC_OFFSET(10792, glWindowPos4fMESA, glWindowPos4fMESA, NULL, _gloffset_WindowPos4fMESA), - NAME_FUNC_OFFSET(10810, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, _gloffset_WindowPos4fvMESA), - NAME_FUNC_OFFSET(10829, glWindowPos4iMESA, glWindowPos4iMESA, NULL, _gloffset_WindowPos4iMESA), - NAME_FUNC_OFFSET(10847, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, _gloffset_WindowPos4ivMESA), - NAME_FUNC_OFFSET(10866, glWindowPos4sMESA, glWindowPos4sMESA, NULL, _gloffset_WindowPos4sMESA), - NAME_FUNC_OFFSET(10884, glWindowPos4svMESA, glWindowPos4svMESA, NULL, _gloffset_WindowPos4svMESA), - NAME_FUNC_OFFSET(10903, gl_dispatch_stub_650, gl_dispatch_stub_650, NULL, _gloffset_MultiModeDrawArraysIBM), - NAME_FUNC_OFFSET(10928, gl_dispatch_stub_651, gl_dispatch_stub_651, NULL, _gloffset_MultiModeDrawElementsIBM), - NAME_FUNC_OFFSET(10955, gl_dispatch_stub_652, gl_dispatch_stub_652, NULL, _gloffset_DeleteFencesNV), - NAME_FUNC_OFFSET(10972, gl_dispatch_stub_653, gl_dispatch_stub_653, NULL, _gloffset_FinishFenceNV), - NAME_FUNC_OFFSET(10988, gl_dispatch_stub_654, gl_dispatch_stub_654, NULL, _gloffset_GenFencesNV), - NAME_FUNC_OFFSET(11002, gl_dispatch_stub_655, gl_dispatch_stub_655, NULL, _gloffset_GetFenceivNV), - NAME_FUNC_OFFSET(11017, gl_dispatch_stub_656, gl_dispatch_stub_656, NULL, _gloffset_IsFenceNV), - NAME_FUNC_OFFSET(11029, gl_dispatch_stub_657, gl_dispatch_stub_657, NULL, _gloffset_SetFenceNV), - NAME_FUNC_OFFSET(11042, gl_dispatch_stub_658, gl_dispatch_stub_658, NULL, _gloffset_TestFenceNV), - NAME_FUNC_OFFSET(11056, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, _gloffset_AreProgramsResidentNV), - NAME_FUNC_OFFSET(11080, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(11096, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(11115, glExecuteProgramNV, glExecuteProgramNV, NULL, _gloffset_ExecuteProgramNV), - NAME_FUNC_OFFSET(11134, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(11150, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, _gloffset_GetProgramParameterdvNV), - NAME_FUNC_OFFSET(11176, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, _gloffset_GetProgramParameterfvNV), - NAME_FUNC_OFFSET(11202, glGetProgramStringNV, glGetProgramStringNV, NULL, _gloffset_GetProgramStringNV), - NAME_FUNC_OFFSET(11223, glGetProgramivNV, glGetProgramivNV, NULL, _gloffset_GetProgramivNV), - NAME_FUNC_OFFSET(11240, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, _gloffset_GetTrackMatrixivNV), - NAME_FUNC_OFFSET(11261, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(11289, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, _gloffset_GetVertexAttribdvNV), - NAME_FUNC_OFFSET(11311, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, _gloffset_GetVertexAttribfvNV), - NAME_FUNC_OFFSET(11333, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, _gloffset_GetVertexAttribivNV), - NAME_FUNC_OFFSET(11355, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(11369, glLoadProgramNV, glLoadProgramNV, NULL, _gloffset_LoadProgramNV), - NAME_FUNC_OFFSET(11385, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, _gloffset_ProgramParameters4dvNV), - NAME_FUNC_OFFSET(11410, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, _gloffset_ProgramParameters4fvNV), - NAME_FUNC_OFFSET(11435, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, _gloffset_RequestResidentProgramsNV), - NAME_FUNC_OFFSET(11463, glTrackMatrixNV, glTrackMatrixNV, NULL, _gloffset_TrackMatrixNV), - NAME_FUNC_OFFSET(11479, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, _gloffset_VertexAttrib1dNV), - NAME_FUNC_OFFSET(11498, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, _gloffset_VertexAttrib1dvNV), - NAME_FUNC_OFFSET(11518, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, _gloffset_VertexAttrib1fNV), - NAME_FUNC_OFFSET(11537, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, _gloffset_VertexAttrib1fvNV), - NAME_FUNC_OFFSET(11557, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, _gloffset_VertexAttrib1sNV), - NAME_FUNC_OFFSET(11576, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, _gloffset_VertexAttrib1svNV), - NAME_FUNC_OFFSET(11596, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, _gloffset_VertexAttrib2dNV), - NAME_FUNC_OFFSET(11615, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, _gloffset_VertexAttrib2dvNV), - NAME_FUNC_OFFSET(11635, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, _gloffset_VertexAttrib2fNV), - NAME_FUNC_OFFSET(11654, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, _gloffset_VertexAttrib2fvNV), - NAME_FUNC_OFFSET(11674, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, _gloffset_VertexAttrib2sNV), - NAME_FUNC_OFFSET(11693, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, _gloffset_VertexAttrib2svNV), - NAME_FUNC_OFFSET(11713, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, _gloffset_VertexAttrib3dNV), - NAME_FUNC_OFFSET(11732, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, _gloffset_VertexAttrib3dvNV), - NAME_FUNC_OFFSET(11752, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, _gloffset_VertexAttrib3fNV), - NAME_FUNC_OFFSET(11771, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, _gloffset_VertexAttrib3fvNV), - NAME_FUNC_OFFSET(11791, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, _gloffset_VertexAttrib3sNV), - NAME_FUNC_OFFSET(11810, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, _gloffset_VertexAttrib3svNV), - NAME_FUNC_OFFSET(11830, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, _gloffset_VertexAttrib4dNV), - NAME_FUNC_OFFSET(11849, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, _gloffset_VertexAttrib4dvNV), - NAME_FUNC_OFFSET(11869, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, _gloffset_VertexAttrib4fNV), - NAME_FUNC_OFFSET(11888, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, _gloffset_VertexAttrib4fvNV), - NAME_FUNC_OFFSET(11908, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, _gloffset_VertexAttrib4sNV), - NAME_FUNC_OFFSET(11927, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, _gloffset_VertexAttrib4svNV), - NAME_FUNC_OFFSET(11947, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, _gloffset_VertexAttrib4ubNV), - NAME_FUNC_OFFSET(11967, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, _gloffset_VertexAttrib4ubvNV), - NAME_FUNC_OFFSET(11988, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, _gloffset_VertexAttribPointerNV), - NAME_FUNC_OFFSET(12012, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, _gloffset_VertexAttribs1dvNV), - NAME_FUNC_OFFSET(12033, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, _gloffset_VertexAttribs1fvNV), - NAME_FUNC_OFFSET(12054, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, _gloffset_VertexAttribs1svNV), - NAME_FUNC_OFFSET(12075, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, _gloffset_VertexAttribs2dvNV), - NAME_FUNC_OFFSET(12096, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, _gloffset_VertexAttribs2fvNV), - NAME_FUNC_OFFSET(12117, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, _gloffset_VertexAttribs2svNV), - NAME_FUNC_OFFSET(12138, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, _gloffset_VertexAttribs3dvNV), - NAME_FUNC_OFFSET(12159, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, _gloffset_VertexAttribs3fvNV), - NAME_FUNC_OFFSET(12180, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, _gloffset_VertexAttribs3svNV), - NAME_FUNC_OFFSET(12201, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, _gloffset_VertexAttribs4dvNV), - NAME_FUNC_OFFSET(12222, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, _gloffset_VertexAttribs4fvNV), - NAME_FUNC_OFFSET(12243, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, _gloffset_VertexAttribs4svNV), - NAME_FUNC_OFFSET(12264, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, _gloffset_VertexAttribs4ubvNV), - NAME_FUNC_OFFSET(12286, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, _gloffset_GetTexBumpParameterfvATI), - NAME_FUNC_OFFSET(12313, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, _gloffset_GetTexBumpParameterivATI), - NAME_FUNC_OFFSET(12340, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, _gloffset_TexBumpParameterfvATI), - NAME_FUNC_OFFSET(12364, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, _gloffset_TexBumpParameterivATI), - NAME_FUNC_OFFSET(12388, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI), - NAME_FUNC_OFFSET(12410, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI), - NAME_FUNC_OFFSET(12432, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI), - NAME_FUNC_OFFSET(12454, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI), - NAME_FUNC_OFFSET(12479, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI), - NAME_FUNC_OFFSET(12503, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI), - NAME_FUNC_OFFSET(12525, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI), - NAME_FUNC_OFFSET(12547, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI), - NAME_FUNC_OFFSET(12569, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI), - NAME_FUNC_OFFSET(12595, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI), - NAME_FUNC_OFFSET(12618, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI), - NAME_FUNC_OFFSET(12642, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI), - NAME_FUNC_OFFSET(12660, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI), - NAME_FUNC_OFFSET(12675, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI), - NAME_FUNC_OFFSET(12706, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(12726, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(12747, gl_dispatch_stub_739, gl_dispatch_stub_739, NULL, _gloffset_ActiveStencilFaceEXT), - NAME_FUNC_OFFSET(12770, gl_dispatch_stub_740, gl_dispatch_stub_740, NULL, _gloffset_BindVertexArrayAPPLE), - NAME_FUNC_OFFSET(12793, gl_dispatch_stub_741, gl_dispatch_stub_741, NULL, _gloffset_DeleteVertexArraysAPPLE), - NAME_FUNC_OFFSET(12819, gl_dispatch_stub_742, gl_dispatch_stub_742, NULL, _gloffset_GenVertexArraysAPPLE), - NAME_FUNC_OFFSET(12842, gl_dispatch_stub_743, gl_dispatch_stub_743, NULL, _gloffset_IsVertexArrayAPPLE), - NAME_FUNC_OFFSET(12863, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV), - NAME_FUNC_OFFSET(12894, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV), - NAME_FUNC_OFFSET(12925, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV), - NAME_FUNC_OFFSET(12953, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV), - NAME_FUNC_OFFSET(12982, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV), - NAME_FUNC_OFFSET(13010, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV), - NAME_FUNC_OFFSET(13039, gl_dispatch_stub_750, gl_dispatch_stub_750, NULL, _gloffset_DepthBoundsEXT), - NAME_FUNC_OFFSET(13056, gl_dispatch_stub_751, gl_dispatch_stub_751, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(13083, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), - NAME_FUNC_OFFSET(13104, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), - NAME_FUNC_OFFSET(13126, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), - NAME_FUNC_OFFSET(13154, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), - NAME_FUNC_OFFSET(13178, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), - NAME_FUNC_OFFSET(13203, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), - NAME_FUNC_OFFSET(13232, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), - NAME_FUNC_OFFSET(13258, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), - NAME_FUNC_OFFSET(13284, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), - NAME_FUNC_OFFSET(13310, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), - NAME_FUNC_OFFSET(13331, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), - NAME_FUNC_OFFSET(13353, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), - NAME_FUNC_OFFSET(13373, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), - NAME_FUNC_OFFSET(13414, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), - NAME_FUNC_OFFSET(13446, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), - NAME_FUNC_OFFSET(13465, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), - NAME_FUNC_OFFSET(13485, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), - NAME_FUNC_OFFSET(13510, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(13531, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), - NAME_FUNC_OFFSET(13560, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_StencilFuncSeparateATI), - NAME_FUNC_OFFSET(13585, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(13614, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(13645, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(13669, gl_dispatch_stub_775, gl_dispatch_stub_775, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(13694, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(13712, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(13729, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(13745, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(13770, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(13790, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(13810, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(13833, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(13856, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(13876, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(13893, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(13910, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(13925, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(13949, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(13968, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(13987, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(14003, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(14022, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(14045, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14061, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14077, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(14104, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(14131, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(14151, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14170, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14189, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14219, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14249, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14279, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14309, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(14328, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(14351, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(14376, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(14401, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(14428, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(14456, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(14483, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(14511, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(14540, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(14569, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(14595, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(14626, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(14657, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(14681, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(14704, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(14722, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(14751, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(14780, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(14795, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(14821, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(14847, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(14862, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(14874, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(14894, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(14911, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(14927, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(14946, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(14969, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(14985, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(15007, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(15025, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(15044, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(15062, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(15081, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(15099, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(15118, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(15136, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(15155, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(15173, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(15192, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(15210, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(15229, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(15247, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(15266, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(15284, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(15303, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(15321, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(15340, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(15358, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(15377, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(15395, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(15414, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(15432, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(15451, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(15469, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(15488, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(15506, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(15525, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(15543, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(15562, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(15580, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), - NAME_FUNC_OFFSET(15599, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), - NAME_FUNC_OFFSET(15622, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), - NAME_FUNC_OFFSET(15645, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), - NAME_FUNC_OFFSET(15668, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), - NAME_FUNC_OFFSET(15691, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), - NAME_FUNC_OFFSET(15714, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), - NAME_FUNC_OFFSET(15731, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), - NAME_FUNC_OFFSET(15754, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), - NAME_FUNC_OFFSET(15777, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), - NAME_FUNC_OFFSET(15800, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), - NAME_FUNC_OFFSET(15826, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), - NAME_FUNC_OFFSET(15852, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), - NAME_FUNC_OFFSET(15878, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), - NAME_FUNC_OFFSET(15902, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15929, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15955, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), - NAME_FUNC_OFFSET(15975, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), - NAME_FUNC_OFFSET(15995, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), - NAME_FUNC_OFFSET(16015, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), - NAME_FUNC_OFFSET(16038, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), - NAME_FUNC_OFFSET(16062, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), - NAME_FUNC_OFFSET(16085, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), - NAME_FUNC_OFFSET(16109, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), - NAME_FUNC_OFFSET(16126, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), - NAME_FUNC_OFFSET(16144, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), - NAME_FUNC_OFFSET(16161, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), - NAME_FUNC_OFFSET(16179, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), - NAME_FUNC_OFFSET(16196, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), - NAME_FUNC_OFFSET(16214, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), - NAME_FUNC_OFFSET(16231, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), - NAME_FUNC_OFFSET(16249, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), - NAME_FUNC_OFFSET(16266, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), - NAME_FUNC_OFFSET(16284, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), - NAME_FUNC_OFFSET(16301, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), - NAME_FUNC_OFFSET(16319, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), - NAME_FUNC_OFFSET(16336, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), - NAME_FUNC_OFFSET(16354, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), - NAME_FUNC_OFFSET(16371, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), - NAME_FUNC_OFFSET(16389, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), - NAME_FUNC_OFFSET(16406, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), - NAME_FUNC_OFFSET(16424, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), - NAME_FUNC_OFFSET(16443, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), - NAME_FUNC_OFFSET(16462, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), - NAME_FUNC_OFFSET(16481, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), - NAME_FUNC_OFFSET(16500, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), - NAME_FUNC_OFFSET(16520, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), - NAME_FUNC_OFFSET(16540, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(16560, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), - NAME_FUNC_OFFSET(16578, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(16595, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(16613, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(16630, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(16648, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), - NAME_FUNC_OFFSET(16666, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(16683, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(16701, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), - NAME_FUNC_OFFSET(16720, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), - NAME_FUNC_OFFSET(16739, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), - NAME_FUNC_OFFSET(16758, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(16780, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(16793, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(16806, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(16822, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(16838, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(16851, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(16874, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(16894, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(16913, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(16924, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(16936, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(16950, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(16963, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(16979, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(16990, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(17003, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(17022, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(17042, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(17055, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(17065, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(17081, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(17100, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(17118, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(17139, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(17154, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(17169, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(17183, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(17198, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(17210, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(17223, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(17235, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(17248, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(17260, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(17273, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(17285, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(17298, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(17310, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(17323, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(17335, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(17348, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(17360, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(17373, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(17385, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(17398, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(17417, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(17436, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(17455, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(17468, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(17486, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(17507, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(17525, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(17545, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17559, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17576, gl_dispatch_stub_570, gl_dispatch_stub_570, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(17592, gl_dispatch_stub_571, gl_dispatch_stub_571, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(17611, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17629, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17650, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17672, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17691, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17713, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17736, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(17755, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(17775, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(17794, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(17814, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(17833, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(17853, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(17872, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(17892, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(17911, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(17931, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(17951, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(17972, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(17992, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(18013, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(18033, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(18054, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(18078, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(18096, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(18116, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(18134, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(18146, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(18159, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(18171, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(18184, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18204, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18228, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18242, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18259, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18274, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18292, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18306, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18323, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18338, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18356, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18370, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18387, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18402, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18420, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18434, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18451, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18466, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18484, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18498, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18515, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18530, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18548, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18562, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18579, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18594, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18612, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18626, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18643, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18658, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18676, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18690, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18707, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18722, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18740, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(18757, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(18777, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(18794, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18820, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18849, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(18864, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(18882, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(18901, gl_dispatch_stub_751, gl_dispatch_stub_751, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18925, gl_dispatch_stub_751, gl_dispatch_stub_751, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18952, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), - NAME_FUNC_OFFSET(18970, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), - NAME_FUNC_OFFSET(18989, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), - NAME_FUNC_OFFSET(19014, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), - NAME_FUNC_OFFSET(19035, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), - NAME_FUNC_OFFSET(19057, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), - NAME_FUNC_OFFSET(19083, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), - NAME_FUNC_OFFSET(19106, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), - NAME_FUNC_OFFSET(19129, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), - NAME_FUNC_OFFSET(19152, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), - NAME_FUNC_OFFSET(19170, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), - NAME_FUNC_OFFSET(19189, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), - NAME_FUNC_OFFSET(19206, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), - NAME_FUNC_OFFSET(19244, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), - NAME_FUNC_OFFSET(19273, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), - NAME_FUNC_OFFSET(19289, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), - NAME_FUNC_OFFSET(19306, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), - NAME_FUNC_OFFSET(19328, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(19346, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET( 8984, glFlushMappedBufferRange, glFlushMappedBufferRange, NULL, _gloffset_FlushMappedBufferRange), + NAME_FUNC_OFFSET( 9009, glMapBufferRange, glMapBufferRange, NULL, _gloffset_MapBufferRange), + NAME_FUNC_OFFSET( 9026, glBindVertexArray, glBindVertexArray, NULL, _gloffset_BindVertexArray), + NAME_FUNC_OFFSET( 9044, glGenVertexArrays, glGenVertexArrays, NULL, _gloffset_GenVertexArrays), + NAME_FUNC_OFFSET( 9062, glCopyBufferSubData, glCopyBufferSubData, NULL, _gloffset_CopyBufferSubData), + NAME_FUNC_OFFSET( 9082, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, _gloffset_PolygonOffsetEXT), + NAME_FUNC_OFFSET( 9101, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_GetPixelTexGenParameterfvSGIS), + NAME_FUNC_OFFSET( 9133, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_GetPixelTexGenParameterivSGIS), + NAME_FUNC_OFFSET( 9165, gl_dispatch_stub_570, gl_dispatch_stub_570, NULL, _gloffset_PixelTexGenParameterfSGIS), + NAME_FUNC_OFFSET( 9193, gl_dispatch_stub_571, gl_dispatch_stub_571, NULL, _gloffset_PixelTexGenParameterfvSGIS), + NAME_FUNC_OFFSET( 9222, gl_dispatch_stub_572, gl_dispatch_stub_572, NULL, _gloffset_PixelTexGenParameteriSGIS), + NAME_FUNC_OFFSET( 9250, gl_dispatch_stub_573, gl_dispatch_stub_573, NULL, _gloffset_PixelTexGenParameterivSGIS), + NAME_FUNC_OFFSET( 9279, gl_dispatch_stub_574, gl_dispatch_stub_574, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET( 9296, gl_dispatch_stub_575, gl_dispatch_stub_575, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET( 9316, glColorPointerEXT, glColorPointerEXT, NULL, _gloffset_ColorPointerEXT), + NAME_FUNC_OFFSET( 9334, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, _gloffset_EdgeFlagPointerEXT), + NAME_FUNC_OFFSET( 9355, glIndexPointerEXT, glIndexPointerEXT, NULL, _gloffset_IndexPointerEXT), + NAME_FUNC_OFFSET( 9373, glNormalPointerEXT, glNormalPointerEXT, NULL, _gloffset_NormalPointerEXT), + NAME_FUNC_OFFSET( 9392, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, _gloffset_TexCoordPointerEXT), + NAME_FUNC_OFFSET( 9413, glVertexPointerEXT, glVertexPointerEXT, NULL, _gloffset_VertexPointerEXT), + NAME_FUNC_OFFSET( 9432, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET( 9453, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET( 9475, glLockArraysEXT, glLockArraysEXT, NULL, _gloffset_LockArraysEXT), + NAME_FUNC_OFFSET( 9491, glUnlockArraysEXT, glUnlockArraysEXT, NULL, _gloffset_UnlockArraysEXT), + NAME_FUNC_OFFSET( 9509, gl_dispatch_stub_586, gl_dispatch_stub_586, NULL, _gloffset_CullParameterdvEXT), + NAME_FUNC_OFFSET( 9530, gl_dispatch_stub_587, gl_dispatch_stub_587, NULL, _gloffset_CullParameterfvEXT), + NAME_FUNC_OFFSET( 9551, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET( 9573, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET( 9596, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET( 9618, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET( 9641, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET( 9663, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET( 9686, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET( 9708, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET( 9731, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET( 9753, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET( 9776, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET( 9799, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET( 9823, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET( 9846, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET( 9870, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET( 9893, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET( 9917, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET( 9944, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET( 9965, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET( 9988, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(10009, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(10024, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(10040, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(10055, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(10071, gl_dispatch_stub_612, gl_dispatch_stub_612, NULL, _gloffset_PixelTexGenSGIX), + NAME_FUNC_OFFSET(10089, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(10112, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, _gloffset_FlushVertexArrayRangeNV), + NAME_FUNC_OFFSET(10138, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, _gloffset_VertexArrayRangeNV), + NAME_FUNC_OFFSET(10159, glCombinerInputNV, glCombinerInputNV, NULL, _gloffset_CombinerInputNV), + NAME_FUNC_OFFSET(10177, glCombinerOutputNV, glCombinerOutputNV, NULL, _gloffset_CombinerOutputNV), + NAME_FUNC_OFFSET(10196, glCombinerParameterfNV, glCombinerParameterfNV, NULL, _gloffset_CombinerParameterfNV), + NAME_FUNC_OFFSET(10219, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, _gloffset_CombinerParameterfvNV), + NAME_FUNC_OFFSET(10243, glCombinerParameteriNV, glCombinerParameteriNV, NULL, _gloffset_CombinerParameteriNV), + NAME_FUNC_OFFSET(10266, glCombinerParameterivNV, glCombinerParameterivNV, NULL, _gloffset_CombinerParameterivNV), + NAME_FUNC_OFFSET(10290, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, _gloffset_FinalCombinerInputNV), + NAME_FUNC_OFFSET(10313, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, _gloffset_GetCombinerInputParameterfvNV), + NAME_FUNC_OFFSET(10345, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, _gloffset_GetCombinerInputParameterivNV), + NAME_FUNC_OFFSET(10377, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, _gloffset_GetCombinerOutputParameterfvNV), + NAME_FUNC_OFFSET(10410, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, _gloffset_GetCombinerOutputParameterivNV), + NAME_FUNC_OFFSET(10443, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, _gloffset_GetFinalCombinerInputParameterfvNV), + NAME_FUNC_OFFSET(10480, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, _gloffset_GetFinalCombinerInputParameterivNV), + NAME_FUNC_OFFSET(10517, glResizeBuffersMESA, glResizeBuffersMESA, NULL, _gloffset_ResizeBuffersMESA), + NAME_FUNC_OFFSET(10537, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(10555, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(10574, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(10592, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(10611, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(10629, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(10648, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(10666, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(10685, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(10703, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(10722, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(10740, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(10759, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(10777, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(10796, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(10814, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(10833, glWindowPos4dMESA, glWindowPos4dMESA, NULL, _gloffset_WindowPos4dMESA), + NAME_FUNC_OFFSET(10851, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, _gloffset_WindowPos4dvMESA), + NAME_FUNC_OFFSET(10870, glWindowPos4fMESA, glWindowPos4fMESA, NULL, _gloffset_WindowPos4fMESA), + NAME_FUNC_OFFSET(10888, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, _gloffset_WindowPos4fvMESA), + NAME_FUNC_OFFSET(10907, glWindowPos4iMESA, glWindowPos4iMESA, NULL, _gloffset_WindowPos4iMESA), + NAME_FUNC_OFFSET(10925, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, _gloffset_WindowPos4ivMESA), + NAME_FUNC_OFFSET(10944, glWindowPos4sMESA, glWindowPos4sMESA, NULL, _gloffset_WindowPos4sMESA), + NAME_FUNC_OFFSET(10962, glWindowPos4svMESA, glWindowPos4svMESA, NULL, _gloffset_WindowPos4svMESA), + NAME_FUNC_OFFSET(10981, gl_dispatch_stub_654, gl_dispatch_stub_654, NULL, _gloffset_MultiModeDrawArraysIBM), + NAME_FUNC_OFFSET(11006, gl_dispatch_stub_655, gl_dispatch_stub_655, NULL, _gloffset_MultiModeDrawElementsIBM), + NAME_FUNC_OFFSET(11033, gl_dispatch_stub_656, gl_dispatch_stub_656, NULL, _gloffset_DeleteFencesNV), + NAME_FUNC_OFFSET(11050, gl_dispatch_stub_657, gl_dispatch_stub_657, NULL, _gloffset_FinishFenceNV), + NAME_FUNC_OFFSET(11066, gl_dispatch_stub_658, gl_dispatch_stub_658, NULL, _gloffset_GenFencesNV), + NAME_FUNC_OFFSET(11080, gl_dispatch_stub_659, gl_dispatch_stub_659, NULL, _gloffset_GetFenceivNV), + NAME_FUNC_OFFSET(11095, gl_dispatch_stub_660, gl_dispatch_stub_660, NULL, _gloffset_IsFenceNV), + NAME_FUNC_OFFSET(11107, gl_dispatch_stub_661, gl_dispatch_stub_661, NULL, _gloffset_SetFenceNV), + NAME_FUNC_OFFSET(11120, gl_dispatch_stub_662, gl_dispatch_stub_662, NULL, _gloffset_TestFenceNV), + NAME_FUNC_OFFSET(11134, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, _gloffset_AreProgramsResidentNV), + NAME_FUNC_OFFSET(11158, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(11174, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(11193, glExecuteProgramNV, glExecuteProgramNV, NULL, _gloffset_ExecuteProgramNV), + NAME_FUNC_OFFSET(11212, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(11228, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, _gloffset_GetProgramParameterdvNV), + NAME_FUNC_OFFSET(11254, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, _gloffset_GetProgramParameterfvNV), + NAME_FUNC_OFFSET(11280, glGetProgramStringNV, glGetProgramStringNV, NULL, _gloffset_GetProgramStringNV), + NAME_FUNC_OFFSET(11301, glGetProgramivNV, glGetProgramivNV, NULL, _gloffset_GetProgramivNV), + NAME_FUNC_OFFSET(11318, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, _gloffset_GetTrackMatrixivNV), + NAME_FUNC_OFFSET(11339, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(11367, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, _gloffset_GetVertexAttribdvNV), + NAME_FUNC_OFFSET(11389, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, _gloffset_GetVertexAttribfvNV), + NAME_FUNC_OFFSET(11411, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, _gloffset_GetVertexAttribivNV), + NAME_FUNC_OFFSET(11433, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(11447, glLoadProgramNV, glLoadProgramNV, NULL, _gloffset_LoadProgramNV), + NAME_FUNC_OFFSET(11463, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, _gloffset_ProgramParameters4dvNV), + NAME_FUNC_OFFSET(11488, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, _gloffset_ProgramParameters4fvNV), + NAME_FUNC_OFFSET(11513, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, _gloffset_RequestResidentProgramsNV), + NAME_FUNC_OFFSET(11541, glTrackMatrixNV, glTrackMatrixNV, NULL, _gloffset_TrackMatrixNV), + NAME_FUNC_OFFSET(11557, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, _gloffset_VertexAttrib1dNV), + NAME_FUNC_OFFSET(11576, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, _gloffset_VertexAttrib1dvNV), + NAME_FUNC_OFFSET(11596, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, _gloffset_VertexAttrib1fNV), + NAME_FUNC_OFFSET(11615, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, _gloffset_VertexAttrib1fvNV), + NAME_FUNC_OFFSET(11635, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, _gloffset_VertexAttrib1sNV), + NAME_FUNC_OFFSET(11654, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, _gloffset_VertexAttrib1svNV), + NAME_FUNC_OFFSET(11674, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, _gloffset_VertexAttrib2dNV), + NAME_FUNC_OFFSET(11693, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, _gloffset_VertexAttrib2dvNV), + NAME_FUNC_OFFSET(11713, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, _gloffset_VertexAttrib2fNV), + NAME_FUNC_OFFSET(11732, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, _gloffset_VertexAttrib2fvNV), + NAME_FUNC_OFFSET(11752, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, _gloffset_VertexAttrib2sNV), + NAME_FUNC_OFFSET(11771, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, _gloffset_VertexAttrib2svNV), + NAME_FUNC_OFFSET(11791, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, _gloffset_VertexAttrib3dNV), + NAME_FUNC_OFFSET(11810, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, _gloffset_VertexAttrib3dvNV), + NAME_FUNC_OFFSET(11830, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, _gloffset_VertexAttrib3fNV), + NAME_FUNC_OFFSET(11849, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, _gloffset_VertexAttrib3fvNV), + NAME_FUNC_OFFSET(11869, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, _gloffset_VertexAttrib3sNV), + NAME_FUNC_OFFSET(11888, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, _gloffset_VertexAttrib3svNV), + NAME_FUNC_OFFSET(11908, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, _gloffset_VertexAttrib4dNV), + NAME_FUNC_OFFSET(11927, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, _gloffset_VertexAttrib4dvNV), + NAME_FUNC_OFFSET(11947, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, _gloffset_VertexAttrib4fNV), + NAME_FUNC_OFFSET(11966, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, _gloffset_VertexAttrib4fvNV), + NAME_FUNC_OFFSET(11986, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, _gloffset_VertexAttrib4sNV), + NAME_FUNC_OFFSET(12005, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, _gloffset_VertexAttrib4svNV), + NAME_FUNC_OFFSET(12025, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, _gloffset_VertexAttrib4ubNV), + NAME_FUNC_OFFSET(12045, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, _gloffset_VertexAttrib4ubvNV), + NAME_FUNC_OFFSET(12066, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, _gloffset_VertexAttribPointerNV), + NAME_FUNC_OFFSET(12090, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, _gloffset_VertexAttribs1dvNV), + NAME_FUNC_OFFSET(12111, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, _gloffset_VertexAttribs1fvNV), + NAME_FUNC_OFFSET(12132, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, _gloffset_VertexAttribs1svNV), + NAME_FUNC_OFFSET(12153, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, _gloffset_VertexAttribs2dvNV), + NAME_FUNC_OFFSET(12174, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, _gloffset_VertexAttribs2fvNV), + NAME_FUNC_OFFSET(12195, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, _gloffset_VertexAttribs2svNV), + NAME_FUNC_OFFSET(12216, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, _gloffset_VertexAttribs3dvNV), + NAME_FUNC_OFFSET(12237, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, _gloffset_VertexAttribs3fvNV), + NAME_FUNC_OFFSET(12258, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, _gloffset_VertexAttribs3svNV), + NAME_FUNC_OFFSET(12279, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, _gloffset_VertexAttribs4dvNV), + NAME_FUNC_OFFSET(12300, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, _gloffset_VertexAttribs4fvNV), + NAME_FUNC_OFFSET(12321, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, _gloffset_VertexAttribs4svNV), + NAME_FUNC_OFFSET(12342, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, _gloffset_VertexAttribs4ubvNV), + NAME_FUNC_OFFSET(12364, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, _gloffset_GetTexBumpParameterfvATI), + NAME_FUNC_OFFSET(12391, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, _gloffset_GetTexBumpParameterivATI), + NAME_FUNC_OFFSET(12418, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, _gloffset_TexBumpParameterfvATI), + NAME_FUNC_OFFSET(12442, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, _gloffset_TexBumpParameterivATI), + NAME_FUNC_OFFSET(12466, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI), + NAME_FUNC_OFFSET(12488, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI), + NAME_FUNC_OFFSET(12510, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI), + NAME_FUNC_OFFSET(12532, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI), + NAME_FUNC_OFFSET(12557, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI), + NAME_FUNC_OFFSET(12581, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI), + NAME_FUNC_OFFSET(12603, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI), + NAME_FUNC_OFFSET(12625, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI), + NAME_FUNC_OFFSET(12647, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI), + NAME_FUNC_OFFSET(12673, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI), + NAME_FUNC_OFFSET(12696, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI), + NAME_FUNC_OFFSET(12720, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI), + NAME_FUNC_OFFSET(12738, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI), + NAME_FUNC_OFFSET(12753, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI), + NAME_FUNC_OFFSET(12784, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(12804, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(12825, gl_dispatch_stub_743, gl_dispatch_stub_743, NULL, _gloffset_ActiveStencilFaceEXT), + NAME_FUNC_OFFSET(12848, gl_dispatch_stub_744, gl_dispatch_stub_744, NULL, _gloffset_BindVertexArrayAPPLE), + NAME_FUNC_OFFSET(12871, gl_dispatch_stub_745, gl_dispatch_stub_745, NULL, _gloffset_DeleteVertexArraysAPPLE), + NAME_FUNC_OFFSET(12897, gl_dispatch_stub_746, gl_dispatch_stub_746, NULL, _gloffset_GenVertexArraysAPPLE), + NAME_FUNC_OFFSET(12920, gl_dispatch_stub_747, gl_dispatch_stub_747, NULL, _gloffset_IsVertexArrayAPPLE), + NAME_FUNC_OFFSET(12941, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV), + NAME_FUNC_OFFSET(12972, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV), + NAME_FUNC_OFFSET(13003, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV), + NAME_FUNC_OFFSET(13031, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV), + NAME_FUNC_OFFSET(13060, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV), + NAME_FUNC_OFFSET(13088, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV), + NAME_FUNC_OFFSET(13117, gl_dispatch_stub_754, gl_dispatch_stub_754, NULL, _gloffset_DepthBoundsEXT), + NAME_FUNC_OFFSET(13134, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(13161, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), + NAME_FUNC_OFFSET(13182, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), + NAME_FUNC_OFFSET(13204, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), + NAME_FUNC_OFFSET(13232, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), + NAME_FUNC_OFFSET(13256, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), + NAME_FUNC_OFFSET(13281, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), + NAME_FUNC_OFFSET(13310, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), + NAME_FUNC_OFFSET(13336, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), + NAME_FUNC_OFFSET(13362, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), + NAME_FUNC_OFFSET(13388, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), + NAME_FUNC_OFFSET(13409, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), + NAME_FUNC_OFFSET(13431, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), + NAME_FUNC_OFFSET(13451, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), + NAME_FUNC_OFFSET(13492, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), + NAME_FUNC_OFFSET(13524, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), + NAME_FUNC_OFFSET(13543, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), + NAME_FUNC_OFFSET(13563, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), + NAME_FUNC_OFFSET(13588, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_BlitFramebufferEXT), + NAME_FUNC_OFFSET(13609, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET(13638, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), + NAME_FUNC_OFFSET(13659, gl_dispatch_stub_776, gl_dispatch_stub_776, NULL, _gloffset_StencilFuncSeparateATI), + NAME_FUNC_OFFSET(13684, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(13713, gl_dispatch_stub_778, gl_dispatch_stub_778, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(13744, gl_dispatch_stub_779, gl_dispatch_stub_779, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(13768, gl_dispatch_stub_780, gl_dispatch_stub_780, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(13793, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(13811, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(13828, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(13844, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(13869, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(13889, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(13909, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(13932, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(13955, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(13975, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(13992, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(14009, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(14024, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(14048, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(14067, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(14086, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(14102, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(14121, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(14144, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14160, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14176, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(14203, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(14230, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(14250, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14269, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14288, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14318, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14348, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14378, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14408, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(14427, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(14450, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(14475, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(14500, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(14527, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(14555, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(14582, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(14610, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(14639, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(14668, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(14694, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(14725, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(14756, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(14780, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(14803, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(14821, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(14850, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(14879, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(14894, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(14920, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(14946, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(14961, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(14973, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(14993, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(15010, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(15026, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(15045, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(15068, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(15084, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(15106, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(15124, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(15143, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(15161, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(15180, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(15198, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(15217, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(15235, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(15254, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(15272, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(15291, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(15309, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(15328, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(15346, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(15365, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(15383, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(15402, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(15420, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(15439, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(15457, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(15476, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(15494, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(15513, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(15531, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(15550, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(15568, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(15587, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(15605, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(15624, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(15642, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(15661, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(15679, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(15698, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), + NAME_FUNC_OFFSET(15721, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), + NAME_FUNC_OFFSET(15744, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), + NAME_FUNC_OFFSET(15767, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), + NAME_FUNC_OFFSET(15790, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), + NAME_FUNC_OFFSET(15813, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), + NAME_FUNC_OFFSET(15830, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), + NAME_FUNC_OFFSET(15853, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), + NAME_FUNC_OFFSET(15876, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), + NAME_FUNC_OFFSET(15899, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), + NAME_FUNC_OFFSET(15925, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), + NAME_FUNC_OFFSET(15951, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), + NAME_FUNC_OFFSET(15977, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), + NAME_FUNC_OFFSET(16001, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), + NAME_FUNC_OFFSET(16028, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), + NAME_FUNC_OFFSET(16054, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), + NAME_FUNC_OFFSET(16074, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), + NAME_FUNC_OFFSET(16094, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), + NAME_FUNC_OFFSET(16114, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), + NAME_FUNC_OFFSET(16137, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), + NAME_FUNC_OFFSET(16161, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), + NAME_FUNC_OFFSET(16184, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), + NAME_FUNC_OFFSET(16208, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), + NAME_FUNC_OFFSET(16225, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), + NAME_FUNC_OFFSET(16243, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), + NAME_FUNC_OFFSET(16260, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), + NAME_FUNC_OFFSET(16278, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), + NAME_FUNC_OFFSET(16295, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), + NAME_FUNC_OFFSET(16313, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), + NAME_FUNC_OFFSET(16330, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), + NAME_FUNC_OFFSET(16348, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), + NAME_FUNC_OFFSET(16365, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), + NAME_FUNC_OFFSET(16383, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), + NAME_FUNC_OFFSET(16400, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), + NAME_FUNC_OFFSET(16418, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), + NAME_FUNC_OFFSET(16435, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), + NAME_FUNC_OFFSET(16453, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), + NAME_FUNC_OFFSET(16470, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), + NAME_FUNC_OFFSET(16488, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), + NAME_FUNC_OFFSET(16505, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), + NAME_FUNC_OFFSET(16523, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), + NAME_FUNC_OFFSET(16542, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), + NAME_FUNC_OFFSET(16561, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), + NAME_FUNC_OFFSET(16580, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), + NAME_FUNC_OFFSET(16599, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), + NAME_FUNC_OFFSET(16619, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), + NAME_FUNC_OFFSET(16639, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), + NAME_FUNC_OFFSET(16659, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(16677, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(16694, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(16712, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(16729, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(16747, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(16765, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(16782, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(16800, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(16819, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(16838, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(16857, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(16879, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(16892, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(16905, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(16921, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(16937, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(16950, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(16973, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(16993, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(17012, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(17023, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(17035, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(17049, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(17062, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(17078, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(17089, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(17102, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(17121, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(17141, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(17154, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(17164, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(17180, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(17199, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(17217, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(17238, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(17253, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(17268, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(17282, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(17297, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(17309, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(17322, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(17334, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(17347, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(17359, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(17372, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(17384, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(17397, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(17409, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(17422, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(17434, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(17447, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(17459, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(17472, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(17484, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(17497, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(17516, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(17535, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(17554, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(17567, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(17585, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(17606, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(17624, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(17644, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17658, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17675, gl_dispatch_stub_574, gl_dispatch_stub_574, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(17691, gl_dispatch_stub_575, gl_dispatch_stub_575, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(17710, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17728, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17749, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17771, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17790, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17812, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17835, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(17854, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(17874, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(17893, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(17913, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(17932, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(17952, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(17971, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(17991, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(18010, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(18030, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(18050, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(18071, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(18091, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(18112, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(18132, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(18153, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(18177, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(18195, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(18215, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(18233, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(18245, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(18258, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(18270, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(18283, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18303, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18327, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18341, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18358, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18373, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18391, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18405, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18422, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18437, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18455, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18469, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18486, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18501, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18519, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18533, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18550, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18565, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18583, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18597, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18614, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18629, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18647, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18661, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18678, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18693, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18711, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18725, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18742, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18757, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18775, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18789, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18806, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18821, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18839, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(18856, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(18876, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(18893, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18919, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18948, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(18963, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(18981, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(19000, gl_dispatch_stub_745, gl_dispatch_stub_745, NULL, _gloffset_DeleteVertexArraysAPPLE), + NAME_FUNC_OFFSET(19021, gl_dispatch_stub_747, gl_dispatch_stub_747, NULL, _gloffset_IsVertexArrayAPPLE), + NAME_FUNC_OFFSET(19037, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(19061, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(19088, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), + NAME_FUNC_OFFSET(19106, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), + NAME_FUNC_OFFSET(19125, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), + NAME_FUNC_OFFSET(19150, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), + NAME_FUNC_OFFSET(19171, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), + NAME_FUNC_OFFSET(19193, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), + NAME_FUNC_OFFSET(19219, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), + NAME_FUNC_OFFSET(19242, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), + NAME_FUNC_OFFSET(19265, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), + NAME_FUNC_OFFSET(19288, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), + NAME_FUNC_OFFSET(19306, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), + NAME_FUNC_OFFSET(19325, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), + NAME_FUNC_OFFSET(19342, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), + NAME_FUNC_OFFSET(19380, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), + NAME_FUNC_OFFSET(19409, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), + NAME_FUNC_OFFSET(19425, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), + NAME_FUNC_OFFSET(19442, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), + NAME_FUNC_OFFSET(19464, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_BlitFramebufferEXT), + NAME_FUNC_OFFSET(19482, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index c714d177a2a..e49cd041a6a 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -641,6 +641,8 @@ _mesa_init_exec_table(struct _glapi_table *exec) /* ???. GL_EXT_depth_bounds_test */ SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT); + SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT); + /* ARB 1. GL_ARB_multitexture */ #if _HAVE_FULL_GL SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB); @@ -895,7 +897,15 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample); #endif +#if FEATURE_ARB_map_buffer_range + SET_MapBufferRange(exec, _mesa_MapBufferRange); + SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange); +#endif + /* GL_ARB_copy_buffer */ SET_CopyBufferSubData(exec, _mesa_CopyBufferSubData); -} + /* GL_ARB_vertex_array_object */ + SET_BindVertexArray(exec, _mesa_BindVertexArray); + SET_GenVertexArrays(exec, _mesa_GenVertexArrays); +} diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 15076712502..b2f11ffbfe3 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -60,7 +60,7 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, { const GLubyte *map = NULL; GLuint max = 0; - GLint i; + GLuint i; if (elementBuf->Name) { /* elements are in a user-defined buffer object. need to map it */ diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index c03353b78f5..fd35d4e38c9 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -63,10 +63,11 @@ static INLINE struct gl_array_object * lookup_arrayobj(GLcontext *ctx, GLuint id) { - return (id == 0) - ? NULL - : (struct gl_array_object *) _mesa_HashLookup(ctx->Shared->ArrayObjects, - id); + if (id == 0) + return NULL; + else + return (struct gl_array_object *) + _mesa_HashLookup(ctx->Array.Objects, id); } @@ -252,7 +253,7 @@ save_array_object( GLcontext *ctx, struct gl_array_object *obj ) { if (obj->Name > 0) { /* insert into hash table */ - _mesa_HashInsert(ctx->Shared->ArrayObjects, obj->Name, obj); + _mesa_HashInsert(ctx->Array.Objects, obj->Name, obj); } } @@ -266,7 +267,7 @@ remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) { if (obj->Name > 0) { /* remove from hash table */ - _mesa_HashRemove(ctx->Shared->ArrayObjects, obj->Name); + _mesa_HashRemove(ctx->Array.Objects, obj->Name); } } @@ -352,18 +353,15 @@ _mesa_update_array_object_max_element(GLcontext *ctx, /* API Functions */ /**********************************************************************/ + /** - * Bind a new array. - * - * \todo - * The binding could be done more efficiently by comparing the non-NULL - * pointers in the old and new objects. The only arrays that are "dirty" are - * the ones that are non-NULL in either object. + * Helper for _mesa_BindVertexArray() and _mesa_BindVertexArrayAPPLE(). + * \param genRequired specifies behavour when id was not generated with + * glGenVertexArrays(). */ -void GLAPIENTRY -_mesa_BindVertexArrayAPPLE( GLuint id ) +static void +bind_vertex_array(GLcontext *ctx, GLuint id, GLboolean genRequired) { - GET_CURRENT_CONTEXT(ctx); struct gl_array_object * const oldObj = ctx->Array.ArrayObj; struct gl_array_object *newObj = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -386,8 +384,12 @@ _mesa_BindVertexArrayAPPLE( GLuint id ) /* non-default array object */ newObj = lookup_arrayobj(ctx, id); if (!newObj) { - /* If this is a new array object id, allocate an array object now. - */ + if (genRequired) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexArray(id)"); + return; + } + + /* For APPLE version, generate a new array object now */ newObj = (*ctx->Driver.NewArrayObject)(ctx, id); if (!newObj) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE"); @@ -403,7 +405,37 @@ _mesa_BindVertexArrayAPPLE( GLuint id ) /* Pass BindVertexArray call to device driver */ if (ctx->Driver.BindArrayObject && newObj) - (*ctx->Driver.BindArrayObject)( ctx, newObj ); + ctx->Driver.BindArrayObject(ctx, newObj); +} + + +/** + * ARB version of glBindVertexArray() + * This function behaves differently from glBindVertexArrayAPPLE() in + * that this function requires all ids to have been previously generated + * by glGenVertexArrays[APPLE](). + */ +void GLAPIENTRY +_mesa_BindVertexArray( GLuint id ) +{ + GET_CURRENT_CONTEXT(ctx); + bind_vertex_array(ctx, id, GL_TRUE); +} + + +/** + * Bind a new array. + * + * \todo + * The binding could be done more efficiently by comparing the non-NULL + * pointers in the old and new objects. The only arrays that are "dirty" are + * the ones that are non-NULL in either object. + */ +void GLAPIENTRY +_mesa_BindVertexArrayAPPLE( GLuint id ) +{ + GET_CURRENT_CONTEXT(ctx); + bind_vertex_array(ctx, id, GL_FALSE); } @@ -425,8 +457,6 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) return; } - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - for (i = 0; i < n; i++) { struct gl_array_object *obj = lookup_arrayobj(ctx, ids[i]); @@ -450,21 +480,19 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) _mesa_reference_array_object(ctx, &obj, NULL); } } - - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); } /** * Generate a set of unique array object IDs and store them in \c arrays. - * + * Helper for _mesa_GenVertexArrays[APPLE]() functions below. * \param n Number of IDs to generate. * \param arrays Array of \c n locations to store the IDs. + * \param vboOnly Will arrays have to reside in VBOs? */ -void GLAPIENTRY -_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays) +static void +gen_vertex_arrays(GLcontext *ctx, GLsizei n, GLuint *arrays, GLboolean vboOnly) { - GET_CURRENT_CONTEXT(ctx); GLuint first; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -478,12 +506,7 @@ _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays) return; } - /* - * This must be atomic (generation and allocation of array object IDs) - */ - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - - first = _mesa_HashFindFreeKeyBlock(ctx->Shared->ArrayObjects, n); + first = _mesa_HashFindFreeKeyBlock(ctx->Array.Objects, n); /* Allocate new, empty array objects and return identifiers */ for (i = 0; i < n; i++) { @@ -492,15 +515,37 @@ _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays) obj = (*ctx->Driver.NewArrayObject)( ctx, name ); if (!obj) { - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArraysAPPLE"); return; } + obj->VBOonly = vboOnly; save_array_object(ctx, obj); arrays[i] = first + i; } +} + + +/** + * ARB version of glGenVertexArrays() + * All arrays will be required to live in VBOs. + */ +void GLAPIENTRY +_mesa_GenVertexArrays(GLsizei n, GLuint *arrays) +{ + GET_CURRENT_CONTEXT(ctx); + gen_vertex_arrays(ctx, n, arrays, GL_TRUE); +} + - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); +/** + * APPLE version of glGenVertexArraysAPPLE() + * Arrays may live in VBOs or ordinary memory. + */ +void GLAPIENTRY +_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays) +{ + GET_CURRENT_CONTEXT(ctx); + gen_vertex_arrays(ctx, n, arrays, GL_FALSE); } @@ -521,9 +566,7 @@ _mesa_IsVertexArrayAPPLE( GLuint id ) if (id == 0) return GL_FALSE; - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); obj = lookup_arrayobj(ctx, id); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); return (obj != NULL) ? GL_TRUE : GL_FALSE; } diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index abca5ab9b4c..8999edc724f 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -67,10 +67,15 @@ _mesa_update_array_object_max_element(GLcontext *ctx, * API functions */ + +void GLAPIENTRY _mesa_BindVertexArray( GLuint id ); + void GLAPIENTRY _mesa_BindVertexArrayAPPLE( GLuint id ); void GLAPIENTRY _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids); +void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays); + void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer); GLboolean GLAPIENTRY _mesa_IsVertexArrayAPPLE( GLuint id ); diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index a49da3d3b58..d640f5358e5 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -45,9 +45,9 @@ #ifdef FEATURE_OES_mapbuffer -#define DEFAULT_ACCESS GL_WRITE_ONLY; +#define DEFAULT_ACCESS GL_MAP_WRITE_BIT #else -#define DEFAULT_ACCESS GL_READ_WRITE; +#define DEFAULT_ACCESS (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT) #endif @@ -101,6 +101,24 @@ get_buffer(GLcontext *ctx, GLenum target) /** + * Convert a GLbitfield describing the mapped buffer access flags + * into one of GL_READ_WRITE, GL_READ_ONLY, or GL_WRITE_ONLY. + */ +static GLenum +simplified_access_mode(GLbitfield access) +{ + const GLbitfield rwFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT; + if ((access & rwFlags) == rwFlags) + return GL_READ_WRITE; + if ((access & GL_MAP_READ_BIT) == GL_MAP_READ_BIT) + return GL_READ_ONLY; + if ((access & GL_MAP_WRITE_BIT) == GL_MAP_WRITE_BIT) + return GL_WRITE_ONLY; + return GL_READ_WRITE; /* this should never happen, but no big deal */ +} + + +/** * Tests the subdata range parameters and sets the GL error code for * \c glBufferSubDataARB and \c glGetBufferSubDataARB. * @@ -162,7 +180,7 @@ buffer_object_subdata_range_good( GLcontext * ctx, GLenum target, * * Default callback for the \c dd_function_table::NewBufferObject() hook. */ -struct gl_buffer_object * +static struct gl_buffer_object * _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) { struct gl_buffer_object *obj; @@ -180,7 +198,7 @@ _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) * * Default callback for the \c dd_function_table::DeleteBuffer() hook. */ -void +static void _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) { (void) ctx; @@ -276,7 +294,7 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, obj->RefCount = 1; obj->Name = name; obj->Usage = GL_STATIC_DRAW_ARB; - obj->Access = DEFAULT_ACCESS; + obj->AccessFlags = DEFAULT_ACCESS; } @@ -298,7 +316,7 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, * * \sa glBufferDataARB, dd_function_table::BufferData. */ -void +static void _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage, struct gl_buffer_object * bufObj ) @@ -337,7 +355,7 @@ _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, * * \sa glBufferSubDataARB, dd_function_table::BufferSubData. */ -void +static void _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data, struct gl_buffer_object * bufObj ) @@ -370,7 +388,7 @@ _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, * * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData. */ -void +static void _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data, struct gl_buffer_object * bufObj ) @@ -397,7 +415,7 @@ _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, * * \sa glMapBufferARB, dd_function_table::MapBuffer */ -void * +static void * _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object *bufObj ) { @@ -415,13 +433,50 @@ _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, /** + * Default fallback for \c dd_function_table::MapBufferRange(). + * Called via glMapBufferRange(). + */ +static void * +_mesa_buffer_map_range( GLcontext *ctx, GLenum target, GLintptr offset, + GLsizeiptr length, GLbitfield access, + struct gl_buffer_object *bufObj ) +{ + (void) ctx; + (void) target; + (void) access; + (void) length; + assert(!bufObj->Pointer); + /* Just return a direct pointer to the data */ + return bufObj->Data + offset; +} + + +/** + * Default fallback for \c dd_function_table::FlushMappedBufferRange(). + * Called via glFlushMappedBufferRange(). + */ +static void +_mesa_buffer_flush_mapped_range( GLcontext *ctx, GLenum target, + GLintptr offset, GLsizeiptr length, + struct gl_buffer_object *obj ) +{ + (void) ctx; + (void) target; + (void) offset; + (void) length; + (void) obj; + /* no-op */ +} + + +/** * Default callback for \c dd_function_table::MapBuffer(). * * The input parameters will have been already tested for errors. * * \sa glUnmapBufferARB, dd_function_table::UnmapBuffer */ -GLboolean +static GLboolean _mesa_buffer_unmap( GLcontext *ctx, GLenum target, struct gl_buffer_object *bufObj ) { @@ -437,7 +492,7 @@ _mesa_buffer_unmap( GLcontext *ctx, GLenum target, * Default fallback for \c dd_function_table::CopyBufferSubData(). * Called via glCopyBuffserSubData(). */ -void +static void _mesa_copy_buffer_subdata(GLcontext *ctx, struct gl_buffer_object *src, struct gl_buffer_object *dst, @@ -470,11 +525,15 @@ _mesa_copy_buffer_subdata(GLcontext *ctx, void _mesa_init_buffer_objects( GLcontext *ctx ) { - ctx->Array.ArrayBufferObj = ctx->Shared->NullBufferObj; - ctx->Array.ElementArrayBufferObj = ctx->Shared->NullBufferObj; - - ctx->CopyReadBuffer = ctx->Shared->NullBufferObj; - ctx->CopyWriteBuffer = ctx->Shared->NullBufferObj; + _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, + ctx->Shared->NullBufferObj); + _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, + ctx->Shared->NullBufferObj); + + _mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer, + ctx->Shared->NullBufferObj); + _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, + ctx->Shared->NullBufferObj); } @@ -804,6 +863,32 @@ unbind(GLcontext *ctx, } +/** + * Plug default/fallback buffer object functions into the device + * driver hooks. + */ +void +_mesa_init_buffer_object_functions(struct dd_function_table *driver) +{ + /* GL_ARB_vertex/pixel_buffer_object */ + driver->NewBufferObject = _mesa_new_buffer_object; + driver->DeleteBuffer = _mesa_delete_buffer_object; + driver->BindBuffer = NULL; + driver->BufferData = _mesa_buffer_data; + driver->BufferSubData = _mesa_buffer_subdata; + driver->GetBufferSubData = _mesa_buffer_get_subdata; + driver->MapBuffer = _mesa_buffer_map; + driver->UnmapBuffer = _mesa_buffer_unmap; + + /* GL_ARB_map_buffer_range */ + driver->MapBufferRange = _mesa_buffer_map_range; + driver->FlushMappedBufferRange = _mesa_buffer_flush_mapped_range; + + /* GL_ARB_copy_buffer */ + driver->CopyBufferSubData = _mesa_copy_buffer_subdata; +} + + /**********************************************************************/ /* API Functions */ @@ -850,7 +935,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) if (bufObj->Pointer) { /* if mapped, unmap it now */ ctx->Driver.UnmapBuffer(ctx, 0, bufObj); - bufObj->Access = DEFAULT_ACCESS; + bufObj->AccessFlags = DEFAULT_ACCESS; bufObj->Pointer = NULL; } @@ -1009,7 +1094,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, if (bufObj->Pointer) { /* Unmap the existing buffer. We'll replace it now. Not an error. */ ctx->Driver.UnmapBuffer(ctx, target, bufObj); - bufObj->Access = DEFAULT_ACCESS; + bufObj->AccessFlags = DEFAULT_ACCESS; bufObj->Pointer = NULL; } @@ -1079,13 +1164,18 @@ _mesa_MapBufferARB(GLenum target, GLenum access) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object * bufObj; + GLbitfield accessFlags; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL); switch (access) { case GL_READ_ONLY_ARB: + accessFlags = GL_MAP_READ_BIT; + break; case GL_WRITE_ONLY_ARB: + accessFlags = GL_MAP_WRITE_BIT; + break; case GL_READ_WRITE_ARB: - /* OK */ + accessFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)"); @@ -1112,7 +1202,10 @@ _mesa_MapBufferARB(GLenum target, GLenum access) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)"); } - bufObj->Access = access; + bufObj->AccessFlags = accessFlags; + bufObj->Offset = 0; + bufObj->Length = bufObj->Size; + if (access == GL_WRITE_ONLY_ARB || access == GL_READ_WRITE_ARB) bufObj->Written = GL_TRUE; @@ -1181,7 +1274,7 @@ _mesa_UnmapBufferARB(GLenum target) #endif #ifdef VBO_DEBUG - if (bufObj->Access == GL_WRITE_ONLY_ARB) { + if (bufObj->AccessFlags & GL_MAP_WRITE_BIT) { GLuint i, unchanged = 0; GLubyte *b = (GLubyte *) bufObj->Pointer; GLint pos = -1; @@ -1201,8 +1294,10 @@ _mesa_UnmapBufferARB(GLenum target) #endif status = ctx->Driver.UnmapBuffer( ctx, target, bufObj ); - bufObj->Access = DEFAULT_ACCESS; + bufObj->AccessFlags = DEFAULT_ACCESS; bufObj->Pointer = NULL; + bufObj->Offset = 0; + bufObj->Length = 0; return status; } @@ -1233,7 +1328,7 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params) *params = bufObj->Usage; break; case GL_BUFFER_ACCESS_ARB: - *params = bufObj->Access; + *params = simplified_access_mode(bufObj->AccessFlags); break; case GL_BUFFER_MAPPED_ARB: *params = (bufObj->Pointer != NULL); @@ -1350,3 +1445,153 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, ctx->Driver.CopyBufferSubData(ctx, src, dst, readOffset, writeOffset, size); } + +/** + * See GL_ARB_map_buffer_range spec + */ +void * GLAPIENTRY +_mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, + GLbitfield access) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL); + + if (!ctx->Extensions.ARB_map_buffer_range) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMapBufferRange(extension not supported)"); + return NULL; + } + + if (offset < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glMapBufferRange(offset = %ld)", offset); + return NULL; + } + + if (length < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glMapBufferRange(length = %ld)", length); + return NULL; + } + + if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMapBufferRange(access indicates neither read or write)"); + return NULL; + } + + if (access & GL_MAP_READ_BIT) { + if ((access & GL_MAP_INVALIDATE_RANGE_BIT) || + (access & GL_MAP_INVALIDATE_BUFFER_BIT) || + (access & GL_MAP_UNSYNCHRONIZED_BIT)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMapBufferRange(invalid access flags)"); + return NULL; + } + } + + if ((access & GL_MAP_FLUSH_EXPLICIT_BIT) && + ((access & GL_MAP_WRITE_BIT) == 0)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMapBufferRange(invalid access flags)"); + return NULL; + } + + bufObj = get_buffer(ctx, target); + if (!bufObj || bufObj->Name == 0) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glMapBufferRange(target = 0x%x)", target); + return NULL; + } + + if (offset + length > bufObj->Size) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glMapBufferRange(offset + length > size)"); + return NULL; + } + + if (bufObj->Pointer) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMapBufferRange(buffer already mapped)"); + return NULL; + } + + ASSERT(ctx->Driver.MapBufferRange); + bufObj->Pointer = ctx->Driver.MapBufferRange(ctx, target, offset, length, + access, bufObj); + + bufObj->Offset = offset; + bufObj->Length = length; + bufObj->AccessFlags = access; + + return bufObj->Pointer; +} + + +/** + * See GL_ARB_map_buffer_range spec + */ +void GLAPIENTRY +_mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!ctx->Extensions.ARB_map_buffer_range) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMapBufferRange(extension not supported)"); + return; + } + + if (offset < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glMapBufferRange(offset = %ld)", offset); + return; + } + + if (length < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glMapBufferRange(length = %ld)", length); + return; + } + + bufObj = get_buffer(ctx, target); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glMapBufferRange(target = 0x%x)", target); + return; + } + + if (bufObj->Name == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMapBufferRange(current buffer is 0)"); + return; + } + + if (!bufObj->Pointer) { + /* buffer is not mapped */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMapBufferRange(buffer is not mapped)"); + return; + } + + if ((bufObj->AccessFlags & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glMapBufferRange(GL_MAP_FLUSH_EXPLICIT_BIT not set)"); + return; + } + + if (offset + length > bufObj->Length) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glMapBufferRange(offset %ld + length %ld > mapped length %ld)", + offset, length, bufObj->Length); + return; + } + + ASSERT(bufObj->AccessFlags & GL_MAP_WRITE_BIT); + + if (ctx->Driver.FlushMappedBufferRange) + ctx->Driver.FlushMappedBufferRange(ctx, target, offset, length, bufObj); +} diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 79c027aa4d4..ef59ff83c84 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -42,11 +42,6 @@ _mesa_init_buffer_objects( GLcontext *ctx ); extern void _mesa_update_default_objects_buffer_objects(GLcontext *ctx); -extern struct gl_buffer_object * -_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ); - -extern void -_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); extern struct gl_buffer_object * _mesa_lookup_bufferobj(GLcontext *ctx, GLuint buffer); @@ -60,36 +55,6 @@ _mesa_reference_buffer_object(GLcontext *ctx, struct gl_buffer_object **ptr, struct gl_buffer_object *bufObj); -extern void -_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, - const GLvoid * data, GLenum usage, - struct gl_buffer_object * bufObj ); - -extern void -_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, - GLsizeiptrARB size, const GLvoid * data, - struct gl_buffer_object * bufObj ); - -extern void -_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, - GLsizeiptrARB size, GLvoid * data, - struct gl_buffer_object * bufObj ); - -extern void * -_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, - struct gl_buffer_object * bufObj ); - -extern GLboolean -_mesa_buffer_unmap( GLcontext *ctx, GLenum target, - struct gl_buffer_object * bufObj ); - -extern void -_mesa_copy_buffer_subdata(GLcontext *ctx, - struct gl_buffer_object *src, - struct gl_buffer_object *dst, - GLintptr readOffset, GLintptr writeOffset, - GLsizeiptr size); - extern GLboolean _mesa_validate_pbo_access(GLuint dimensions, const struct gl_pixelstore_attrib *pack, @@ -124,6 +89,9 @@ _mesa_unmap_readpix_pbo(GLcontext *ctx, const struct gl_pixelstore_attrib *pack); +extern void +_mesa_init_buffer_object_functions(struct dd_function_table *driver); + /* * API functions @@ -167,4 +135,11 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +extern void * GLAPIENTRY +_mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, + GLbitfield access); + +extern void GLAPIENTRY +_mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length); + #endif diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 93103fe878d..e79bbc2ac5f 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -468,9 +468,9 @@ do { \ #endif - +#ifndef Elements #define Elements(x) (sizeof(x)/sizeof(*(x))) - +#endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index bf53bd34678..415e339cb80 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -592,6 +592,9 @@ _mesa_init_constants(GLcontext *ctx) /* GL_ATI_envmap_bumpmap */ ctx->Const.SupportedBumpUnits = SUPPORTED_ATI_BUMP_UNITS; + /* GL_EXT_provoking_vertex */ + ctx->Const.QuadsFollowProvokingVertexConvention = GL_TRUE; + /* sanity checks */ ASSERT(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); @@ -1008,6 +1011,7 @@ _mesa_free_context_data( GLcontext *ctx ) #if FEATURE_ARB_occlusion_query _mesa_free_query_data(ctx); #endif + _mesa_free_varray_data(ctx); _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj); @@ -1256,6 +1260,24 @@ initialize_framebuffer_size(GLcontext *ctx, GLframebuffer *fb) /** + * Check if the viewport/scissor size has not yet been initialized. + * Initialize the size if the given width and height are non-zero. + */ +void +_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height) +{ + if (!ctx->ViewportInitialized && width > 0 && height > 0) { + /* Note: set flag here, before calling _mesa_set_viewport(), to prevent + * potential infinite recursion. + */ + ctx->ViewportInitialized = GL_TRUE; + _mesa_set_viewport(ctx, 0, 0, width, height); + _mesa_set_scissor(ctx, 0, 0, width, height); + } +} + + +/** * Bind the given context to the given drawBuffer and readBuffer and * make it the current context for the calling thread. * We'll render into the drawBuffer and read pixels from the @@ -1372,25 +1394,24 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, ASSERT(drawBuffer->Height > 0); #endif - if (newCtx->FirstTimeCurrent) { - /* set initial viewport and scissor size now */ - _mesa_set_viewport(newCtx, 0, 0, - drawBuffer->Width, drawBuffer->Height); - _mesa_set_scissor(newCtx, 0, 0, - drawBuffer->Width, drawBuffer->Height ); - check_context_limits(newCtx); + if (drawBuffer) { + _mesa_check_init_viewport(newCtx, + drawBuffer->Width, drawBuffer->Height); } } - /* We can use this to help debug user's problems. Tell them to set - * the MESA_INFO env variable before running their app. Then the - * first time each context is made current we'll print some useful - * information. - */ if (newCtx->FirstTimeCurrent) { + check_context_limits(newCtx); + + /* We can use this to help debug user's problems. Tell them to set + * the MESA_INFO env variable before running their app. Then the + * first time each context is made current we'll print some useful + * information. + */ if (_mesa_getenv("MESA_INFO")) { _mesa_print_info(); } + newCtx->FirstTimeCurrent = GL_FALSE; } } diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 6b3e1b2b973..0531ae8ee86 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -130,6 +130,9 @@ extern void _mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); +extern void +_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height); + extern GLboolean _mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ); diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index d3c1717a506..49f202daa1c 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -352,6 +352,9 @@ typedef enum OPCODE_EVAL_P1, OPCODE_EVAL_P2, + /* GL_EXT_provoking_vertex */ + OPCODE_PROVOKING_VERTEX, + /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_CONTINUE, @@ -957,6 +960,20 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) } } +static void invalidate_saved_current_state( GLcontext *ctx ) +{ + GLint i; + + for (i = 0; i < VERT_ATTRIB_MAX; i++) + ctx->ListState.ActiveAttribSize[i] = 0; + + for (i = 0; i < MAT_ATTRIB_MAX; i++) + ctx->ListState.ActiveMaterialSize[i] = 0; + + memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current); + + ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; +} void GLAPIENTRY _mesa_save_CallList(GLuint list) @@ -970,9 +987,10 @@ _mesa_save_CallList(GLuint list) n[1].ui = list; } - /* After this, we don't know what begin/end state we're in: + /* After this, we don't know what state we're in. Invalidate all + * cached information previously gathered: */ - ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; + invalidate_saved_current_state( ctx ); if (ctx->ExecuteFlag) { _mesa_CallList(list); @@ -1015,9 +1033,10 @@ _mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists) } } - /* After this, we don't know what begin/end state we're in: + /* After this, we don't know what state we're in. Invalidate all + * cached information previously gathered: */ - ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; + invalidate_saved_current_state( ctx ); if (ctx->ExecuteFlag) { CALL_CallLists(ctx->Exec, (n, type, lists)); @@ -3177,14 +3196,26 @@ save_ShadeModel(GLenum mode) { GET_CURRENT_CONTEXT(ctx); Node *n; - ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); + + if (ctx->ExecuteFlag) { + CALL_ShadeModel(ctx->Exec, (mode)); + } + + 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; + n = ALLOC_INSTRUCTION(ctx, OPCODE_SHADE_MODEL, 1); if (n) { n[1].e = mode; } - if (ctx->ExecuteFlag) { - CALL_ShadeModel(ctx->Exec, (mode)); - } } @@ -5146,14 +5177,21 @@ save_EdgeFlag(GLboolean x) save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0); } +static INLINE GLboolean compare4fv( const GLfloat *a, + const GLfloat *b, + GLuint count ) +{ + return memcmp( a, b, count * sizeof(GLfloat) ) == 0; +} + + static void GLAPIENTRY save_Materialfv(GLenum face, GLenum pname, const GLfloat * param) { GET_CURRENT_CONTEXT(ctx); Node *n; int args, i; - - SAVE_FLUSH_VERTICES(ctx); + GLuint bitmask; switch (face) { case GL_BACK: @@ -5183,26 +5221,43 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param) _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)"); return; } - - n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6); - if (n) { - n[1].e = face; - n[2].e = pname; - for (i = 0; i < args; i++) - n[3 + i].f = param[i]; + + if (ctx->ExecuteFlag) { + CALL_Materialfv(ctx->Exec, (face, pname, param)); } - { - GLuint bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL); - for (i = 0; i < MAT_ATTRIB_MAX; i++) - if (bitmask & (1 << i)) { + bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL); + + /* Try to eliminate redundant statechanges. Because it is legal to + * call glMaterial even inside begin/end calls, don't need to worry + * about ctx->Driver.CurrentSavePrimitive here. + */ + for (i = 0; i < MAT_ATTRIB_MAX; i++) { + if (bitmask & (1 << i)) { + if (ctx->ListState.ActiveMaterialSize[i] == args && + compare4fv(ctx->ListState.CurrentMaterial[i], param, args)) { + bitmask &= ~(1 << i); + } + else { ctx->ListState.ActiveMaterialSize[i] = args; COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param); } + } } - if (ctx->ExecuteFlag) { - CALL_Materialfv(ctx->Exec, (face, pname, param)); + /* If this call has effect, return early: + */ + if (bitmask == 0) + return; + + SAVE_FLUSH_VERTICES(ctx); + + n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6); + if (n) { + n[1].e = face; + n[2].e = pname; + for (i = 0; i < args; i++) + n[3 + i].f = param[i]; } } @@ -5705,6 +5760,25 @@ save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, #endif +/** GL_EXT_provoking_vertex */ +static void GLAPIENTRY +save_ProvokingVertexEXT(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION(ctx, OPCODE_PROVOKING_VERTEX, 1); + if (n) { + n[1].e = mode; + } + if (ctx->ExecuteFlag) { + /*CALL_ProvokingVertexEXT(ctx->Exec, (mode));*/ + _mesa_ProvokingVertexEXT(mode); + } +} + + + /** * Save an error-generating command into display list. * @@ -6269,6 +6343,9 @@ execute_list(GLcontext *ctx, GLuint list) case OPCODE_SHADE_MODEL: CALL_ShadeModel(ctx->Exec, (n[1].e)); break; + case OPCODE_PROVOKING_VERTEX: + CALL_ProvokingVertexEXT(ctx->Exec, (n[1].e)); + break; case OPCODE_STENCIL_FUNC: CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui)); break; @@ -6771,7 +6848,6 @@ void GLAPIENTRY _mesa_NewList(GLuint name, GLenum mode) { GET_CURRENT_CONTEXT(ctx); - GLint i; FLUSH_CURRENT(ctx, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -6799,20 +6875,15 @@ _mesa_NewList(GLuint name, GLenum mode) ctx->CompileFlag = GL_TRUE; ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE); + /* Reset acumulated list state: + */ + invalidate_saved_current_state( ctx ); + /* Allocate new display list */ ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE); ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head; ctx->ListState.CurrentPos = 0; - /* Reset acumulated list state: - */ - for (i = 0; i < Elements(ctx->ListState.ActiveAttribSize); i++) - ctx->ListState.ActiveAttribSize[i] = 0; - - for (i = 0; i < Elements(ctx->ListState.ActiveMaterialSize); i++) - ctx->ListState.ActiveMaterialSize[i] = 0; - - ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; ctx->Driver.NewList(ctx, name, mode); ctx->CurrentDispatch = ctx->Save; @@ -8239,8 +8310,17 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT); #endif + /* ARB 50. GL_ARB_map_buffer_range */ +#if FEATURE_ARB_map_buffer_range + SET_MapBufferRange(table, _mesa_MapBufferRange); /* no dlist save */ + SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */ +#endif + /* ARB 59. GL_ARB_copy_buffer */ SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */ + + /* 364. GL_EXT_provoking_vertex */ + SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT); } @@ -8477,6 +8557,11 @@ print_list(GLcontext *ctx, GLuint list) _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); break; + case OPCODE_PROVOKING_VERTEX: + _mesa_printf("ProvokingVertex %s\n", + _mesa_lookup_enum_by_nr(n[1].ui)); + break; + /* * meta opcodes/commands */ diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index 4339e3ba4e5..6e2adea6360 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -514,6 +514,7 @@ LONGSTRING static const char enum_string_table[] = "GL_FEEDBACK_BUFFER_SIZE\0" "GL_FEEDBACK_BUFFER_TYPE\0" "GL_FILL\0" + "GL_FIRST_VERTEX_CONVENTION_EXT\0" "GL_FLAT\0" "GL_FLOAT\0" "GL_FLOAT_MAT2\0" @@ -696,6 +697,7 @@ LONGSTRING static const char enum_string_table[] = "GL_INVERSE_TRANSPOSE_NV\0" "GL_INVERT\0" "GL_KEEP\0" + "GL_LAST_VERTEX_CONVENTION_EXT\0" "GL_LEFT\0" "GL_LEQUAL\0" "GL_LESS\0" @@ -821,7 +823,13 @@ LONGSTRING static const char enum_string_table[] = "GL_MAP2_VERTEX_ATTRIB8_4_NV\0" "GL_MAP2_VERTEX_ATTRIB9_4_NV\0" "GL_MAP_COLOR\0" + "GL_MAP_FLUSH_EXPLICIT_BIT\0" + "GL_MAP_INVALIDATE_BUFFER_BIT\0" + "GL_MAP_INVALIDATE_RANGE_BIT\0" + "GL_MAP_READ_BIT\0" "GL_MAP_STENCIL\0" + "GL_MAP_UNSYNCHRONIZED_BIT\0" + "GL_MAP_WRITE_BIT\0" "GL_MATRIX0_ARB\0" "GL_MATRIX0_NV\0" "GL_MATRIX10_ARB\0" @@ -1273,6 +1281,7 @@ LONGSTRING static const char enum_string_table[] = "GL_PROJECTION\0" "GL_PROJECTION_MATRIX\0" "GL_PROJECTION_STACK_DEPTH\0" + "GL_PROVOKING_VERTEX_EXT\0" "GL_PROXY_COLOR_TABLE\0" "GL_PROXY_HISTOGRAM\0" "GL_PROXY_HISTOGRAM_EXT\0" @@ -1293,6 +1302,7 @@ LONGSTRING static const char enum_string_table[] = "GL_Q\0" "GL_QUADRATIC_ATTENUATION\0" "GL_QUADS\0" + "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT\0" "GL_QUAD_MESH_SUN\0" "GL_QUAD_STRIP\0" "GL_QUERY_COUNTER_BITS\0" @@ -1789,6 +1799,7 @@ LONGSTRING static const char enum_string_table[] = "GL_VENDOR\0" "GL_VERSION\0" "GL_VERTEX_ARRAY\0" + "GL_VERTEX_ARRAY_BINDING\0" "GL_VERTEX_ARRAY_BINDING_APPLE\0" "GL_VERTEX_ARRAY_BUFFER_BINDING\0" "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB\0" @@ -1860,7 +1871,7 @@ LONGSTRING static const char enum_string_table[] = "GL_ZOOM_Y\0" ; -static const enum_elt all_enums[1822] = +static const enum_elt all_enums[1833] = { { 0, 0x00000600 }, /* GL_2D */ { 6, 0x00001407 }, /* GL_2_BYTES */ @@ -2340,1429 +2351,1440 @@ static const enum_elt all_enums[1822] = { 9547, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ { 9571, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ { 9595, 0x00001B02 }, /* GL_FILL */ - { 9603, 0x00001D00 }, /* GL_FLAT */ - { 9611, 0x00001406 }, /* GL_FLOAT */ - { 9620, 0x00008B5A }, /* GL_FLOAT_MAT2 */ - { 9634, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ - { 9652, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ - { 9668, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ - { 9684, 0x00008B5B }, /* GL_FLOAT_MAT3 */ - { 9698, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ - { 9716, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ - { 9732, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ - { 9748, 0x00008B5C }, /* GL_FLOAT_MAT4 */ - { 9762, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ - { 9780, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ - { 9796, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ - { 9812, 0x00008B50 }, /* GL_FLOAT_VEC2 */ - { 9826, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ - { 9844, 0x00008B51 }, /* GL_FLOAT_VEC3 */ - { 9858, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ - { 9876, 0x00008B52 }, /* GL_FLOAT_VEC4 */ - { 9890, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ - { 9908, 0x00000B60 }, /* GL_FOG */ - { 9915, 0x00000080 }, /* GL_FOG_BIT */ - { 9926, 0x00000B66 }, /* GL_FOG_COLOR */ - { 9939, 0x00008451 }, /* GL_FOG_COORD */ - { 9952, 0x00008451 }, /* GL_FOG_COORDINATE */ - { 9970, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ - { 9994, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - { 10033, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ - { 10076, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - { 10108, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - { 10139, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - { 10168, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ - { 10193, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ - { 10212, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ - { 10246, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ - { 10273, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ - { 10299, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ - { 10323, 0x00008450 }, /* GL_FOG_COORD_SRC */ - { 10340, 0x00000B62 }, /* GL_FOG_DENSITY */ - { 10355, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ - { 10379, 0x00000B64 }, /* GL_FOG_END */ - { 10390, 0x00000C54 }, /* GL_FOG_HINT */ - { 10402, 0x00000B61 }, /* GL_FOG_INDEX */ - { 10415, 0x00000B65 }, /* GL_FOG_MODE */ - { 10427, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ - { 10446, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ - { 10471, 0x00000B63 }, /* GL_FOG_START */ - { 10484, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ - { 10502, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ - { 10526, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ - { 10545, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ - { 10568, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - { 10603, 0x00008D40 }, /* GL_FRAMEBUFFER */ - { 10618, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - { 10655, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - { 10691, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - { 10732, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - { 10773, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - { 10810, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - { 10847, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - { 10885, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ - { 10927, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - { 10965, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ - { 11007, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - { 11042, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - { 11081, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ - { 11130, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - { 11178, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ - { 11230, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - { 11270, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ - { 11314, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - { 11354, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ - { 11398, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ - { 11425, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ - { 11449, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ - { 11477, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ - { 11500, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ - { 11519, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - { 11556, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ - { 11597, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - { 11638, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - { 11680, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - { 11731, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - { 11769, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - { 11814, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ - { 11863, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - { 11901, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - { 11943, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - { 11975, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ - { 12000, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ - { 12027, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ - { 12058, 0x00000404 }, /* GL_FRONT */ - { 12067, 0x00000408 }, /* GL_FRONT_AND_BACK */ - { 12085, 0x00000B46 }, /* GL_FRONT_FACE */ - { 12099, 0x00000400 }, /* GL_FRONT_LEFT */ - { 12113, 0x00000401 }, /* GL_FRONT_RIGHT */ - { 12128, 0x00008006 }, /* GL_FUNC_ADD */ - { 12140, 0x00008006 }, /* GL_FUNC_ADD_EXT */ - { 12156, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ - { 12181, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ - { 12210, 0x0000800A }, /* GL_FUNC_SUBTRACT */ - { 12227, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ - { 12248, 0x00008191 }, /* GL_GENERATE_MIPMAP */ - { 12267, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ - { 12291, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ - { 12320, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ - { 12344, 0x00000206 }, /* GL_GEQUAL */ - { 12354, 0x00000204 }, /* GL_GREATER */ - { 12365, 0x00001904 }, /* GL_GREEN */ - { 12374, 0x00000D19 }, /* GL_GREEN_BIAS */ - { 12388, 0x00000D53 }, /* GL_GREEN_BITS */ - { 12402, 0x00000D18 }, /* GL_GREEN_SCALE */ - { 12417, 0x00008000 }, /* GL_HINT_BIT */ - { 12429, 0x00008024 }, /* GL_HISTOGRAM */ - { 12442, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ - { 12466, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ - { 12494, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ - { 12517, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ - { 12544, 0x00008024 }, /* GL_HISTOGRAM_EXT */ - { 12561, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ - { 12581, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ - { 12605, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ - { 12629, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ - { 12657, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - { 12685, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ - { 12717, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ - { 12739, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ - { 12765, 0x0000802D }, /* GL_HISTOGRAM_SINK */ - { 12783, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ - { 12805, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ - { 12824, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ - { 12847, 0x0000862A }, /* GL_IDENTITY_NV */ - { 12862, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ - { 12882, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - { 12922, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - { 12960, 0x00001E02 }, /* GL_INCR */ - { 12968, 0x00008507 }, /* GL_INCR_WRAP */ - { 12981, 0x00008507 }, /* GL_INCR_WRAP_EXT */ - { 12998, 0x00008222 }, /* GL_INDEX */ - { 13007, 0x00008077 }, /* GL_INDEX_ARRAY */ - { 13022, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - { 13052, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ - { 13086, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ - { 13109, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ - { 13131, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ - { 13151, 0x00000D51 }, /* GL_INDEX_BITS */ - { 13165, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ - { 13186, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ - { 13204, 0x00000C30 }, /* GL_INDEX_MODE */ - { 13218, 0x00000D13 }, /* GL_INDEX_OFFSET */ - { 13234, 0x00000D12 }, /* GL_INDEX_SHIFT */ - { 13249, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ - { 13268, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ - { 13287, 0x00001404 }, /* GL_INT */ - { 13294, 0x00008049 }, /* GL_INTENSITY */ - { 13307, 0x0000804C }, /* GL_INTENSITY12 */ - { 13322, 0x0000804C }, /* GL_INTENSITY12_EXT */ - { 13341, 0x0000804D }, /* GL_INTENSITY16 */ - { 13356, 0x0000804D }, /* GL_INTENSITY16_EXT */ - { 13375, 0x0000804A }, /* GL_INTENSITY4 */ - { 13389, 0x0000804A }, /* GL_INTENSITY4_EXT */ - { 13407, 0x0000804B }, /* GL_INTENSITY8 */ - { 13421, 0x0000804B }, /* GL_INTENSITY8_EXT */ - { 13439, 0x00008049 }, /* GL_INTENSITY_EXT */ - { 13456, 0x00008575 }, /* GL_INTERPOLATE */ - { 13471, 0x00008575 }, /* GL_INTERPOLATE_ARB */ - { 13490, 0x00008575 }, /* GL_INTERPOLATE_EXT */ - { 13509, 0x00008B53 }, /* GL_INT_VEC2 */ - { 13521, 0x00008B53 }, /* GL_INT_VEC2_ARB */ - { 13537, 0x00008B54 }, /* GL_INT_VEC3 */ - { 13549, 0x00008B54 }, /* GL_INT_VEC3_ARB */ - { 13565, 0x00008B55 }, /* GL_INT_VEC4 */ - { 13577, 0x00008B55 }, /* GL_INT_VEC4_ARB */ - { 13593, 0x00000500 }, /* GL_INVALID_ENUM */ - { 13609, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ - { 13642, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ - { 13679, 0x00000502 }, /* GL_INVALID_OPERATION */ - { 13700, 0x00000501 }, /* GL_INVALID_VALUE */ - { 13717, 0x0000862B }, /* GL_INVERSE_NV */ - { 13731, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ - { 13755, 0x0000150A }, /* GL_INVERT */ - { 13765, 0x00001E00 }, /* GL_KEEP */ - { 13773, 0x00000406 }, /* GL_LEFT */ - { 13781, 0x00000203 }, /* GL_LEQUAL */ - { 13791, 0x00000201 }, /* GL_LESS */ - { 13799, 0x00004000 }, /* GL_LIGHT0 */ - { 13809, 0x00004001 }, /* GL_LIGHT1 */ - { 13819, 0x00004002 }, /* GL_LIGHT2 */ - { 13829, 0x00004003 }, /* GL_LIGHT3 */ - { 13839, 0x00004004 }, /* GL_LIGHT4 */ - { 13849, 0x00004005 }, /* GL_LIGHT5 */ - { 13859, 0x00004006 }, /* GL_LIGHT6 */ - { 13869, 0x00004007 }, /* GL_LIGHT7 */ - { 13879, 0x00000B50 }, /* GL_LIGHTING */ - { 13891, 0x00000040 }, /* GL_LIGHTING_BIT */ - { 13907, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ - { 13930, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - { 13959, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ - { 13992, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - { 14020, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ - { 14044, 0x00001B01 }, /* GL_LINE */ - { 14052, 0x00002601 }, /* GL_LINEAR */ - { 14062, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ - { 14084, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - { 14114, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - { 14145, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ - { 14169, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ - { 14194, 0x00000001 }, /* GL_LINES */ - { 14203, 0x00000004 }, /* GL_LINE_BIT */ - { 14215, 0x00000002 }, /* GL_LINE_LOOP */ - { 14228, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ - { 14248, 0x00000B20 }, /* GL_LINE_SMOOTH */ - { 14263, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ - { 14283, 0x00000B24 }, /* GL_LINE_STIPPLE */ - { 14299, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ - { 14323, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ - { 14346, 0x00000003 }, /* GL_LINE_STRIP */ - { 14360, 0x00000702 }, /* GL_LINE_TOKEN */ - { 14374, 0x00000B21 }, /* GL_LINE_WIDTH */ - { 14388, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ - { 14414, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ - { 14434, 0x00008B82 }, /* GL_LINK_STATUS */ - { 14449, 0x00000B32 }, /* GL_LIST_BASE */ - { 14462, 0x00020000 }, /* GL_LIST_BIT */ - { 14474, 0x00000B33 }, /* GL_LIST_INDEX */ - { 14488, 0x00000B30 }, /* GL_LIST_MODE */ - { 14501, 0x00000101 }, /* GL_LOAD */ - { 14509, 0x00000BF1 }, /* GL_LOGIC_OP */ - { 14521, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ - { 14538, 0x00008CA1 }, /* GL_LOWER_LEFT */ - { 14552, 0x00001909 }, /* GL_LUMINANCE */ - { 14565, 0x00008041 }, /* GL_LUMINANCE12 */ - { 14580, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ - { 14603, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ - { 14630, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ - { 14652, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ - { 14678, 0x00008041 }, /* GL_LUMINANCE12_EXT */ - { 14697, 0x00008042 }, /* GL_LUMINANCE16 */ - { 14712, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ - { 14735, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ - { 14762, 0x00008042 }, /* GL_LUMINANCE16_EXT */ - { 14781, 0x0000803F }, /* GL_LUMINANCE4 */ - { 14795, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ - { 14816, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ - { 14841, 0x0000803F }, /* GL_LUMINANCE4_EXT */ - { 14859, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ - { 14880, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ - { 14905, 0x00008040 }, /* GL_LUMINANCE8 */ - { 14919, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ - { 14940, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ - { 14965, 0x00008040 }, /* GL_LUMINANCE8_EXT */ - { 14983, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ - { 15002, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ - { 15018, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ - { 15038, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ - { 15060, 0x00000D91 }, /* GL_MAP1_INDEX */ - { 15074, 0x00000D92 }, /* GL_MAP1_NORMAL */ - { 15089, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ - { 15113, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ - { 15137, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ - { 15161, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ - { 15185, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ - { 15202, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ - { 15219, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - { 15247, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - { 15276, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - { 15305, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - { 15334, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - { 15363, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - { 15392, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - { 15421, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - { 15449, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - { 15477, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - { 15505, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - { 15533, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - { 15561, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - { 15589, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - { 15617, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - { 15645, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - { 15673, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ - { 15689, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ - { 15709, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ - { 15731, 0x00000DB1 }, /* GL_MAP2_INDEX */ - { 15745, 0x00000DB2 }, /* GL_MAP2_NORMAL */ - { 15760, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ - { 15784, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ - { 15808, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ - { 15832, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ - { 15856, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ - { 15873, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ - { 15890, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - { 15918, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - { 15947, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - { 15976, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - { 16005, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - { 16034, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - { 16063, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - { 16092, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - { 16120, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - { 16148, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - { 16176, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - { 16204, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - { 16232, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - { 16260, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ - { 16288, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - { 16316, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - { 16344, 0x00000D10 }, /* GL_MAP_COLOR */ - { 16357, 0x00000D11 }, /* GL_MAP_STENCIL */ - { 16372, 0x000088C0 }, /* GL_MATRIX0_ARB */ - { 16387, 0x00008630 }, /* GL_MATRIX0_NV */ - { 16401, 0x000088CA }, /* GL_MATRIX10_ARB */ - { 16417, 0x000088CB }, /* GL_MATRIX11_ARB */ - { 16433, 0x000088CC }, /* GL_MATRIX12_ARB */ - { 16449, 0x000088CD }, /* GL_MATRIX13_ARB */ - { 16465, 0x000088CE }, /* GL_MATRIX14_ARB */ - { 16481, 0x000088CF }, /* GL_MATRIX15_ARB */ - { 16497, 0x000088D0 }, /* GL_MATRIX16_ARB */ - { 16513, 0x000088D1 }, /* GL_MATRIX17_ARB */ - { 16529, 0x000088D2 }, /* GL_MATRIX18_ARB */ - { 16545, 0x000088D3 }, /* GL_MATRIX19_ARB */ - { 16561, 0x000088C1 }, /* GL_MATRIX1_ARB */ - { 16576, 0x00008631 }, /* GL_MATRIX1_NV */ - { 16590, 0x000088D4 }, /* GL_MATRIX20_ARB */ - { 16606, 0x000088D5 }, /* GL_MATRIX21_ARB */ - { 16622, 0x000088D6 }, /* GL_MATRIX22_ARB */ - { 16638, 0x000088D7 }, /* GL_MATRIX23_ARB */ - { 16654, 0x000088D8 }, /* GL_MATRIX24_ARB */ - { 16670, 0x000088D9 }, /* GL_MATRIX25_ARB */ - { 16686, 0x000088DA }, /* GL_MATRIX26_ARB */ - { 16702, 0x000088DB }, /* GL_MATRIX27_ARB */ - { 16718, 0x000088DC }, /* GL_MATRIX28_ARB */ - { 16734, 0x000088DD }, /* GL_MATRIX29_ARB */ - { 16750, 0x000088C2 }, /* GL_MATRIX2_ARB */ - { 16765, 0x00008632 }, /* GL_MATRIX2_NV */ - { 16779, 0x000088DE }, /* GL_MATRIX30_ARB */ - { 16795, 0x000088DF }, /* GL_MATRIX31_ARB */ - { 16811, 0x000088C3 }, /* GL_MATRIX3_ARB */ - { 16826, 0x00008633 }, /* GL_MATRIX3_NV */ - { 16840, 0x000088C4 }, /* GL_MATRIX4_ARB */ - { 16855, 0x00008634 }, /* GL_MATRIX4_NV */ - { 16869, 0x000088C5 }, /* GL_MATRIX5_ARB */ - { 16884, 0x00008635 }, /* GL_MATRIX5_NV */ - { 16898, 0x000088C6 }, /* GL_MATRIX6_ARB */ - { 16913, 0x00008636 }, /* GL_MATRIX6_NV */ - { 16927, 0x000088C7 }, /* GL_MATRIX7_ARB */ - { 16942, 0x00008637 }, /* GL_MATRIX7_NV */ - { 16956, 0x000088C8 }, /* GL_MATRIX8_ARB */ - { 16971, 0x000088C9 }, /* GL_MATRIX9_ARB */ - { 16986, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ - { 17012, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - { 17046, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - { 17077, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - { 17110, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - { 17141, 0x00000BA0 }, /* GL_MATRIX_MODE */ - { 17156, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ - { 17178, 0x00008008 }, /* GL_MAX */ - { 17185, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ - { 17208, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - { 17240, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ - { 17266, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - { 17299, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - { 17325, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 17359, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ - { 17378, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ - { 17407, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - { 17439, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 17475, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - { 17511, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ - { 17551, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ - { 17577, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ - { 17607, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ - { 17632, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ - { 17661, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - { 17690, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ - { 17723, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ - { 17743, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ - { 17767, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ - { 17791, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ - { 17815, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ - { 17840, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ - { 17858, 0x00008008 }, /* GL_MAX_EXT */ - { 17869, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - { 17904, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ - { 17943, 0x00000D31 }, /* GL_MAX_LIGHTS */ - { 17957, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ - { 17977, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - { 18015, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - { 18044, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ - { 18068, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ - { 18096, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ - { 18119, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 18156, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 18192, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - { 18219, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - { 18248, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - { 18282, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - { 18318, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - { 18345, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - { 18377, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - { 18413, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - { 18442, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - { 18471, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ - { 18499, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - { 18537, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 18581, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 18624, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 18658, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 18697, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 18734, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 18772, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 18815, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 18858, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - { 18888, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - { 18919, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 18955, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 18991, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ - { 19021, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - { 19055, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ - { 19088, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ - { 19117, 0x00008D57 }, /* GL_MAX_SAMPLES */ - { 19132, 0x00008504 }, /* GL_MAX_SHININESS_NV */ - { 19152, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ - { 19176, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ - { 19198, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ - { 19224, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - { 19251, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ - { 19282, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ - { 19306, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - { 19340, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ - { 19360, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ - { 19387, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ - { 19408, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ - { 19433, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ - { 19458, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ - { 19493, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ - { 19515, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ - { 19541, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ - { 19563, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ - { 19589, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - { 19623, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ - { 19661, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - { 19694, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ - { 19731, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ - { 19755, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ - { 19776, 0x00008007 }, /* GL_MIN */ - { 19783, 0x0000802E }, /* GL_MINMAX */ - { 19793, 0x0000802E }, /* GL_MINMAX_EXT */ - { 19807, 0x0000802F }, /* GL_MINMAX_FORMAT */ - { 19824, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ - { 19845, 0x00008030 }, /* GL_MINMAX_SINK */ - { 19860, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ - { 19879, 0x00008007 }, /* GL_MIN_EXT */ - { 19890, 0x00008370 }, /* GL_MIRRORED_REPEAT */ - { 19909, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ - { 19932, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ - { 19955, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ - { 19975, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ - { 19995, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - { 20025, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ - { 20053, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - { 20081, 0x00001700 }, /* GL_MODELVIEW */ - { 20094, 0x00001700 }, /* GL_MODELVIEW0_ARB */ - { 20112, 0x0000872A }, /* GL_MODELVIEW10_ARB */ - { 20131, 0x0000872B }, /* GL_MODELVIEW11_ARB */ - { 20150, 0x0000872C }, /* GL_MODELVIEW12_ARB */ - { 20169, 0x0000872D }, /* GL_MODELVIEW13_ARB */ - { 20188, 0x0000872E }, /* GL_MODELVIEW14_ARB */ - { 20207, 0x0000872F }, /* GL_MODELVIEW15_ARB */ - { 20226, 0x00008730 }, /* GL_MODELVIEW16_ARB */ - { 20245, 0x00008731 }, /* GL_MODELVIEW17_ARB */ - { 20264, 0x00008732 }, /* GL_MODELVIEW18_ARB */ - { 20283, 0x00008733 }, /* GL_MODELVIEW19_ARB */ - { 20302, 0x0000850A }, /* GL_MODELVIEW1_ARB */ - { 20320, 0x00008734 }, /* GL_MODELVIEW20_ARB */ - { 20339, 0x00008735 }, /* GL_MODELVIEW21_ARB */ - { 20358, 0x00008736 }, /* GL_MODELVIEW22_ARB */ - { 20377, 0x00008737 }, /* GL_MODELVIEW23_ARB */ - { 20396, 0x00008738 }, /* GL_MODELVIEW24_ARB */ - { 20415, 0x00008739 }, /* GL_MODELVIEW25_ARB */ - { 20434, 0x0000873A }, /* GL_MODELVIEW26_ARB */ - { 20453, 0x0000873B }, /* GL_MODELVIEW27_ARB */ - { 20472, 0x0000873C }, /* GL_MODELVIEW28_ARB */ - { 20491, 0x0000873D }, /* GL_MODELVIEW29_ARB */ - { 20510, 0x00008722 }, /* GL_MODELVIEW2_ARB */ - { 20528, 0x0000873E }, /* GL_MODELVIEW30_ARB */ - { 20547, 0x0000873F }, /* GL_MODELVIEW31_ARB */ - { 20566, 0x00008723 }, /* GL_MODELVIEW3_ARB */ - { 20584, 0x00008724 }, /* GL_MODELVIEW4_ARB */ - { 20602, 0x00008725 }, /* GL_MODELVIEW5_ARB */ - { 20620, 0x00008726 }, /* GL_MODELVIEW6_ARB */ - { 20638, 0x00008727 }, /* GL_MODELVIEW7_ARB */ - { 20656, 0x00008728 }, /* GL_MODELVIEW8_ARB */ - { 20674, 0x00008729 }, /* GL_MODELVIEW9_ARB */ - { 20692, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ - { 20712, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ - { 20739, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ - { 20764, 0x00002100 }, /* GL_MODULATE */ - { 20776, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ - { 20796, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ - { 20823, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ - { 20848, 0x00000103 }, /* GL_MULT */ - { 20856, 0x0000809D }, /* GL_MULTISAMPLE */ - { 20871, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ - { 20891, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ - { 20910, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ - { 20929, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ - { 20953, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ - { 20976, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - { 21006, 0x00002A25 }, /* GL_N3F_V3F */ - { 21017, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ - { 21037, 0x0000150E }, /* GL_NAND */ - { 21045, 0x00002600 }, /* GL_NEAREST */ - { 21056, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - { 21087, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - { 21119, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ - { 21144, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ - { 21170, 0x00000200 }, /* GL_NEVER */ - { 21179, 0x00001102 }, /* GL_NICEST */ - { 21189, 0x00000000 }, /* GL_NONE */ - { 21197, 0x00001505 }, /* GL_NOOP */ - { 21205, 0x00001508 }, /* GL_NOR */ - { 21212, 0x00000BA1 }, /* GL_NORMALIZE */ - { 21225, 0x00008075 }, /* GL_NORMAL_ARRAY */ - { 21241, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - { 21272, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ - { 21307, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ - { 21331, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ - { 21354, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ - { 21375, 0x00008511 }, /* GL_NORMAL_MAP */ - { 21389, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ - { 21407, 0x00008511 }, /* GL_NORMAL_MAP_NV */ - { 21424, 0x00000205 }, /* GL_NOTEQUAL */ - { 21436, 0x00000000 }, /* GL_NO_ERROR */ - { 21448, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - { 21482, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ - { 21520, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ - { 21552, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ - { 21594, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ - { 21624, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ - { 21664, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ - { 21695, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ - { 21724, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ - { 21752, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ - { 21782, 0x00002401 }, /* GL_OBJECT_LINEAR */ - { 21799, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ - { 21825, 0x00002501 }, /* GL_OBJECT_PLANE */ - { 21841, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ - { 21876, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ - { 21898, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ - { 21917, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ - { 21947, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ - { 21968, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ - { 21996, 0x00000001 }, /* GL_ONE */ - { 22003, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ - { 22031, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ - { 22063, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ - { 22091, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ - { 22123, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ - { 22146, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ - { 22169, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ - { 22192, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ - { 22215, 0x00008598 }, /* GL_OPERAND0_ALPHA */ - { 22233, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ - { 22255, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ - { 22277, 0x00008590 }, /* GL_OPERAND0_RGB */ - { 22293, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ - { 22313, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ - { 22333, 0x00008599 }, /* GL_OPERAND1_ALPHA */ - { 22351, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ - { 22373, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ - { 22395, 0x00008591 }, /* GL_OPERAND1_RGB */ - { 22411, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ - { 22431, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ - { 22451, 0x0000859A }, /* GL_OPERAND2_ALPHA */ - { 22469, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ - { 22491, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ - { 22513, 0x00008592 }, /* GL_OPERAND2_RGB */ - { 22529, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ - { 22549, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ - { 22569, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ - { 22590, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ - { 22609, 0x00001507 }, /* GL_OR */ - { 22615, 0x00000A01 }, /* GL_ORDER */ - { 22624, 0x0000150D }, /* GL_OR_INVERTED */ - { 22639, 0x0000150B }, /* GL_OR_REVERSE */ - { 22653, 0x00000505 }, /* GL_OUT_OF_MEMORY */ - { 22670, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ - { 22688, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ - { 22709, 0x00008758 }, /* GL_PACK_INVERT_MESA */ - { 22729, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ - { 22747, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ - { 22766, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ - { 22786, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ - { 22806, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ - { 22824, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ - { 22843, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ - { 22868, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ - { 22892, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ - { 22913, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ - { 22935, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ - { 22957, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ - { 22982, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ - { 23006, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ - { 23027, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ - { 23049, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ - { 23071, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ - { 23093, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ - { 23124, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ - { 23144, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - { 23169, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ - { 23189, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - { 23214, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ - { 23234, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - { 23259, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ - { 23279, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - { 23304, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ - { 23324, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - { 23349, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ - { 23369, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - { 23394, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ - { 23414, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - { 23439, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ - { 23459, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - { 23484, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ - { 23504, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - { 23529, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ - { 23549, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - { 23574, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ - { 23592, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ - { 23613, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ - { 23642, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ - { 23675, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ - { 23700, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ - { 23723, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ - { 23754, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ - { 23789, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ - { 23816, 0x00001B00 }, /* GL_POINT */ - { 23825, 0x00000000 }, /* GL_POINTS */ - { 23835, 0x00000002 }, /* GL_POINT_BIT */ - { 23848, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ - { 23878, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ - { 23912, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ - { 23946, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ - { 23981, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ - { 24010, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ - { 24043, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ - { 24076, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ - { 24110, 0x00000B11 }, /* GL_POINT_SIZE */ - { 24124, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ - { 24150, 0x00008127 }, /* GL_POINT_SIZE_MAX */ - { 24168, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ - { 24190, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ - { 24212, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ - { 24235, 0x00008126 }, /* GL_POINT_SIZE_MIN */ - { 24253, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ - { 24275, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ - { 24297, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ - { 24320, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ - { 24340, 0x00000B10 }, /* GL_POINT_SMOOTH */ - { 24356, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ - { 24377, 0x00008861 }, /* GL_POINT_SPRITE */ - { 24393, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ - { 24413, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ - { 24442, 0x00008861 }, /* GL_POINT_SPRITE_NV */ - { 24461, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ - { 24487, 0x00000701 }, /* GL_POINT_TOKEN */ - { 24502, 0x00000009 }, /* GL_POLYGON */ - { 24513, 0x00000008 }, /* GL_POLYGON_BIT */ - { 24528, 0x00000B40 }, /* GL_POLYGON_MODE */ - { 24544, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ - { 24567, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ - { 24592, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ - { 24615, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ - { 24638, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ - { 24662, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ - { 24686, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ - { 24704, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ - { 24727, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ - { 24746, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ - { 24769, 0x00000703 }, /* GL_POLYGON_TOKEN */ - { 24786, 0x00001203 }, /* GL_POSITION */ - { 24798, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - { 24830, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ - { 24866, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - { 24899, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ - { 24936, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - { 24967, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ - { 25002, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - { 25034, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ - { 25070, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - { 25103, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - { 25135, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ - { 25171, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - { 25204, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ - { 25241, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - { 25271, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ - { 25305, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - { 25336, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ - { 25371, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - { 25402, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ - { 25437, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - { 25469, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ - { 25505, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - { 25535, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ - { 25569, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - { 25600, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ - { 25635, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - { 25667, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - { 25698, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ - { 25733, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - { 25765, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ - { 25801, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ - { 25830, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ - { 25863, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ - { 25893, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ - { 25927, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - { 25966, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - { 25999, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - { 26039, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - { 26073, 0x00008578 }, /* GL_PREVIOUS */ - { 26085, 0x00008578 }, /* GL_PREVIOUS_ARB */ - { 26101, 0x00008578 }, /* GL_PREVIOUS_EXT */ - { 26117, 0x00008577 }, /* GL_PRIMARY_COLOR */ - { 26134, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ - { 26155, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ - { 26176, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 26209, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 26241, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ - { 26264, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ - { 26287, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ - { 26317, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ - { 26346, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ - { 26374, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ - { 26396, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - { 26424, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - { 26452, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ - { 26474, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ - { 26495, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 26535, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 26574, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 26604, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 26639, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 26672, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 26706, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 26745, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 26784, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ - { 26806, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ - { 26832, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ - { 26856, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ - { 26879, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ - { 26901, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ - { 26922, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ - { 26943, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ - { 26970, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 27002, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 27034, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - { 27069, 0x00001701 }, /* GL_PROJECTION */ - { 27083, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ - { 27104, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ - { 27130, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ - { 27151, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ - { 27170, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ - { 27193, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - { 27232, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - { 27270, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ - { 27290, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - { 27320, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ - { 27344, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ - { 27364, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - { 27394, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ - { 27418, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ - { 27438, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - { 27471, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ - { 27497, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ - { 27527, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - { 27558, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ - { 27588, 0x00002003 }, /* GL_Q */ - { 27593, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ - { 27618, 0x00000007 }, /* GL_QUADS */ - { 27627, 0x00008614 }, /* GL_QUAD_MESH_SUN */ - { 27644, 0x00000008 }, /* GL_QUAD_STRIP */ - { 27658, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ - { 27680, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ - { 27706, 0x00008866 }, /* GL_QUERY_RESULT */ - { 27722, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ - { 27742, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ - { 27768, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ - { 27798, 0x00002002 }, /* GL_R */ - { 27803, 0x00002A10 }, /* GL_R3_G3_B2 */ - { 27815, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - { 27848, 0x00000C02 }, /* GL_READ_BUFFER */ - { 27863, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ - { 27883, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - { 27915, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ - { 27939, 0x000088B8 }, /* GL_READ_ONLY */ - { 27952, 0x000088B8 }, /* GL_READ_ONLY_ARB */ - { 27969, 0x000088BA }, /* GL_READ_WRITE */ - { 27983, 0x000088BA }, /* GL_READ_WRITE_ARB */ - { 28001, 0x00001903 }, /* GL_RED */ - { 28008, 0x00008016 }, /* GL_REDUCE */ - { 28018, 0x00008016 }, /* GL_REDUCE_EXT */ - { 28032, 0x00000D15 }, /* GL_RED_BIAS */ - { 28044, 0x00000D52 }, /* GL_RED_BITS */ - { 28056, 0x00000D14 }, /* GL_RED_SCALE */ - { 28069, 0x00008512 }, /* GL_REFLECTION_MAP */ - { 28087, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ - { 28109, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ - { 28130, 0x00001C00 }, /* GL_RENDER */ - { 28140, 0x00008D41 }, /* GL_RENDERBUFFER */ - { 28156, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ - { 28183, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ - { 28211, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ - { 28237, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ - { 28264, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ - { 28284, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ - { 28311, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ - { 28334, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ - { 28361, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - { 28393, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ - { 28429, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ - { 28454, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ - { 28478, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ - { 28507, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ - { 28529, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ - { 28555, 0x00001F01 }, /* GL_RENDERER */ - { 28567, 0x00000C40 }, /* GL_RENDER_MODE */ - { 28582, 0x00002901 }, /* GL_REPEAT */ - { 28592, 0x00001E01 }, /* GL_REPLACE */ - { 28603, 0x00008062 }, /* GL_REPLACE_EXT */ - { 28618, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ - { 28641, 0x0000803A }, /* GL_RESCALE_NORMAL */ - { 28659, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ - { 28681, 0x00000102 }, /* GL_RETURN */ - { 28691, 0x00001907 }, /* GL_RGB */ - { 28698, 0x00008052 }, /* GL_RGB10 */ - { 28707, 0x00008059 }, /* GL_RGB10_A2 */ - { 28719, 0x00008059 }, /* GL_RGB10_A2_EXT */ - { 28735, 0x00008052 }, /* GL_RGB10_EXT */ - { 28748, 0x00008053 }, /* GL_RGB12 */ - { 28757, 0x00008053 }, /* GL_RGB12_EXT */ - { 28770, 0x00008054 }, /* GL_RGB16 */ - { 28779, 0x00008054 }, /* GL_RGB16_EXT */ - { 28792, 0x0000804E }, /* GL_RGB2_EXT */ - { 28804, 0x0000804F }, /* GL_RGB4 */ - { 28812, 0x0000804F }, /* GL_RGB4_EXT */ - { 28824, 0x000083A1 }, /* GL_RGB4_S3TC */ - { 28837, 0x00008050 }, /* GL_RGB5 */ - { 28845, 0x00008057 }, /* GL_RGB5_A1 */ - { 28856, 0x00008057 }, /* GL_RGB5_A1_EXT */ - { 28871, 0x00008050 }, /* GL_RGB5_EXT */ - { 28883, 0x00008051 }, /* GL_RGB8 */ - { 28891, 0x00008051 }, /* GL_RGB8_EXT */ - { 28903, 0x00001908 }, /* GL_RGBA */ - { 28911, 0x0000805A }, /* GL_RGBA12 */ - { 28921, 0x0000805A }, /* GL_RGBA12_EXT */ - { 28935, 0x0000805B }, /* GL_RGBA16 */ - { 28945, 0x0000805B }, /* GL_RGBA16_EXT */ - { 28959, 0x00008055 }, /* GL_RGBA2 */ - { 28968, 0x00008055 }, /* GL_RGBA2_EXT */ - { 28981, 0x00008056 }, /* GL_RGBA4 */ - { 28990, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ - { 29009, 0x00008056 }, /* GL_RGBA4_EXT */ - { 29022, 0x000083A3 }, /* GL_RGBA4_S3TC */ - { 29036, 0x00008058 }, /* GL_RGBA8 */ - { 29045, 0x00008058 }, /* GL_RGBA8_EXT */ - { 29058, 0x00008F97 }, /* GL_RGBA8_SNORM */ - { 29073, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ - { 29091, 0x00000C31 }, /* GL_RGBA_MODE */ - { 29104, 0x000083A2 }, /* GL_RGBA_S3TC */ - { 29117, 0x00008F93 }, /* GL_RGBA_SNORM */ - { 29131, 0x000083A0 }, /* GL_RGB_S3TC */ - { 29143, 0x00008573 }, /* GL_RGB_SCALE */ - { 29156, 0x00008573 }, /* GL_RGB_SCALE_ARB */ - { 29173, 0x00008573 }, /* GL_RGB_SCALE_EXT */ - { 29190, 0x00000407 }, /* GL_RIGHT */ - { 29199, 0x00002000 }, /* GL_S */ - { 29204, 0x00008B5D }, /* GL_SAMPLER_1D */ - { 29218, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ - { 29239, 0x00008B5E }, /* GL_SAMPLER_2D */ - { 29253, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ - { 29274, 0x00008B5F }, /* GL_SAMPLER_3D */ - { 29288, 0x00008B60 }, /* GL_SAMPLER_CUBE */ - { 29304, 0x000080A9 }, /* GL_SAMPLES */ - { 29315, 0x000086B4 }, /* GL_SAMPLES_3DFX */ - { 29331, 0x000080A9 }, /* GL_SAMPLES_ARB */ - { 29346, 0x00008914 }, /* GL_SAMPLES_PASSED */ - { 29364, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ - { 29386, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - { 29414, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ - { 29446, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ - { 29469, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ - { 29496, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ - { 29514, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ - { 29537, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ - { 29559, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ - { 29578, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ - { 29601, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ - { 29627, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ - { 29657, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ - { 29682, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ - { 29711, 0x00080000 }, /* GL_SCISSOR_BIT */ - { 29726, 0x00000C10 }, /* GL_SCISSOR_BOX */ - { 29741, 0x00000C11 }, /* GL_SCISSOR_TEST */ - { 29757, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ - { 29782, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - { 29822, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 29866, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - { 29899, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - { 29929, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - { 29961, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - { 29991, 0x00001C02 }, /* GL_SELECT */ - { 30001, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ - { 30029, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ - { 30054, 0x00008012 }, /* GL_SEPARABLE_2D */ - { 30070, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ - { 30097, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ - { 30128, 0x0000150F }, /* GL_SET */ - { 30135, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ - { 30156, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ - { 30180, 0x00008B4F }, /* GL_SHADER_TYPE */ - { 30195, 0x00000B54 }, /* GL_SHADE_MODEL */ - { 30210, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ - { 30238, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ - { 30261, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - { 30291, 0x00001601 }, /* GL_SHININESS */ - { 30304, 0x00001402 }, /* GL_SHORT */ - { 30313, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ - { 30334, 0x000081F9 }, /* GL_SINGLE_COLOR */ - { 30350, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ - { 30370, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ - { 30389, 0x00008C46 }, /* GL_SLUMINANCE */ - { 30403, 0x00008C47 }, /* GL_SLUMINANCE8 */ - { 30418, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ - { 30440, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ - { 30460, 0x00001D01 }, /* GL_SMOOTH */ - { 30470, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ - { 30503, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ - { 30530, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ - { 30563, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ - { 30590, 0x00008588 }, /* GL_SOURCE0_ALPHA */ - { 30607, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ - { 30628, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ - { 30649, 0x00008580 }, /* GL_SOURCE0_RGB */ - { 30664, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ - { 30683, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ - { 30702, 0x00008589 }, /* GL_SOURCE1_ALPHA */ - { 30719, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ - { 30740, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ - { 30761, 0x00008581 }, /* GL_SOURCE1_RGB */ - { 30776, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ - { 30795, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ - { 30814, 0x0000858A }, /* GL_SOURCE2_ALPHA */ - { 30831, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ - { 30852, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ - { 30873, 0x00008582 }, /* GL_SOURCE2_RGB */ - { 30888, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ - { 30907, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ - { 30926, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ - { 30946, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ - { 30964, 0x00001202 }, /* GL_SPECULAR */ - { 30976, 0x00002402 }, /* GL_SPHERE_MAP */ - { 30990, 0x00001206 }, /* GL_SPOT_CUTOFF */ - { 31005, 0x00001204 }, /* GL_SPOT_DIRECTION */ - { 31023, 0x00001205 }, /* GL_SPOT_EXPONENT */ - { 31040, 0x00008588 }, /* GL_SRC0_ALPHA */ - { 31054, 0x00008580 }, /* GL_SRC0_RGB */ - { 31066, 0x00008589 }, /* GL_SRC1_ALPHA */ - { 31080, 0x00008581 }, /* GL_SRC1_RGB */ - { 31092, 0x0000858A }, /* GL_SRC2_ALPHA */ - { 31106, 0x00008582 }, /* GL_SRC2_RGB */ - { 31118, 0x00000302 }, /* GL_SRC_ALPHA */ - { 31131, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ - { 31153, 0x00000300 }, /* GL_SRC_COLOR */ - { 31166, 0x00008C40 }, /* GL_SRGB */ - { 31174, 0x00008C41 }, /* GL_SRGB8 */ - { 31183, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ - { 31199, 0x00008C42 }, /* GL_SRGB_ALPHA */ - { 31213, 0x00000503 }, /* GL_STACK_OVERFLOW */ - { 31231, 0x00000504 }, /* GL_STACK_UNDERFLOW */ - { 31250, 0x000088E6 }, /* GL_STATIC_COPY */ - { 31265, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ - { 31284, 0x000088E4 }, /* GL_STATIC_DRAW */ - { 31299, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ - { 31318, 0x000088E5 }, /* GL_STATIC_READ */ - { 31333, 0x000088E5 }, /* GL_STATIC_READ_ARB */ - { 31352, 0x00001802 }, /* GL_STENCIL */ - { 31363, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ - { 31385, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ - { 31411, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ - { 31432, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ - { 31457, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ - { 31478, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ - { 31503, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - { 31535, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ - { 31571, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - { 31603, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ - { 31639, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ - { 31659, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ - { 31686, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ - { 31712, 0x00000D57 }, /* GL_STENCIL_BITS */ - { 31728, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ - { 31750, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ - { 31773, 0x00000B94 }, /* GL_STENCIL_FAIL */ - { 31789, 0x00000B92 }, /* GL_STENCIL_FUNC */ - { 31805, 0x00001901 }, /* GL_STENCIL_INDEX */ - { 31822, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ - { 31845, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ - { 31867, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ - { 31889, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ - { 31911, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ - { 31932, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ - { 31959, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ - { 31986, 0x00000B97 }, /* GL_STENCIL_REF */ - { 32001, 0x00000B90 }, /* GL_STENCIL_TEST */ - { 32017, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - { 32046, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ - { 32068, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ - { 32089, 0x00000C33 }, /* GL_STEREO */ - { 32099, 0x000088E2 }, /* GL_STREAM_COPY */ - { 32114, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ - { 32133, 0x000088E0 }, /* GL_STREAM_DRAW */ - { 32148, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ - { 32167, 0x000088E1 }, /* GL_STREAM_READ */ - { 32182, 0x000088E1 }, /* GL_STREAM_READ_ARB */ - { 32201, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ - { 32218, 0x000084E7 }, /* GL_SUBTRACT */ - { 32230, 0x000084E7 }, /* GL_SUBTRACT_ARB */ - { 32246, 0x00002001 }, /* GL_T */ - { 32251, 0x00002A2A }, /* GL_T2F_C3F_V3F */ - { 32266, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ - { 32285, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ - { 32301, 0x00002A2B }, /* GL_T2F_N3F_V3F */ - { 32316, 0x00002A27 }, /* GL_T2F_V3F */ - { 32327, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ - { 32346, 0x00002A28 }, /* GL_T4F_V4F */ - { 32357, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ - { 32380, 0x00001702 }, /* GL_TEXTURE */ - { 32391, 0x000084C0 }, /* GL_TEXTURE0 */ - { 32403, 0x000084C0 }, /* GL_TEXTURE0_ARB */ - { 32419, 0x000084C1 }, /* GL_TEXTURE1 */ - { 32431, 0x000084CA }, /* GL_TEXTURE10 */ - { 32444, 0x000084CA }, /* GL_TEXTURE10_ARB */ - { 32461, 0x000084CB }, /* GL_TEXTURE11 */ - { 32474, 0x000084CB }, /* GL_TEXTURE11_ARB */ - { 32491, 0x000084CC }, /* GL_TEXTURE12 */ - { 32504, 0x000084CC }, /* GL_TEXTURE12_ARB */ - { 32521, 0x000084CD }, /* GL_TEXTURE13 */ - { 32534, 0x000084CD }, /* GL_TEXTURE13_ARB */ - { 32551, 0x000084CE }, /* GL_TEXTURE14 */ - { 32564, 0x000084CE }, /* GL_TEXTURE14_ARB */ - { 32581, 0x000084CF }, /* GL_TEXTURE15 */ - { 32594, 0x000084CF }, /* GL_TEXTURE15_ARB */ - { 32611, 0x000084D0 }, /* GL_TEXTURE16 */ - { 32624, 0x000084D0 }, /* GL_TEXTURE16_ARB */ - { 32641, 0x000084D1 }, /* GL_TEXTURE17 */ - { 32654, 0x000084D1 }, /* GL_TEXTURE17_ARB */ - { 32671, 0x000084D2 }, /* GL_TEXTURE18 */ - { 32684, 0x000084D2 }, /* GL_TEXTURE18_ARB */ - { 32701, 0x000084D3 }, /* GL_TEXTURE19 */ - { 32714, 0x000084D3 }, /* GL_TEXTURE19_ARB */ - { 32731, 0x000084C1 }, /* GL_TEXTURE1_ARB */ - { 32747, 0x000084C2 }, /* GL_TEXTURE2 */ - { 32759, 0x000084D4 }, /* GL_TEXTURE20 */ - { 32772, 0x000084D4 }, /* GL_TEXTURE20_ARB */ - { 32789, 0x000084D5 }, /* GL_TEXTURE21 */ - { 32802, 0x000084D5 }, /* GL_TEXTURE21_ARB */ - { 32819, 0x000084D6 }, /* GL_TEXTURE22 */ - { 32832, 0x000084D6 }, /* GL_TEXTURE22_ARB */ - { 32849, 0x000084D7 }, /* GL_TEXTURE23 */ - { 32862, 0x000084D7 }, /* GL_TEXTURE23_ARB */ - { 32879, 0x000084D8 }, /* GL_TEXTURE24 */ - { 32892, 0x000084D8 }, /* GL_TEXTURE24_ARB */ - { 32909, 0x000084D9 }, /* GL_TEXTURE25 */ - { 32922, 0x000084D9 }, /* GL_TEXTURE25_ARB */ - { 32939, 0x000084DA }, /* GL_TEXTURE26 */ - { 32952, 0x000084DA }, /* GL_TEXTURE26_ARB */ - { 32969, 0x000084DB }, /* GL_TEXTURE27 */ - { 32982, 0x000084DB }, /* GL_TEXTURE27_ARB */ - { 32999, 0x000084DC }, /* GL_TEXTURE28 */ - { 33012, 0x000084DC }, /* GL_TEXTURE28_ARB */ - { 33029, 0x000084DD }, /* GL_TEXTURE29 */ - { 33042, 0x000084DD }, /* GL_TEXTURE29_ARB */ - { 33059, 0x000084C2 }, /* GL_TEXTURE2_ARB */ - { 33075, 0x000084C3 }, /* GL_TEXTURE3 */ - { 33087, 0x000084DE }, /* GL_TEXTURE30 */ - { 33100, 0x000084DE }, /* GL_TEXTURE30_ARB */ - { 33117, 0x000084DF }, /* GL_TEXTURE31 */ - { 33130, 0x000084DF }, /* GL_TEXTURE31_ARB */ - { 33147, 0x000084C3 }, /* GL_TEXTURE3_ARB */ - { 33163, 0x000084C4 }, /* GL_TEXTURE4 */ - { 33175, 0x000084C4 }, /* GL_TEXTURE4_ARB */ - { 33191, 0x000084C5 }, /* GL_TEXTURE5 */ - { 33203, 0x000084C5 }, /* GL_TEXTURE5_ARB */ - { 33219, 0x000084C6 }, /* GL_TEXTURE6 */ - { 33231, 0x000084C6 }, /* GL_TEXTURE6_ARB */ - { 33247, 0x000084C7 }, /* GL_TEXTURE7 */ - { 33259, 0x000084C7 }, /* GL_TEXTURE7_ARB */ - { 33275, 0x000084C8 }, /* GL_TEXTURE8 */ - { 33287, 0x000084C8 }, /* GL_TEXTURE8_ARB */ - { 33303, 0x000084C9 }, /* GL_TEXTURE9 */ - { 33315, 0x000084C9 }, /* GL_TEXTURE9_ARB */ - { 33331, 0x00000DE0 }, /* GL_TEXTURE_1D */ - { 33345, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ - { 33369, 0x00000DE1 }, /* GL_TEXTURE_2D */ - { 33383, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ - { 33407, 0x0000806F }, /* GL_TEXTURE_3D */ - { 33421, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ - { 33443, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ - { 33469, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ - { 33491, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ - { 33513, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - { 33545, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ - { 33567, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - { 33599, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ - { 33621, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ - { 33649, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ - { 33681, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - { 33714, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ - { 33746, 0x00040000 }, /* GL_TEXTURE_BIT */ - { 33761, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ - { 33782, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ - { 33807, 0x00001005 }, /* GL_TEXTURE_BORDER */ - { 33825, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ - { 33849, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - { 33880, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - { 33910, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - { 33940, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - { 33975, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - { 34006, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 34044, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ - { 34071, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - { 34103, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - { 34137, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ - { 34161, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ - { 34189, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ - { 34213, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ - { 34241, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - { 34274, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ - { 34298, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ - { 34320, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ - { 34342, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ - { 34368, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ - { 34402, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - { 34435, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ - { 34472, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ - { 34500, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ - { 34532, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ - { 34555, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - { 34593, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ - { 34635, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - { 34666, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - { 34694, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - { 34724, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - { 34752, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ - { 34772, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ - { 34796, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - { 34827, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ - { 34862, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - { 34893, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ - { 34928, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - { 34959, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ - { 34994, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - { 35025, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ - { 35060, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - { 35091, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ - { 35126, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - { 35157, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ - { 35192, 0x00008071 }, /* GL_TEXTURE_DEPTH */ - { 35209, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ - { 35231, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ - { 35257, 0x00002300 }, /* GL_TEXTURE_ENV */ - { 35272, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ - { 35293, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ - { 35313, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ - { 35339, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ - { 35359, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ - { 35376, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ - { 35393, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ - { 35410, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ - { 35427, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ - { 35452, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ - { 35474, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ - { 35500, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ - { 35518, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ - { 35544, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ - { 35570, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ - { 35600, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ - { 35627, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ - { 35652, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ - { 35672, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ - { 35696, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - { 35723, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - { 35750, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - { 35777, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ - { 35803, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ - { 35833, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ - { 35855, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ - { 35873, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - { 35903, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - { 35931, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - { 35959, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - { 35987, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ - { 36008, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ - { 36027, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ - { 36049, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ - { 36068, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ - { 36088, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ - { 36113, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ - { 36137, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ - { 36157, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ - { 36181, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ - { 36201, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ - { 36224, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ - { 36248, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ - { 36273, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - { 36307, 0x00001000 }, /* GL_TEXTURE_WIDTH */ - { 36324, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ - { 36342, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ - { 36360, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ - { 36378, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ - { 36398, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ - { 36417, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - { 36446, 0x00001000 }, /* GL_TRANSFORM_BIT */ - { 36463, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ - { 36489, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ - { 36519, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - { 36551, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - { 36581, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ - { 36615, 0x0000862C }, /* GL_TRANSPOSE_NV */ - { 36631, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - { 36662, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ - { 36697, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - { 36725, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ - { 36757, 0x00000004 }, /* GL_TRIANGLES */ - { 36770, 0x00000006 }, /* GL_TRIANGLE_FAN */ - { 36786, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ - { 36807, 0x00000005 }, /* GL_TRIANGLE_STRIP */ - { 36825, 0x00000001 }, /* GL_TRUE */ - { 36833, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ - { 36853, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ - { 36876, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ - { 36896, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ - { 36917, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ - { 36939, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ - { 36961, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ - { 36981, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ - { 37002, 0x00001401 }, /* GL_UNSIGNED_BYTE */ - { 37019, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - { 37046, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ - { 37069, 0x00001405 }, /* GL_UNSIGNED_INT */ - { 37085, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ - { 37112, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ - { 37133, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ - { 37157, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - { 37188, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ - { 37212, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - { 37240, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ - { 37263, 0x00001403 }, /* GL_UNSIGNED_SHORT */ - { 37281, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - { 37311, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - { 37337, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - { 37367, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - { 37393, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ - { 37417, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - { 37445, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - { 37473, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ - { 37500, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - { 37532, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ - { 37563, 0x00008CA2 }, /* GL_UPPER_LEFT */ - { 37577, 0x00002A20 }, /* GL_V2F */ - { 37584, 0x00002A21 }, /* GL_V3F */ - { 37591, 0x00008B83 }, /* GL_VALIDATE_STATUS */ - { 37610, 0x00001F00 }, /* GL_VENDOR */ - { 37620, 0x00001F02 }, /* GL_VERSION */ - { 37631, 0x00008074 }, /* GL_VERTEX_ARRAY */ - { 37647, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - { 37677, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - { 37708, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ - { 37743, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ - { 37767, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ - { 37788, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ - { 37811, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ - { 37832, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - { 37859, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - { 37887, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - { 37915, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - { 37943, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - { 37971, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - { 37999, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - { 38027, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - { 38054, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - { 38081, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - { 38108, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - { 38135, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - { 38162, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - { 38189, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - { 38216, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - { 38243, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - { 38270, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - { 38308, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ - { 38350, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - { 38381, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ - { 38416, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - { 38450, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ - { 38488, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - { 38519, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ - { 38554, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - { 38582, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ - { 38614, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - { 38644, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ - { 38678, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - { 38706, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ - { 38738, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ - { 38758, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ - { 38780, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ - { 38809, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ - { 38830, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - { 38859, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ - { 38892, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - { 38924, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - { 38951, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ - { 38982, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - { 39012, 0x00008B31 }, /* GL_VERTEX_SHADER */ - { 39029, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ - { 39050, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ - { 39077, 0x00000BA2 }, /* GL_VIEWPORT */ - { 39089, 0x00000800 }, /* GL_VIEWPORT_BIT */ - { 39105, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ - { 39125, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - { 39156, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ - { 39191, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - { 39219, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - { 39244, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - { 39271, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - { 39296, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ - { 39320, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ - { 39339, 0x000088B9 }, /* GL_WRITE_ONLY */ - { 39353, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ - { 39371, 0x00001506 }, /* GL_XOR */ - { 39378, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ - { 39397, 0x00008757 }, /* GL_YCBCR_MESA */ - { 39411, 0x00000000 }, /* GL_ZERO */ - { 39419, 0x00000D16 }, /* GL_ZOOM_X */ - { 39429, 0x00000D17 }, /* GL_ZOOM_Y */ + { 9603, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */ + { 9634, 0x00001D00 }, /* GL_FLAT */ + { 9642, 0x00001406 }, /* GL_FLOAT */ + { 9651, 0x00008B5A }, /* GL_FLOAT_MAT2 */ + { 9665, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ + { 9683, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ + { 9699, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ + { 9715, 0x00008B5B }, /* GL_FLOAT_MAT3 */ + { 9729, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ + { 9747, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ + { 9763, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ + { 9779, 0x00008B5C }, /* GL_FLOAT_MAT4 */ + { 9793, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ + { 9811, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ + { 9827, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ + { 9843, 0x00008B50 }, /* GL_FLOAT_VEC2 */ + { 9857, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ + { 9875, 0x00008B51 }, /* GL_FLOAT_VEC3 */ + { 9889, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ + { 9907, 0x00008B52 }, /* GL_FLOAT_VEC4 */ + { 9921, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ + { 9939, 0x00000B60 }, /* GL_FOG */ + { 9946, 0x00000080 }, /* GL_FOG_BIT */ + { 9957, 0x00000B66 }, /* GL_FOG_COLOR */ + { 9970, 0x00008451 }, /* GL_FOG_COORD */ + { 9983, 0x00008451 }, /* GL_FOG_COORDINATE */ + { 10001, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ + { 10025, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + { 10064, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ + { 10107, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + { 10139, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + { 10170, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + { 10199, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ + { 10224, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ + { 10243, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ + { 10277, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ + { 10304, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ + { 10330, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ + { 10354, 0x00008450 }, /* GL_FOG_COORD_SRC */ + { 10371, 0x00000B62 }, /* GL_FOG_DENSITY */ + { 10386, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ + { 10410, 0x00000B64 }, /* GL_FOG_END */ + { 10421, 0x00000C54 }, /* GL_FOG_HINT */ + { 10433, 0x00000B61 }, /* GL_FOG_INDEX */ + { 10446, 0x00000B65 }, /* GL_FOG_MODE */ + { 10458, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ + { 10477, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ + { 10502, 0x00000B63 }, /* GL_FOG_START */ + { 10515, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ + { 10533, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ + { 10557, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ + { 10576, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ + { 10599, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + { 10634, 0x00008D40 }, /* GL_FRAMEBUFFER */ + { 10649, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + { 10686, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + { 10722, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + { 10763, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + { 10804, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + { 10841, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + { 10878, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + { 10916, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ + { 10958, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + { 10996, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ + { 11038, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + { 11073, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + { 11112, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ + { 11161, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + { 11209, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ + { 11261, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + { 11301, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ + { 11345, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + { 11385, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ + { 11429, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ + { 11456, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ + { 11480, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ + { 11508, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ + { 11531, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ + { 11550, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + { 11587, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ + { 11628, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + { 11669, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + { 11711, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + { 11762, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + { 11800, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + { 11845, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ + { 11894, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + { 11932, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + { 11974, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + { 12006, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ + { 12031, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ + { 12058, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ + { 12089, 0x00000404 }, /* GL_FRONT */ + { 12098, 0x00000408 }, /* GL_FRONT_AND_BACK */ + { 12116, 0x00000B46 }, /* GL_FRONT_FACE */ + { 12130, 0x00000400 }, /* GL_FRONT_LEFT */ + { 12144, 0x00000401 }, /* GL_FRONT_RIGHT */ + { 12159, 0x00008006 }, /* GL_FUNC_ADD */ + { 12171, 0x00008006 }, /* GL_FUNC_ADD_EXT */ + { 12187, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ + { 12212, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ + { 12241, 0x0000800A }, /* GL_FUNC_SUBTRACT */ + { 12258, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ + { 12279, 0x00008191 }, /* GL_GENERATE_MIPMAP */ + { 12298, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ + { 12322, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ + { 12351, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ + { 12375, 0x00000206 }, /* GL_GEQUAL */ + { 12385, 0x00000204 }, /* GL_GREATER */ + { 12396, 0x00001904 }, /* GL_GREEN */ + { 12405, 0x00000D19 }, /* GL_GREEN_BIAS */ + { 12419, 0x00000D53 }, /* GL_GREEN_BITS */ + { 12433, 0x00000D18 }, /* GL_GREEN_SCALE */ + { 12448, 0x00008000 }, /* GL_HINT_BIT */ + { 12460, 0x00008024 }, /* GL_HISTOGRAM */ + { 12473, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ + { 12497, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ + { 12525, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ + { 12548, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ + { 12575, 0x00008024 }, /* GL_HISTOGRAM_EXT */ + { 12592, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ + { 12612, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ + { 12636, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ + { 12660, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ + { 12688, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + { 12716, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ + { 12748, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ + { 12770, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ + { 12796, 0x0000802D }, /* GL_HISTOGRAM_SINK */ + { 12814, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ + { 12836, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ + { 12855, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ + { 12878, 0x0000862A }, /* GL_IDENTITY_NV */ + { 12893, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ + { 12913, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + { 12953, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + { 12991, 0x00001E02 }, /* GL_INCR */ + { 12999, 0x00008507 }, /* GL_INCR_WRAP */ + { 13012, 0x00008507 }, /* GL_INCR_WRAP_EXT */ + { 13029, 0x00008222 }, /* GL_INDEX */ + { 13038, 0x00008077 }, /* GL_INDEX_ARRAY */ + { 13053, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + { 13083, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ + { 13117, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ + { 13140, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ + { 13162, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ + { 13182, 0x00000D51 }, /* GL_INDEX_BITS */ + { 13196, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ + { 13217, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ + { 13235, 0x00000C30 }, /* GL_INDEX_MODE */ + { 13249, 0x00000D13 }, /* GL_INDEX_OFFSET */ + { 13265, 0x00000D12 }, /* GL_INDEX_SHIFT */ + { 13280, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ + { 13299, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ + { 13318, 0x00001404 }, /* GL_INT */ + { 13325, 0x00008049 }, /* GL_INTENSITY */ + { 13338, 0x0000804C }, /* GL_INTENSITY12 */ + { 13353, 0x0000804C }, /* GL_INTENSITY12_EXT */ + { 13372, 0x0000804D }, /* GL_INTENSITY16 */ + { 13387, 0x0000804D }, /* GL_INTENSITY16_EXT */ + { 13406, 0x0000804A }, /* GL_INTENSITY4 */ + { 13420, 0x0000804A }, /* GL_INTENSITY4_EXT */ + { 13438, 0x0000804B }, /* GL_INTENSITY8 */ + { 13452, 0x0000804B }, /* GL_INTENSITY8_EXT */ + { 13470, 0x00008049 }, /* GL_INTENSITY_EXT */ + { 13487, 0x00008575 }, /* GL_INTERPOLATE */ + { 13502, 0x00008575 }, /* GL_INTERPOLATE_ARB */ + { 13521, 0x00008575 }, /* GL_INTERPOLATE_EXT */ + { 13540, 0x00008B53 }, /* GL_INT_VEC2 */ + { 13552, 0x00008B53 }, /* GL_INT_VEC2_ARB */ + { 13568, 0x00008B54 }, /* GL_INT_VEC3 */ + { 13580, 0x00008B54 }, /* GL_INT_VEC3_ARB */ + { 13596, 0x00008B55 }, /* GL_INT_VEC4 */ + { 13608, 0x00008B55 }, /* GL_INT_VEC4_ARB */ + { 13624, 0x00000500 }, /* GL_INVALID_ENUM */ + { 13640, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + { 13673, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ + { 13710, 0x00000502 }, /* GL_INVALID_OPERATION */ + { 13731, 0x00000501 }, /* GL_INVALID_VALUE */ + { 13748, 0x0000862B }, /* GL_INVERSE_NV */ + { 13762, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ + { 13786, 0x0000150A }, /* GL_INVERT */ + { 13796, 0x00001E00 }, /* GL_KEEP */ + { 13804, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */ + { 13834, 0x00000406 }, /* GL_LEFT */ + { 13842, 0x00000203 }, /* GL_LEQUAL */ + { 13852, 0x00000201 }, /* GL_LESS */ + { 13860, 0x00004000 }, /* GL_LIGHT0 */ + { 13870, 0x00004001 }, /* GL_LIGHT1 */ + { 13880, 0x00004002 }, /* GL_LIGHT2 */ + { 13890, 0x00004003 }, /* GL_LIGHT3 */ + { 13900, 0x00004004 }, /* GL_LIGHT4 */ + { 13910, 0x00004005 }, /* GL_LIGHT5 */ + { 13920, 0x00004006 }, /* GL_LIGHT6 */ + { 13930, 0x00004007 }, /* GL_LIGHT7 */ + { 13940, 0x00000B50 }, /* GL_LIGHTING */ + { 13952, 0x00000040 }, /* GL_LIGHTING_BIT */ + { 13968, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ + { 13991, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + { 14020, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ + { 14053, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + { 14081, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ + { 14105, 0x00001B01 }, /* GL_LINE */ + { 14113, 0x00002601 }, /* GL_LINEAR */ + { 14123, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ + { 14145, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + { 14175, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + { 14206, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ + { 14230, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ + { 14255, 0x00000001 }, /* GL_LINES */ + { 14264, 0x00000004 }, /* GL_LINE_BIT */ + { 14276, 0x00000002 }, /* GL_LINE_LOOP */ + { 14289, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ + { 14309, 0x00000B20 }, /* GL_LINE_SMOOTH */ + { 14324, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ + { 14344, 0x00000B24 }, /* GL_LINE_STIPPLE */ + { 14360, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ + { 14384, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ + { 14407, 0x00000003 }, /* GL_LINE_STRIP */ + { 14421, 0x00000702 }, /* GL_LINE_TOKEN */ + { 14435, 0x00000B21 }, /* GL_LINE_WIDTH */ + { 14449, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ + { 14475, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ + { 14495, 0x00008B82 }, /* GL_LINK_STATUS */ + { 14510, 0x00000B32 }, /* GL_LIST_BASE */ + { 14523, 0x00020000 }, /* GL_LIST_BIT */ + { 14535, 0x00000B33 }, /* GL_LIST_INDEX */ + { 14549, 0x00000B30 }, /* GL_LIST_MODE */ + { 14562, 0x00000101 }, /* GL_LOAD */ + { 14570, 0x00000BF1 }, /* GL_LOGIC_OP */ + { 14582, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ + { 14599, 0x00008CA1 }, /* GL_LOWER_LEFT */ + { 14613, 0x00001909 }, /* GL_LUMINANCE */ + { 14626, 0x00008041 }, /* GL_LUMINANCE12 */ + { 14641, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ + { 14664, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ + { 14691, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ + { 14713, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ + { 14739, 0x00008041 }, /* GL_LUMINANCE12_EXT */ + { 14758, 0x00008042 }, /* GL_LUMINANCE16 */ + { 14773, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ + { 14796, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ + { 14823, 0x00008042 }, /* GL_LUMINANCE16_EXT */ + { 14842, 0x0000803F }, /* GL_LUMINANCE4 */ + { 14856, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ + { 14877, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ + { 14902, 0x0000803F }, /* GL_LUMINANCE4_EXT */ + { 14920, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ + { 14941, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ + { 14966, 0x00008040 }, /* GL_LUMINANCE8 */ + { 14980, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ + { 15001, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ + { 15026, 0x00008040 }, /* GL_LUMINANCE8_EXT */ + { 15044, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ + { 15063, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ + { 15079, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ + { 15099, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ + { 15121, 0x00000D91 }, /* GL_MAP1_INDEX */ + { 15135, 0x00000D92 }, /* GL_MAP1_NORMAL */ + { 15150, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ + { 15174, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ + { 15198, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ + { 15222, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ + { 15246, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ + { 15263, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ + { 15280, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + { 15308, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + { 15337, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + { 15366, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + { 15395, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + { 15424, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + { 15453, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + { 15482, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + { 15510, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + { 15538, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + { 15566, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + { 15594, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + { 15622, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + { 15650, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + { 15678, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + { 15706, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + { 15734, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ + { 15750, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ + { 15770, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ + { 15792, 0x00000DB1 }, /* GL_MAP2_INDEX */ + { 15806, 0x00000DB2 }, /* GL_MAP2_NORMAL */ + { 15821, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ + { 15845, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ + { 15869, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ + { 15893, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ + { 15917, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ + { 15934, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ + { 15951, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + { 15979, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + { 16008, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + { 16037, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + { 16066, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + { 16095, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + { 16124, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + { 16153, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + { 16181, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + { 16209, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + { 16237, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + { 16265, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + { 16293, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + { 16321, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ + { 16349, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + { 16377, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + { 16405, 0x00000D10 }, /* GL_MAP_COLOR */ + { 16418, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */ + { 16444, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */ + { 16473, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */ + { 16501, 0x00000001 }, /* GL_MAP_READ_BIT */ + { 16517, 0x00000D11 }, /* GL_MAP_STENCIL */ + { 16532, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */ + { 16558, 0x00000002 }, /* GL_MAP_WRITE_BIT */ + { 16575, 0x000088C0 }, /* GL_MATRIX0_ARB */ + { 16590, 0x00008630 }, /* GL_MATRIX0_NV */ + { 16604, 0x000088CA }, /* GL_MATRIX10_ARB */ + { 16620, 0x000088CB }, /* GL_MATRIX11_ARB */ + { 16636, 0x000088CC }, /* GL_MATRIX12_ARB */ + { 16652, 0x000088CD }, /* GL_MATRIX13_ARB */ + { 16668, 0x000088CE }, /* GL_MATRIX14_ARB */ + { 16684, 0x000088CF }, /* GL_MATRIX15_ARB */ + { 16700, 0x000088D0 }, /* GL_MATRIX16_ARB */ + { 16716, 0x000088D1 }, /* GL_MATRIX17_ARB */ + { 16732, 0x000088D2 }, /* GL_MATRIX18_ARB */ + { 16748, 0x000088D3 }, /* GL_MATRIX19_ARB */ + { 16764, 0x000088C1 }, /* GL_MATRIX1_ARB */ + { 16779, 0x00008631 }, /* GL_MATRIX1_NV */ + { 16793, 0x000088D4 }, /* GL_MATRIX20_ARB */ + { 16809, 0x000088D5 }, /* GL_MATRIX21_ARB */ + { 16825, 0x000088D6 }, /* GL_MATRIX22_ARB */ + { 16841, 0x000088D7 }, /* GL_MATRIX23_ARB */ + { 16857, 0x000088D8 }, /* GL_MATRIX24_ARB */ + { 16873, 0x000088D9 }, /* GL_MATRIX25_ARB */ + { 16889, 0x000088DA }, /* GL_MATRIX26_ARB */ + { 16905, 0x000088DB }, /* GL_MATRIX27_ARB */ + { 16921, 0x000088DC }, /* GL_MATRIX28_ARB */ + { 16937, 0x000088DD }, /* GL_MATRIX29_ARB */ + { 16953, 0x000088C2 }, /* GL_MATRIX2_ARB */ + { 16968, 0x00008632 }, /* GL_MATRIX2_NV */ + { 16982, 0x000088DE }, /* GL_MATRIX30_ARB */ + { 16998, 0x000088DF }, /* GL_MATRIX31_ARB */ + { 17014, 0x000088C3 }, /* GL_MATRIX3_ARB */ + { 17029, 0x00008633 }, /* GL_MATRIX3_NV */ + { 17043, 0x000088C4 }, /* GL_MATRIX4_ARB */ + { 17058, 0x00008634 }, /* GL_MATRIX4_NV */ + { 17072, 0x000088C5 }, /* GL_MATRIX5_ARB */ + { 17087, 0x00008635 }, /* GL_MATRIX5_NV */ + { 17101, 0x000088C6 }, /* GL_MATRIX6_ARB */ + { 17116, 0x00008636 }, /* GL_MATRIX6_NV */ + { 17130, 0x000088C7 }, /* GL_MATRIX7_ARB */ + { 17145, 0x00008637 }, /* GL_MATRIX7_NV */ + { 17159, 0x000088C8 }, /* GL_MATRIX8_ARB */ + { 17174, 0x000088C9 }, /* GL_MATRIX9_ARB */ + { 17189, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ + { 17215, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + { 17249, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + { 17280, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + { 17313, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + { 17344, 0x00000BA0 }, /* GL_MATRIX_MODE */ + { 17359, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ + { 17381, 0x00008008 }, /* GL_MAX */ + { 17388, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ + { 17411, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + { 17443, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ + { 17469, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + { 17502, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + { 17528, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 17562, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ + { 17581, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + { 17610, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + { 17642, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 17678, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + { 17714, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ + { 17754, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ + { 17780, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ + { 17810, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ + { 17835, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ + { 17864, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + { 17893, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ + { 17926, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ + { 17946, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ + { 17970, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ + { 17994, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ + { 18018, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ + { 18043, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ + { 18061, 0x00008008 }, /* GL_MAX_EXT */ + { 18072, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + { 18107, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ + { 18146, 0x00000D31 }, /* GL_MAX_LIGHTS */ + { 18160, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ + { 18180, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + { 18218, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + { 18247, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ + { 18271, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ + { 18299, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ + { 18322, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 18359, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 18395, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + { 18422, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + { 18451, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + { 18485, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + { 18521, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + { 18548, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + { 18580, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + { 18616, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + { 18645, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + { 18674, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ + { 18702, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + { 18740, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 18784, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 18827, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 18861, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 18900, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 18937, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 18975, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 19018, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 19061, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + { 19091, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + { 19122, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 19158, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 19194, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ + { 19224, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + { 19258, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ + { 19291, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + { 19320, 0x00008D57 }, /* GL_MAX_SAMPLES */ + { 19335, 0x00008504 }, /* GL_MAX_SHININESS_NV */ + { 19355, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ + { 19379, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ + { 19401, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ + { 19427, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + { 19454, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ + { 19485, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ + { 19509, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + { 19543, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ + { 19563, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ + { 19590, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ + { 19611, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ + { 19636, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ + { 19661, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + { 19696, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ + { 19718, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ + { 19744, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ + { 19766, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + { 19792, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + { 19826, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ + { 19864, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + { 19897, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ + { 19934, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ + { 19958, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ + { 19979, 0x00008007 }, /* GL_MIN */ + { 19986, 0x0000802E }, /* GL_MINMAX */ + { 19996, 0x0000802E }, /* GL_MINMAX_EXT */ + { 20010, 0x0000802F }, /* GL_MINMAX_FORMAT */ + { 20027, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ + { 20048, 0x00008030 }, /* GL_MINMAX_SINK */ + { 20063, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ + { 20082, 0x00008007 }, /* GL_MIN_EXT */ + { 20093, 0x00008370 }, /* GL_MIRRORED_REPEAT */ + { 20112, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ + { 20135, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ + { 20158, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ + { 20178, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ + { 20198, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + { 20228, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ + { 20256, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + { 20284, 0x00001700 }, /* GL_MODELVIEW */ + { 20297, 0x00001700 }, /* GL_MODELVIEW0_ARB */ + { 20315, 0x0000872A }, /* GL_MODELVIEW10_ARB */ + { 20334, 0x0000872B }, /* GL_MODELVIEW11_ARB */ + { 20353, 0x0000872C }, /* GL_MODELVIEW12_ARB */ + { 20372, 0x0000872D }, /* GL_MODELVIEW13_ARB */ + { 20391, 0x0000872E }, /* GL_MODELVIEW14_ARB */ + { 20410, 0x0000872F }, /* GL_MODELVIEW15_ARB */ + { 20429, 0x00008730 }, /* GL_MODELVIEW16_ARB */ + { 20448, 0x00008731 }, /* GL_MODELVIEW17_ARB */ + { 20467, 0x00008732 }, /* GL_MODELVIEW18_ARB */ + { 20486, 0x00008733 }, /* GL_MODELVIEW19_ARB */ + { 20505, 0x0000850A }, /* GL_MODELVIEW1_ARB */ + { 20523, 0x00008734 }, /* GL_MODELVIEW20_ARB */ + { 20542, 0x00008735 }, /* GL_MODELVIEW21_ARB */ + { 20561, 0x00008736 }, /* GL_MODELVIEW22_ARB */ + { 20580, 0x00008737 }, /* GL_MODELVIEW23_ARB */ + { 20599, 0x00008738 }, /* GL_MODELVIEW24_ARB */ + { 20618, 0x00008739 }, /* GL_MODELVIEW25_ARB */ + { 20637, 0x0000873A }, /* GL_MODELVIEW26_ARB */ + { 20656, 0x0000873B }, /* GL_MODELVIEW27_ARB */ + { 20675, 0x0000873C }, /* GL_MODELVIEW28_ARB */ + { 20694, 0x0000873D }, /* GL_MODELVIEW29_ARB */ + { 20713, 0x00008722 }, /* GL_MODELVIEW2_ARB */ + { 20731, 0x0000873E }, /* GL_MODELVIEW30_ARB */ + { 20750, 0x0000873F }, /* GL_MODELVIEW31_ARB */ + { 20769, 0x00008723 }, /* GL_MODELVIEW3_ARB */ + { 20787, 0x00008724 }, /* GL_MODELVIEW4_ARB */ + { 20805, 0x00008725 }, /* GL_MODELVIEW5_ARB */ + { 20823, 0x00008726 }, /* GL_MODELVIEW6_ARB */ + { 20841, 0x00008727 }, /* GL_MODELVIEW7_ARB */ + { 20859, 0x00008728 }, /* GL_MODELVIEW8_ARB */ + { 20877, 0x00008729 }, /* GL_MODELVIEW9_ARB */ + { 20895, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ + { 20915, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ + { 20942, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ + { 20967, 0x00002100 }, /* GL_MODULATE */ + { 20979, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ + { 20999, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ + { 21026, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ + { 21051, 0x00000103 }, /* GL_MULT */ + { 21059, 0x0000809D }, /* GL_MULTISAMPLE */ + { 21074, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ + { 21094, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ + { 21113, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ + { 21132, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ + { 21156, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ + { 21179, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + { 21209, 0x00002A25 }, /* GL_N3F_V3F */ + { 21220, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ + { 21240, 0x0000150E }, /* GL_NAND */ + { 21248, 0x00002600 }, /* GL_NEAREST */ + { 21259, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + { 21290, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + { 21322, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ + { 21347, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ + { 21373, 0x00000200 }, /* GL_NEVER */ + { 21382, 0x00001102 }, /* GL_NICEST */ + { 21392, 0x00000000 }, /* GL_NONE */ + { 21400, 0x00001505 }, /* GL_NOOP */ + { 21408, 0x00001508 }, /* GL_NOR */ + { 21415, 0x00000BA1 }, /* GL_NORMALIZE */ + { 21428, 0x00008075 }, /* GL_NORMAL_ARRAY */ + { 21444, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + { 21475, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ + { 21510, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ + { 21534, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ + { 21557, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ + { 21578, 0x00008511 }, /* GL_NORMAL_MAP */ + { 21592, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ + { 21610, 0x00008511 }, /* GL_NORMAL_MAP_NV */ + { 21627, 0x00000205 }, /* GL_NOTEQUAL */ + { 21639, 0x00000000 }, /* GL_NO_ERROR */ + { 21651, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + { 21685, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ + { 21723, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ + { 21755, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ + { 21797, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ + { 21827, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ + { 21867, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ + { 21898, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ + { 21927, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ + { 21955, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ + { 21985, 0x00002401 }, /* GL_OBJECT_LINEAR */ + { 22002, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ + { 22028, 0x00002501 }, /* GL_OBJECT_PLANE */ + { 22044, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ + { 22079, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ + { 22101, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ + { 22120, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ + { 22150, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ + { 22171, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ + { 22199, 0x00000001 }, /* GL_ONE */ + { 22206, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + { 22234, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ + { 22266, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ + { 22294, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ + { 22326, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ + { 22349, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ + { 22372, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ + { 22395, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ + { 22418, 0x00008598 }, /* GL_OPERAND0_ALPHA */ + { 22436, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ + { 22458, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ + { 22480, 0x00008590 }, /* GL_OPERAND0_RGB */ + { 22496, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ + { 22516, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ + { 22536, 0x00008599 }, /* GL_OPERAND1_ALPHA */ + { 22554, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ + { 22576, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ + { 22598, 0x00008591 }, /* GL_OPERAND1_RGB */ + { 22614, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ + { 22634, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ + { 22654, 0x0000859A }, /* GL_OPERAND2_ALPHA */ + { 22672, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ + { 22694, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ + { 22716, 0x00008592 }, /* GL_OPERAND2_RGB */ + { 22732, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ + { 22752, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ + { 22772, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ + { 22793, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ + { 22812, 0x00001507 }, /* GL_OR */ + { 22818, 0x00000A01 }, /* GL_ORDER */ + { 22827, 0x0000150D }, /* GL_OR_INVERTED */ + { 22842, 0x0000150B }, /* GL_OR_REVERSE */ + { 22856, 0x00000505 }, /* GL_OUT_OF_MEMORY */ + { 22873, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ + { 22891, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ + { 22912, 0x00008758 }, /* GL_PACK_INVERT_MESA */ + { 22932, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ + { 22950, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ + { 22969, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ + { 22989, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ + { 23009, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ + { 23027, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ + { 23046, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ + { 23071, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ + { 23095, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ + { 23116, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ + { 23138, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ + { 23160, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ + { 23185, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ + { 23209, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ + { 23230, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ + { 23252, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ + { 23274, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ + { 23296, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ + { 23327, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ + { 23347, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + { 23372, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ + { 23392, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + { 23417, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ + { 23437, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + { 23462, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ + { 23482, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + { 23507, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ + { 23527, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + { 23552, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ + { 23572, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + { 23597, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ + { 23617, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + { 23642, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ + { 23662, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + { 23687, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ + { 23707, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + { 23732, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ + { 23752, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + { 23777, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ + { 23795, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ + { 23816, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ + { 23845, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ + { 23878, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ + { 23903, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ + { 23926, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + { 23957, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ + { 23992, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ + { 24019, 0x00001B00 }, /* GL_POINT */ + { 24028, 0x00000000 }, /* GL_POINTS */ + { 24038, 0x00000002 }, /* GL_POINT_BIT */ + { 24051, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ + { 24081, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ + { 24115, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ + { 24149, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ + { 24184, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ + { 24213, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ + { 24246, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ + { 24279, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ + { 24313, 0x00000B11 }, /* GL_POINT_SIZE */ + { 24327, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ + { 24353, 0x00008127 }, /* GL_POINT_SIZE_MAX */ + { 24371, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ + { 24393, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ + { 24415, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ + { 24438, 0x00008126 }, /* GL_POINT_SIZE_MIN */ + { 24456, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ + { 24478, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ + { 24500, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ + { 24523, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ + { 24543, 0x00000B10 }, /* GL_POINT_SMOOTH */ + { 24559, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ + { 24580, 0x00008861 }, /* GL_POINT_SPRITE */ + { 24596, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ + { 24616, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ + { 24645, 0x00008861 }, /* GL_POINT_SPRITE_NV */ + { 24664, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ + { 24690, 0x00000701 }, /* GL_POINT_TOKEN */ + { 24705, 0x00000009 }, /* GL_POLYGON */ + { 24716, 0x00000008 }, /* GL_POLYGON_BIT */ + { 24731, 0x00000B40 }, /* GL_POLYGON_MODE */ + { 24747, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ + { 24770, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ + { 24795, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ + { 24818, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ + { 24841, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ + { 24865, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ + { 24889, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ + { 24907, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ + { 24930, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ + { 24949, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ + { 24972, 0x00000703 }, /* GL_POLYGON_TOKEN */ + { 24989, 0x00001203 }, /* GL_POSITION */ + { 25001, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + { 25033, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ + { 25069, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + { 25102, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ + { 25139, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + { 25170, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ + { 25205, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + { 25237, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ + { 25273, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + { 25306, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + { 25338, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ + { 25374, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + { 25407, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ + { 25444, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + { 25474, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ + { 25508, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + { 25539, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ + { 25574, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + { 25605, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ + { 25640, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + { 25672, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ + { 25708, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + { 25738, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ + { 25772, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + { 25803, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ + { 25838, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + { 25870, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + { 25901, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ + { 25936, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + { 25968, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ + { 26004, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ + { 26033, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ + { 26066, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ + { 26096, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ + { 26130, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + { 26169, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + { 26202, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + { 26242, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + { 26276, 0x00008578 }, /* GL_PREVIOUS */ + { 26288, 0x00008578 }, /* GL_PREVIOUS_ARB */ + { 26304, 0x00008578 }, /* GL_PREVIOUS_EXT */ + { 26320, 0x00008577 }, /* GL_PRIMARY_COLOR */ + { 26337, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ + { 26358, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ + { 26379, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 26412, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 26444, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ + { 26467, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ + { 26490, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ + { 26520, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ + { 26549, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ + { 26577, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ + { 26599, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + { 26627, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + { 26655, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ + { 26677, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ + { 26698, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 26738, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 26777, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 26807, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 26842, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 26875, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 26909, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 26948, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 26987, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ + { 27009, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ + { 27035, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ + { 27059, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ + { 27082, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ + { 27104, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ + { 27125, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ + { 27146, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ + { 27173, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 27205, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 27237, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + { 27272, 0x00001701 }, /* GL_PROJECTION */ + { 27286, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ + { 27307, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ + { 27333, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */ + { 27357, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ + { 27378, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ + { 27397, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ + { 27420, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + { 27459, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + { 27497, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ + { 27517, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + { 27547, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ + { 27571, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ + { 27591, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + { 27621, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ + { 27645, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ + { 27665, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + { 27698, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ + { 27724, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ + { 27754, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + { 27785, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ + { 27815, 0x00002003 }, /* GL_Q */ + { 27820, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ + { 27845, 0x00000007 }, /* GL_QUADS */ + { 27854, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ + { 27902, 0x00008614 }, /* GL_QUAD_MESH_SUN */ + { 27919, 0x00000008 }, /* GL_QUAD_STRIP */ + { 27933, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ + { 27955, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ + { 27981, 0x00008866 }, /* GL_QUERY_RESULT */ + { 27997, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ + { 28017, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ + { 28043, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ + { 28073, 0x00002002 }, /* GL_R */ + { 28078, 0x00002A10 }, /* GL_R3_G3_B2 */ + { 28090, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + { 28123, 0x00000C02 }, /* GL_READ_BUFFER */ + { 28138, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ + { 28158, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + { 28190, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ + { 28214, 0x000088B8 }, /* GL_READ_ONLY */ + { 28227, 0x000088B8 }, /* GL_READ_ONLY_ARB */ + { 28244, 0x000088BA }, /* GL_READ_WRITE */ + { 28258, 0x000088BA }, /* GL_READ_WRITE_ARB */ + { 28276, 0x00001903 }, /* GL_RED */ + { 28283, 0x00008016 }, /* GL_REDUCE */ + { 28293, 0x00008016 }, /* GL_REDUCE_EXT */ + { 28307, 0x00000D15 }, /* GL_RED_BIAS */ + { 28319, 0x00000D52 }, /* GL_RED_BITS */ + { 28331, 0x00000D14 }, /* GL_RED_SCALE */ + { 28344, 0x00008512 }, /* GL_REFLECTION_MAP */ + { 28362, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ + { 28384, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ + { 28405, 0x00001C00 }, /* GL_RENDER */ + { 28415, 0x00008D41 }, /* GL_RENDERBUFFER */ + { 28431, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ + { 28458, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ + { 28486, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ + { 28512, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ + { 28539, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ + { 28559, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ + { 28586, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ + { 28609, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ + { 28636, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + { 28668, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ + { 28704, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ + { 28729, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ + { 28753, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ + { 28782, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ + { 28804, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ + { 28830, 0x00001F01 }, /* GL_RENDERER */ + { 28842, 0x00000C40 }, /* GL_RENDER_MODE */ + { 28857, 0x00002901 }, /* GL_REPEAT */ + { 28867, 0x00001E01 }, /* GL_REPLACE */ + { 28878, 0x00008062 }, /* GL_REPLACE_EXT */ + { 28893, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ + { 28916, 0x0000803A }, /* GL_RESCALE_NORMAL */ + { 28934, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ + { 28956, 0x00000102 }, /* GL_RETURN */ + { 28966, 0x00001907 }, /* GL_RGB */ + { 28973, 0x00008052 }, /* GL_RGB10 */ + { 28982, 0x00008059 }, /* GL_RGB10_A2 */ + { 28994, 0x00008059 }, /* GL_RGB10_A2_EXT */ + { 29010, 0x00008052 }, /* GL_RGB10_EXT */ + { 29023, 0x00008053 }, /* GL_RGB12 */ + { 29032, 0x00008053 }, /* GL_RGB12_EXT */ + { 29045, 0x00008054 }, /* GL_RGB16 */ + { 29054, 0x00008054 }, /* GL_RGB16_EXT */ + { 29067, 0x0000804E }, /* GL_RGB2_EXT */ + { 29079, 0x0000804F }, /* GL_RGB4 */ + { 29087, 0x0000804F }, /* GL_RGB4_EXT */ + { 29099, 0x000083A1 }, /* GL_RGB4_S3TC */ + { 29112, 0x00008050 }, /* GL_RGB5 */ + { 29120, 0x00008057 }, /* GL_RGB5_A1 */ + { 29131, 0x00008057 }, /* GL_RGB5_A1_EXT */ + { 29146, 0x00008050 }, /* GL_RGB5_EXT */ + { 29158, 0x00008051 }, /* GL_RGB8 */ + { 29166, 0x00008051 }, /* GL_RGB8_EXT */ + { 29178, 0x00001908 }, /* GL_RGBA */ + { 29186, 0x0000805A }, /* GL_RGBA12 */ + { 29196, 0x0000805A }, /* GL_RGBA12_EXT */ + { 29210, 0x0000805B }, /* GL_RGBA16 */ + { 29220, 0x0000805B }, /* GL_RGBA16_EXT */ + { 29234, 0x00008055 }, /* GL_RGBA2 */ + { 29243, 0x00008055 }, /* GL_RGBA2_EXT */ + { 29256, 0x00008056 }, /* GL_RGBA4 */ + { 29265, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ + { 29284, 0x00008056 }, /* GL_RGBA4_EXT */ + { 29297, 0x000083A3 }, /* GL_RGBA4_S3TC */ + { 29311, 0x00008058 }, /* GL_RGBA8 */ + { 29320, 0x00008058 }, /* GL_RGBA8_EXT */ + { 29333, 0x00008F97 }, /* GL_RGBA8_SNORM */ + { 29348, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ + { 29366, 0x00000C31 }, /* GL_RGBA_MODE */ + { 29379, 0x000083A2 }, /* GL_RGBA_S3TC */ + { 29392, 0x00008F93 }, /* GL_RGBA_SNORM */ + { 29406, 0x000083A0 }, /* GL_RGB_S3TC */ + { 29418, 0x00008573 }, /* GL_RGB_SCALE */ + { 29431, 0x00008573 }, /* GL_RGB_SCALE_ARB */ + { 29448, 0x00008573 }, /* GL_RGB_SCALE_EXT */ + { 29465, 0x00000407 }, /* GL_RIGHT */ + { 29474, 0x00002000 }, /* GL_S */ + { 29479, 0x00008B5D }, /* GL_SAMPLER_1D */ + { 29493, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ + { 29514, 0x00008B5E }, /* GL_SAMPLER_2D */ + { 29528, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ + { 29549, 0x00008B5F }, /* GL_SAMPLER_3D */ + { 29563, 0x00008B60 }, /* GL_SAMPLER_CUBE */ + { 29579, 0x000080A9 }, /* GL_SAMPLES */ + { 29590, 0x000086B4 }, /* GL_SAMPLES_3DFX */ + { 29606, 0x000080A9 }, /* GL_SAMPLES_ARB */ + { 29621, 0x00008914 }, /* GL_SAMPLES_PASSED */ + { 29639, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ + { 29661, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + { 29689, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ + { 29721, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ + { 29744, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ + { 29771, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ + { 29789, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ + { 29812, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ + { 29834, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ + { 29853, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ + { 29876, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ + { 29902, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ + { 29932, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ + { 29957, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ + { 29986, 0x00080000 }, /* GL_SCISSOR_BIT */ + { 30001, 0x00000C10 }, /* GL_SCISSOR_BOX */ + { 30016, 0x00000C11 }, /* GL_SCISSOR_TEST */ + { 30032, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ + { 30057, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + { 30097, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 30141, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + { 30174, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + { 30204, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + { 30236, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + { 30266, 0x00001C02 }, /* GL_SELECT */ + { 30276, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ + { 30304, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ + { 30329, 0x00008012 }, /* GL_SEPARABLE_2D */ + { 30345, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ + { 30372, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ + { 30403, 0x0000150F }, /* GL_SET */ + { 30410, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ + { 30431, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ + { 30455, 0x00008B4F }, /* GL_SHADER_TYPE */ + { 30470, 0x00000B54 }, /* GL_SHADE_MODEL */ + { 30485, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ + { 30513, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ + { 30536, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + { 30566, 0x00001601 }, /* GL_SHININESS */ + { 30579, 0x00001402 }, /* GL_SHORT */ + { 30588, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ + { 30609, 0x000081F9 }, /* GL_SINGLE_COLOR */ + { 30625, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ + { 30645, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ + { 30664, 0x00008C46 }, /* GL_SLUMINANCE */ + { 30678, 0x00008C47 }, /* GL_SLUMINANCE8 */ + { 30693, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ + { 30715, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ + { 30735, 0x00001D01 }, /* GL_SMOOTH */ + { 30745, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ + { 30778, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ + { 30805, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ + { 30838, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ + { 30865, 0x00008588 }, /* GL_SOURCE0_ALPHA */ + { 30882, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ + { 30903, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ + { 30924, 0x00008580 }, /* GL_SOURCE0_RGB */ + { 30939, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ + { 30958, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ + { 30977, 0x00008589 }, /* GL_SOURCE1_ALPHA */ + { 30994, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ + { 31015, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ + { 31036, 0x00008581 }, /* GL_SOURCE1_RGB */ + { 31051, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ + { 31070, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ + { 31089, 0x0000858A }, /* GL_SOURCE2_ALPHA */ + { 31106, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ + { 31127, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ + { 31148, 0x00008582 }, /* GL_SOURCE2_RGB */ + { 31163, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ + { 31182, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ + { 31201, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ + { 31221, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ + { 31239, 0x00001202 }, /* GL_SPECULAR */ + { 31251, 0x00002402 }, /* GL_SPHERE_MAP */ + { 31265, 0x00001206 }, /* GL_SPOT_CUTOFF */ + { 31280, 0x00001204 }, /* GL_SPOT_DIRECTION */ + { 31298, 0x00001205 }, /* GL_SPOT_EXPONENT */ + { 31315, 0x00008588 }, /* GL_SRC0_ALPHA */ + { 31329, 0x00008580 }, /* GL_SRC0_RGB */ + { 31341, 0x00008589 }, /* GL_SRC1_ALPHA */ + { 31355, 0x00008581 }, /* GL_SRC1_RGB */ + { 31367, 0x0000858A }, /* GL_SRC2_ALPHA */ + { 31381, 0x00008582 }, /* GL_SRC2_RGB */ + { 31393, 0x00000302 }, /* GL_SRC_ALPHA */ + { 31406, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ + { 31428, 0x00000300 }, /* GL_SRC_COLOR */ + { 31441, 0x00008C40 }, /* GL_SRGB */ + { 31449, 0x00008C41 }, /* GL_SRGB8 */ + { 31458, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ + { 31474, 0x00008C42 }, /* GL_SRGB_ALPHA */ + { 31488, 0x00000503 }, /* GL_STACK_OVERFLOW */ + { 31506, 0x00000504 }, /* GL_STACK_UNDERFLOW */ + { 31525, 0x000088E6 }, /* GL_STATIC_COPY */ + { 31540, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ + { 31559, 0x000088E4 }, /* GL_STATIC_DRAW */ + { 31574, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ + { 31593, 0x000088E5 }, /* GL_STATIC_READ */ + { 31608, 0x000088E5 }, /* GL_STATIC_READ_ARB */ + { 31627, 0x00001802 }, /* GL_STENCIL */ + { 31638, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ + { 31660, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ + { 31686, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ + { 31707, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ + { 31732, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ + { 31753, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ + { 31778, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + { 31810, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ + { 31846, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + { 31878, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ + { 31914, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ + { 31934, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ + { 31961, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ + { 31987, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 32003, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 32025, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 32048, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 32064, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 32080, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 32097, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 32120, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 32142, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 32164, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 32186, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 32207, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 32234, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 32261, 0x00000B97 }, /* GL_STENCIL_REF */ + { 32276, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 32292, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 32321, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 32343, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 32364, 0x00000C33 }, /* GL_STEREO */ + { 32374, 0x000088E2 }, /* GL_STREAM_COPY */ + { 32389, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 32408, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 32423, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 32442, 0x000088E1 }, /* GL_STREAM_READ */ + { 32457, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 32476, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 32493, 0x000084E7 }, /* GL_SUBTRACT */ + { 32505, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 32521, 0x00002001 }, /* GL_T */ + { 32526, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 32541, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 32560, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 32576, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 32591, 0x00002A27 }, /* GL_T2F_V3F */ + { 32602, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 32621, 0x00002A28 }, /* GL_T4F_V4F */ + { 32632, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 32655, 0x00001702 }, /* GL_TEXTURE */ + { 32666, 0x000084C0 }, /* GL_TEXTURE0 */ + { 32678, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 32694, 0x000084C1 }, /* GL_TEXTURE1 */ + { 32706, 0x000084CA }, /* GL_TEXTURE10 */ + { 32719, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 32736, 0x000084CB }, /* GL_TEXTURE11 */ + { 32749, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 32766, 0x000084CC }, /* GL_TEXTURE12 */ + { 32779, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 32796, 0x000084CD }, /* GL_TEXTURE13 */ + { 32809, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 32826, 0x000084CE }, /* GL_TEXTURE14 */ + { 32839, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 32856, 0x000084CF }, /* GL_TEXTURE15 */ + { 32869, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 32886, 0x000084D0 }, /* GL_TEXTURE16 */ + { 32899, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 32916, 0x000084D1 }, /* GL_TEXTURE17 */ + { 32929, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 32946, 0x000084D2 }, /* GL_TEXTURE18 */ + { 32959, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 32976, 0x000084D3 }, /* GL_TEXTURE19 */ + { 32989, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 33006, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 33022, 0x000084C2 }, /* GL_TEXTURE2 */ + { 33034, 0x000084D4 }, /* GL_TEXTURE20 */ + { 33047, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 33064, 0x000084D5 }, /* GL_TEXTURE21 */ + { 33077, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 33094, 0x000084D6 }, /* GL_TEXTURE22 */ + { 33107, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 33124, 0x000084D7 }, /* GL_TEXTURE23 */ + { 33137, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 33154, 0x000084D8 }, /* GL_TEXTURE24 */ + { 33167, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 33184, 0x000084D9 }, /* GL_TEXTURE25 */ + { 33197, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 33214, 0x000084DA }, /* GL_TEXTURE26 */ + { 33227, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 33244, 0x000084DB }, /* GL_TEXTURE27 */ + { 33257, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 33274, 0x000084DC }, /* GL_TEXTURE28 */ + { 33287, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 33304, 0x000084DD }, /* GL_TEXTURE29 */ + { 33317, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 33334, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 33350, 0x000084C3 }, /* GL_TEXTURE3 */ + { 33362, 0x000084DE }, /* GL_TEXTURE30 */ + { 33375, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 33392, 0x000084DF }, /* GL_TEXTURE31 */ + { 33405, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 33422, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 33438, 0x000084C4 }, /* GL_TEXTURE4 */ + { 33450, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 33466, 0x000084C5 }, /* GL_TEXTURE5 */ + { 33478, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 33494, 0x000084C6 }, /* GL_TEXTURE6 */ + { 33506, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 33522, 0x000084C7 }, /* GL_TEXTURE7 */ + { 33534, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 33550, 0x000084C8 }, /* GL_TEXTURE8 */ + { 33562, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 33578, 0x000084C9 }, /* GL_TEXTURE9 */ + { 33590, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 33606, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 33620, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ + { 33644, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 33658, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ + { 33682, 0x0000806F }, /* GL_TEXTURE_3D */ + { 33696, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 33718, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 33744, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 33766, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 33788, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + { 33820, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 33842, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + { 33874, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 33896, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 33924, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 33956, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 33989, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 34021, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 34036, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 34057, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 34082, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 34100, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 34124, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 34155, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 34185, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 34215, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 34250, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 34281, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 34319, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 34346, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 34378, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 34412, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 34436, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 34464, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 34488, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 34516, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 34549, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 34573, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 34595, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 34617, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 34643, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 34677, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 34710, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 34747, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 34775, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 34807, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 34830, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 34868, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 34910, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 34941, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 34969, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 34999, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 35027, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 35047, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 35071, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 35102, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 35137, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 35168, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 35203, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 35234, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 35269, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 35300, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 35335, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 35366, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 35401, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 35432, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 35467, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 35484, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 35506, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 35532, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 35547, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 35568, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 35588, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 35614, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 35634, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 35651, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 35668, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 35685, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 35702, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 35727, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 35749, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 35775, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 35793, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 35819, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 35845, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 35875, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 35902, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 35927, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 35947, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 35971, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 35998, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 36025, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 36052, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 36078, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 36108, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 36130, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 36148, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 36178, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 36206, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 36234, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 36262, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 36283, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 36302, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 36324, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 36343, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 36363, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 36388, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 36412, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 36432, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 36456, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 36476, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 36499, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ + { 36523, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 36548, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 36582, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 36599, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 36617, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 36635, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 36653, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ + { 36673, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 36692, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 36721, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 36738, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 36764, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 36794, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 36826, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 36856, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 36890, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 36906, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 36937, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 36972, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 37000, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 37032, 0x00000004 }, /* GL_TRIANGLES */ + { 37045, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 37061, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 37082, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 37100, 0x00000001 }, /* GL_TRUE */ + { 37108, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 37128, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 37151, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 37171, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 37192, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 37214, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 37236, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 37256, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 37277, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 37294, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 37321, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 37344, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 37360, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 37387, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ + { 37408, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 37432, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 37463, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 37487, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 37515, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ + { 37538, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 37556, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 37586, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 37612, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 37642, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 37668, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 37692, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 37720, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 37748, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 37775, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 37807, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 37838, 0x00008CA2 }, /* GL_UPPER_LEFT */ + { 37852, 0x00002A20 }, /* GL_V2F */ + { 37859, 0x00002A21 }, /* GL_V3F */ + { 37866, 0x00008B83 }, /* GL_VALIDATE_STATUS */ + { 37885, 0x00001F00 }, /* GL_VENDOR */ + { 37895, 0x00001F02 }, /* GL_VERSION */ + { 37906, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 37922, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */ + { 37946, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + { 37976, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 38007, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 38042, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 38066, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 38087, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 38110, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 38131, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 38158, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 38186, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 38214, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 38242, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 38270, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 38298, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 38326, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 38353, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 38380, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 38407, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 38434, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 38461, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 38488, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 38515, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 38542, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 38569, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 38607, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 38649, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + { 38680, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 38715, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + { 38749, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 38787, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + { 38818, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 38853, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + { 38881, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 38913, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + { 38943, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 38977, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + { 39005, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 39037, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 39057, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 39079, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 39108, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 39129, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + { 39158, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 39191, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 39223, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + { 39250, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 39281, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 39311, 0x00008B31 }, /* GL_VERTEX_SHADER */ + { 39328, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 39349, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 39376, 0x00000BA2 }, /* GL_VIEWPORT */ + { 39388, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 39404, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 39424, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 39455, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 39490, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 39518, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 39543, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 39570, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 39595, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 39619, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 39638, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 39652, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 39670, 0x00001506 }, /* GL_XOR */ + { 39677, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 39696, 0x00008757 }, /* GL_YCBCR_MESA */ + { 39710, 0x00000000 }, /* GL_ZERO */ + { 39718, 0x00000D16 }, /* GL_ZOOM_X */ + { 39728, 0x00000D17 }, /* GL_ZOOM_Y */ }; -static const unsigned reduced_enums[1321] = +static const unsigned reduced_enums[1325] = { 471, /* GL_FALSE */ - 685, /* GL_LINES */ - 687, /* GL_LINE_LOOP */ - 694, /* GL_LINE_STRIP */ - 1711, /* GL_TRIANGLES */ - 1714, /* GL_TRIANGLE_STRIP */ - 1712, /* GL_TRIANGLE_FAN */ - 1256, /* GL_QUADS */ - 1258, /* GL_QUAD_STRIP */ - 1144, /* GL_POLYGON */ - 1156, /* GL_POLYGON_STIPPLE_BIT */ - 1105, /* GL_PIXEL_MODE_BIT */ - 672, /* GL_LIGHTING_BIT */ - 499, /* GL_FOG_BIT */ + 687, /* GL_LINES */ + 689, /* GL_LINE_LOOP */ + 696, /* GL_LINE_STRIP */ + 1721, /* GL_TRIANGLES */ + 1724, /* GL_TRIANGLE_STRIP */ + 1722, /* GL_TRIANGLE_FAN */ + 1265, /* GL_QUADS */ + 1268, /* GL_QUAD_STRIP */ + 1152, /* GL_POLYGON */ + 1164, /* GL_POLYGON_STIPPLE_BIT */ + 1113, /* GL_PIXEL_MODE_BIT */ + 674, /* GL_LIGHTING_BIT */ + 500, /* GL_FOG_BIT */ 8, /* GL_ACCUM */ - 704, /* GL_LOAD */ - 1310, /* GL_RETURN */ - 978, /* GL_MULT */ + 706, /* GL_LOAD */ + 1320, /* GL_RETURN */ + 986, /* GL_MULT */ 23, /* GL_ADD */ - 994, /* GL_NEVER */ - 662, /* GL_LESS */ + 1002, /* GL_NEVER */ + 664, /* GL_LESS */ 461, /* GL_EQUAL */ - 661, /* GL_LEQUAL */ - 585, /* GL_GREATER */ - 1009, /* GL_NOTEQUAL */ - 584, /* GL_GEQUAL */ + 663, /* GL_LEQUAL */ + 586, /* GL_GREATER */ + 1017, /* GL_NOTEQUAL */ + 585, /* GL_GEQUAL */ 46, /* GL_ALWAYS */ - 1450, /* GL_SRC_COLOR */ - 1038, /* GL_ONE_MINUS_SRC_COLOR */ - 1448, /* GL_SRC_ALPHA */ - 1037, /* GL_ONE_MINUS_SRC_ALPHA */ + 1460, /* GL_SRC_COLOR */ + 1046, /* GL_ONE_MINUS_SRC_COLOR */ + 1458, /* GL_SRC_ALPHA */ + 1045, /* GL_ONE_MINUS_SRC_ALPHA */ 440, /* GL_DST_ALPHA */ - 1035, /* GL_ONE_MINUS_DST_ALPHA */ + 1043, /* GL_ONE_MINUS_DST_ALPHA */ 441, /* GL_DST_COLOR */ - 1036, /* GL_ONE_MINUS_DST_COLOR */ - 1449, /* GL_SRC_ALPHA_SATURATE */ - 572, /* GL_FRONT_LEFT */ - 573, /* GL_FRONT_RIGHT */ + 1044, /* GL_ONE_MINUS_DST_COLOR */ + 1459, /* GL_SRC_ALPHA_SATURATE */ + 573, /* GL_FRONT_LEFT */ + 574, /* GL_FRONT_RIGHT */ 68, /* GL_BACK_LEFT */ 69, /* GL_BACK_RIGHT */ - 569, /* GL_FRONT */ + 570, /* GL_FRONT */ 67, /* GL_BACK */ - 660, /* GL_LEFT */ - 1352, /* GL_RIGHT */ - 570, /* GL_FRONT_AND_BACK */ + 662, /* GL_LEFT */ + 1362, /* GL_RIGHT */ + 571, /* GL_FRONT_AND_BACK */ 62, /* GL_AUX0 */ 63, /* GL_AUX1 */ 64, /* GL_AUX2 */ 65, /* GL_AUX3 */ - 651, /* GL_INVALID_ENUM */ - 655, /* GL_INVALID_VALUE */ - 654, /* GL_INVALID_OPERATION */ - 1455, /* GL_STACK_OVERFLOW */ - 1456, /* GL_STACK_UNDERFLOW */ - 1063, /* GL_OUT_OF_MEMORY */ - 652, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + 652, /* GL_INVALID_ENUM */ + 656, /* GL_INVALID_VALUE */ + 655, /* GL_INVALID_OPERATION */ + 1465, /* GL_STACK_OVERFLOW */ + 1466, /* GL_STACK_UNDERFLOW */ + 1071, /* GL_OUT_OF_MEMORY */ + 653, /* GL_INVALID_FRAMEBUFFER_OPERATION */ 0, /* GL_2D */ 2, /* GL_3D */ 3, /* GL_3D_COLOR */ 4, /* GL_3D_COLOR_TEXTURE */ 6, /* GL_4D_COLOR_TEXTURE */ - 1083, /* GL_PASS_THROUGH_TOKEN */ - 1143, /* GL_POINT_TOKEN */ - 695, /* GL_LINE_TOKEN */ - 1157, /* GL_POLYGON_TOKEN */ + 1091, /* GL_PASS_THROUGH_TOKEN */ + 1151, /* GL_POINT_TOKEN */ + 697, /* GL_LINE_TOKEN */ + 1165, /* GL_POLYGON_TOKEN */ 73, /* GL_BITMAP_TOKEN */ 439, /* GL_DRAW_PIXEL_TOKEN */ 297, /* GL_COPY_PIXEL_TOKEN */ - 688, /* GL_LINE_RESET_TOKEN */ + 690, /* GL_LINE_RESET_TOKEN */ 464, /* GL_EXP */ 465, /* GL_EXP2 */ 333, /* GL_CW */ 122, /* GL_CCW */ 143, /* GL_COEFF */ - 1060, /* GL_ORDER */ + 1068, /* GL_ORDER */ 377, /* GL_DOMAIN */ 307, /* GL_CURRENT_COLOR */ 310, /* GL_CURRENT_INDEX */ @@ -3774,67 +3796,67 @@ static const unsigned reduced_enums[1321] = 324, /* GL_CURRENT_RASTER_POSITION */ 325, /* GL_CURRENT_RASTER_POSITION_VALID */ 322, /* GL_CURRENT_RASTER_DISTANCE */ - 1136, /* GL_POINT_SMOOTH */ - 1125, /* GL_POINT_SIZE */ - 1135, /* GL_POINT_SIZE_RANGE */ - 1126, /* GL_POINT_SIZE_GRANULARITY */ - 689, /* GL_LINE_SMOOTH */ - 696, /* GL_LINE_WIDTH */ - 698, /* GL_LINE_WIDTH_RANGE */ - 697, /* GL_LINE_WIDTH_GRANULARITY */ - 691, /* GL_LINE_STIPPLE */ - 692, /* GL_LINE_STIPPLE_PATTERN */ - 693, /* GL_LINE_STIPPLE_REPEAT */ - 703, /* GL_LIST_MODE */ - 862, /* GL_MAX_LIST_NESTING */ - 700, /* GL_LIST_BASE */ - 702, /* GL_LIST_INDEX */ - 1146, /* GL_POLYGON_MODE */ - 1153, /* GL_POLYGON_SMOOTH */ - 1155, /* GL_POLYGON_STIPPLE */ + 1144, /* GL_POINT_SMOOTH */ + 1133, /* GL_POINT_SIZE */ + 1143, /* GL_POINT_SIZE_RANGE */ + 1134, /* GL_POINT_SIZE_GRANULARITY */ + 691, /* GL_LINE_SMOOTH */ + 698, /* GL_LINE_WIDTH */ + 700, /* GL_LINE_WIDTH_RANGE */ + 699, /* GL_LINE_WIDTH_GRANULARITY */ + 693, /* GL_LINE_STIPPLE */ + 694, /* GL_LINE_STIPPLE_PATTERN */ + 695, /* GL_LINE_STIPPLE_REPEAT */ + 705, /* GL_LIST_MODE */ + 870, /* GL_MAX_LIST_NESTING */ + 702, /* GL_LIST_BASE */ + 704, /* GL_LIST_INDEX */ + 1154, /* GL_POLYGON_MODE */ + 1161, /* GL_POLYGON_SMOOTH */ + 1163, /* GL_POLYGON_STIPPLE */ 450, /* GL_EDGE_FLAG */ 300, /* GL_CULL_FACE */ 301, /* GL_CULL_FACE_MODE */ - 571, /* GL_FRONT_FACE */ - 671, /* GL_LIGHTING */ - 676, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - 677, /* GL_LIGHT_MODEL_TWO_SIDE */ - 673, /* GL_LIGHT_MODEL_AMBIENT */ - 1398, /* GL_SHADE_MODEL */ + 572, /* GL_FRONT_FACE */ + 673, /* GL_LIGHTING */ + 678, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + 679, /* GL_LIGHT_MODEL_TWO_SIDE */ + 675, /* GL_LIGHT_MODEL_AMBIENT */ + 1408, /* GL_SHADE_MODEL */ 190, /* GL_COLOR_MATERIAL_FACE */ 191, /* GL_COLOR_MATERIAL_PARAMETER */ 189, /* GL_COLOR_MATERIAL */ - 498, /* GL_FOG */ - 520, /* GL_FOG_INDEX */ - 516, /* GL_FOG_DENSITY */ - 524, /* GL_FOG_START */ - 518, /* GL_FOG_END */ - 521, /* GL_FOG_MODE */ - 500, /* GL_FOG_COLOR */ + 499, /* GL_FOG */ + 521, /* GL_FOG_INDEX */ + 517, /* GL_FOG_DENSITY */ + 525, /* GL_FOG_START */ + 519, /* GL_FOG_END */ + 522, /* GL_FOG_MODE */ + 501, /* GL_FOG_COLOR */ 364, /* GL_DEPTH_RANGE */ 371, /* GL_DEPTH_TEST */ 374, /* GL_DEPTH_WRITEMASK */ 352, /* GL_DEPTH_CLEAR_VALUE */ 363, /* GL_DEPTH_FUNC */ 12, /* GL_ACCUM_CLEAR_VALUE */ - 1491, /* GL_STENCIL_TEST */ - 1479, /* GL_STENCIL_CLEAR_VALUE */ - 1481, /* GL_STENCIL_FUNC */ - 1493, /* GL_STENCIL_VALUE_MASK */ - 1480, /* GL_STENCIL_FAIL */ - 1488, /* GL_STENCIL_PASS_DEPTH_FAIL */ - 1489, /* GL_STENCIL_PASS_DEPTH_PASS */ - 1490, /* GL_STENCIL_REF */ - 1494, /* GL_STENCIL_WRITEMASK */ - 831, /* GL_MATRIX_MODE */ - 999, /* GL_NORMALIZE */ - 1803, /* GL_VIEWPORT */ - 973, /* GL_MODELVIEW_STACK_DEPTH */ - 1236, /* GL_PROJECTION_STACK_DEPTH */ - 1689, /* GL_TEXTURE_STACK_DEPTH */ - 971, /* GL_MODELVIEW_MATRIX */ - 1235, /* GL_PROJECTION_MATRIX */ - 1674, /* GL_TEXTURE_MATRIX */ + 1501, /* GL_STENCIL_TEST */ + 1489, /* GL_STENCIL_CLEAR_VALUE */ + 1491, /* GL_STENCIL_FUNC */ + 1503, /* GL_STENCIL_VALUE_MASK */ + 1490, /* GL_STENCIL_FAIL */ + 1498, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1499, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1500, /* GL_STENCIL_REF */ + 1504, /* GL_STENCIL_WRITEMASK */ + 839, /* GL_MATRIX_MODE */ + 1007, /* GL_NORMALIZE */ + 1814, /* GL_VIEWPORT */ + 981, /* GL_MODELVIEW_STACK_DEPTH */ + 1244, /* GL_PROJECTION_STACK_DEPTH */ + 1699, /* GL_TEXTURE_STACK_DEPTH */ + 979, /* GL_MODELVIEW_MATRIX */ + 1243, /* GL_PROJECTION_MATRIX */ + 1684, /* GL_TEXTURE_MATRIX */ 60, /* GL_ATTRIB_STACK_DEPTH */ 133, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ 43, /* GL_ALPHA_TEST */ @@ -3844,162 +3866,162 @@ static const unsigned reduced_enums[1321] = 77, /* GL_BLEND_DST */ 86, /* GL_BLEND_SRC */ 74, /* GL_BLEND */ - 706, /* GL_LOGIC_OP_MODE */ - 625, /* GL_INDEX_LOGIC_OP */ + 708, /* GL_LOGIC_OP_MODE */ + 626, /* GL_INDEX_LOGIC_OP */ 188, /* GL_COLOR_LOGIC_OP */ 66, /* GL_AUX_BUFFERS */ 387, /* GL_DRAW_BUFFER */ - 1268, /* GL_READ_BUFFER */ - 1379, /* GL_SCISSOR_BOX */ - 1380, /* GL_SCISSOR_TEST */ - 624, /* GL_INDEX_CLEAR_VALUE */ - 629, /* GL_INDEX_WRITEMASK */ + 1278, /* GL_READ_BUFFER */ + 1389, /* GL_SCISSOR_BOX */ + 1390, /* GL_SCISSOR_TEST */ + 625, /* GL_INDEX_CLEAR_VALUE */ + 630, /* GL_INDEX_WRITEMASK */ 185, /* GL_COLOR_CLEAR_VALUE */ 227, /* GL_COLOR_WRITEMASK */ - 626, /* GL_INDEX_MODE */ - 1345, /* GL_RGBA_MODE */ + 627, /* GL_INDEX_MODE */ + 1355, /* GL_RGBA_MODE */ 386, /* GL_DOUBLEBUFFER */ - 1495, /* GL_STEREO */ - 1303, /* GL_RENDER_MODE */ - 1084, /* GL_PERSPECTIVE_CORRECTION_HINT */ - 1137, /* GL_POINT_SMOOTH_HINT */ - 690, /* GL_LINE_SMOOTH_HINT */ - 1154, /* GL_POLYGON_SMOOTH_HINT */ - 519, /* GL_FOG_HINT */ - 1655, /* GL_TEXTURE_GEN_S */ - 1656, /* GL_TEXTURE_GEN_T */ - 1654, /* GL_TEXTURE_GEN_R */ - 1653, /* GL_TEXTURE_GEN_Q */ - 1097, /* GL_PIXEL_MAP_I_TO_I */ - 1103, /* GL_PIXEL_MAP_S_TO_S */ - 1099, /* GL_PIXEL_MAP_I_TO_R */ - 1095, /* GL_PIXEL_MAP_I_TO_G */ - 1093, /* GL_PIXEL_MAP_I_TO_B */ - 1091, /* GL_PIXEL_MAP_I_TO_A */ - 1101, /* GL_PIXEL_MAP_R_TO_R */ - 1089, /* GL_PIXEL_MAP_G_TO_G */ - 1087, /* GL_PIXEL_MAP_B_TO_B */ - 1085, /* GL_PIXEL_MAP_A_TO_A */ - 1098, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - 1104, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - 1100, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - 1096, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - 1094, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - 1092, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - 1102, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - 1090, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - 1088, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - 1086, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - 1723, /* GL_UNPACK_SWAP_BYTES */ - 1718, /* GL_UNPACK_LSB_FIRST */ - 1719, /* GL_UNPACK_ROW_LENGTH */ - 1722, /* GL_UNPACK_SKIP_ROWS */ - 1721, /* GL_UNPACK_SKIP_PIXELS */ - 1716, /* GL_UNPACK_ALIGNMENT */ - 1072, /* GL_PACK_SWAP_BYTES */ - 1067, /* GL_PACK_LSB_FIRST */ - 1068, /* GL_PACK_ROW_LENGTH */ - 1071, /* GL_PACK_SKIP_ROWS */ - 1070, /* GL_PACK_SKIP_PIXELS */ - 1064, /* GL_PACK_ALIGNMENT */ - 784, /* GL_MAP_COLOR */ - 785, /* GL_MAP_STENCIL */ - 628, /* GL_INDEX_SHIFT */ - 627, /* GL_INDEX_OFFSET */ - 1281, /* GL_RED_SCALE */ - 1279, /* GL_RED_BIAS */ - 1820, /* GL_ZOOM_X */ - 1821, /* GL_ZOOM_Y */ - 589, /* GL_GREEN_SCALE */ - 587, /* GL_GREEN_BIAS */ + 1505, /* GL_STEREO */ + 1313, /* GL_RENDER_MODE */ + 1092, /* GL_PERSPECTIVE_CORRECTION_HINT */ + 1145, /* GL_POINT_SMOOTH_HINT */ + 692, /* GL_LINE_SMOOTH_HINT */ + 1162, /* GL_POLYGON_SMOOTH_HINT */ + 520, /* GL_FOG_HINT */ + 1665, /* GL_TEXTURE_GEN_S */ + 1666, /* GL_TEXTURE_GEN_T */ + 1664, /* GL_TEXTURE_GEN_R */ + 1663, /* GL_TEXTURE_GEN_Q */ + 1105, /* GL_PIXEL_MAP_I_TO_I */ + 1111, /* GL_PIXEL_MAP_S_TO_S */ + 1107, /* GL_PIXEL_MAP_I_TO_R */ + 1103, /* GL_PIXEL_MAP_I_TO_G */ + 1101, /* GL_PIXEL_MAP_I_TO_B */ + 1099, /* GL_PIXEL_MAP_I_TO_A */ + 1109, /* GL_PIXEL_MAP_R_TO_R */ + 1097, /* GL_PIXEL_MAP_G_TO_G */ + 1095, /* GL_PIXEL_MAP_B_TO_B */ + 1093, /* GL_PIXEL_MAP_A_TO_A */ + 1106, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + 1112, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + 1108, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + 1104, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + 1102, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + 1100, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + 1110, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + 1098, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + 1096, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + 1094, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + 1733, /* GL_UNPACK_SWAP_BYTES */ + 1728, /* GL_UNPACK_LSB_FIRST */ + 1729, /* GL_UNPACK_ROW_LENGTH */ + 1732, /* GL_UNPACK_SKIP_ROWS */ + 1731, /* GL_UNPACK_SKIP_PIXELS */ + 1726, /* GL_UNPACK_ALIGNMENT */ + 1080, /* GL_PACK_SWAP_BYTES */ + 1075, /* GL_PACK_LSB_FIRST */ + 1076, /* GL_PACK_ROW_LENGTH */ + 1079, /* GL_PACK_SKIP_ROWS */ + 1078, /* GL_PACK_SKIP_PIXELS */ + 1072, /* GL_PACK_ALIGNMENT */ + 786, /* GL_MAP_COLOR */ + 791, /* GL_MAP_STENCIL */ + 629, /* GL_INDEX_SHIFT */ + 628, /* GL_INDEX_OFFSET */ + 1291, /* GL_RED_SCALE */ + 1289, /* GL_RED_BIAS */ + 1831, /* GL_ZOOM_X */ + 1832, /* GL_ZOOM_Y */ + 590, /* GL_GREEN_SCALE */ + 588, /* GL_GREEN_BIAS */ 92, /* GL_BLUE_SCALE */ 90, /* GL_BLUE_BIAS */ 42, /* GL_ALPHA_SCALE */ 40, /* GL_ALPHA_BIAS */ 365, /* GL_DEPTH_SCALE */ 346, /* GL_DEPTH_BIAS */ - 857, /* GL_MAX_EVAL_ORDER */ - 861, /* GL_MAX_LIGHTS */ - 840, /* GL_MAX_CLIP_PLANES */ - 906, /* GL_MAX_TEXTURE_SIZE */ - 867, /* GL_MAX_PIXEL_MAP_TABLE */ - 836, /* GL_MAX_ATTRIB_STACK_DEPTH */ - 864, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - 865, /* GL_MAX_NAME_STACK_DEPTH */ - 893, /* GL_MAX_PROJECTION_STACK_DEPTH */ - 907, /* GL_MAX_TEXTURE_STACK_DEPTH */ - 921, /* GL_MAX_VIEWPORT_DIMS */ - 837, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - 1502, /* GL_SUBPIXEL_BITS */ - 623, /* GL_INDEX_BITS */ - 1280, /* GL_RED_BITS */ - 588, /* GL_GREEN_BITS */ + 865, /* GL_MAX_EVAL_ORDER */ + 869, /* GL_MAX_LIGHTS */ + 848, /* GL_MAX_CLIP_PLANES */ + 914, /* GL_MAX_TEXTURE_SIZE */ + 875, /* GL_MAX_PIXEL_MAP_TABLE */ + 844, /* GL_MAX_ATTRIB_STACK_DEPTH */ + 872, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + 873, /* GL_MAX_NAME_STACK_DEPTH */ + 901, /* GL_MAX_PROJECTION_STACK_DEPTH */ + 915, /* GL_MAX_TEXTURE_STACK_DEPTH */ + 929, /* GL_MAX_VIEWPORT_DIMS */ + 845, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + 1512, /* GL_SUBPIXEL_BITS */ + 624, /* GL_INDEX_BITS */ + 1290, /* GL_RED_BITS */ + 589, /* GL_GREEN_BITS */ 91, /* GL_BLUE_BITS */ 41, /* GL_ALPHA_BITS */ 347, /* GL_DEPTH_BITS */ - 1477, /* GL_STENCIL_BITS */ + 1487, /* GL_STENCIL_BITS */ 14, /* GL_ACCUM_RED_BITS */ 13, /* GL_ACCUM_GREEN_BITS */ 10, /* GL_ACCUM_BLUE_BITS */ 9, /* GL_ACCUM_ALPHA_BITS */ - 987, /* GL_NAME_STACK_DEPTH */ + 995, /* GL_NAME_STACK_DEPTH */ 61, /* GL_AUTO_NORMAL */ - 730, /* GL_MAP1_COLOR_4 */ - 733, /* GL_MAP1_INDEX */ - 734, /* GL_MAP1_NORMAL */ - 735, /* GL_MAP1_TEXTURE_COORD_1 */ - 736, /* GL_MAP1_TEXTURE_COORD_2 */ - 737, /* GL_MAP1_TEXTURE_COORD_3 */ - 738, /* GL_MAP1_TEXTURE_COORD_4 */ - 739, /* GL_MAP1_VERTEX_3 */ - 740, /* GL_MAP1_VERTEX_4 */ - 757, /* GL_MAP2_COLOR_4 */ - 760, /* GL_MAP2_INDEX */ - 761, /* GL_MAP2_NORMAL */ - 762, /* GL_MAP2_TEXTURE_COORD_1 */ - 763, /* GL_MAP2_TEXTURE_COORD_2 */ - 764, /* GL_MAP2_TEXTURE_COORD_3 */ - 765, /* GL_MAP2_TEXTURE_COORD_4 */ - 766, /* GL_MAP2_VERTEX_3 */ - 767, /* GL_MAP2_VERTEX_4 */ - 731, /* GL_MAP1_GRID_DOMAIN */ - 732, /* GL_MAP1_GRID_SEGMENTS */ - 758, /* GL_MAP2_GRID_DOMAIN */ - 759, /* GL_MAP2_GRID_SEGMENTS */ - 1579, /* GL_TEXTURE_1D */ - 1581, /* GL_TEXTURE_2D */ + 732, /* GL_MAP1_COLOR_4 */ + 735, /* GL_MAP1_INDEX */ + 736, /* GL_MAP1_NORMAL */ + 737, /* GL_MAP1_TEXTURE_COORD_1 */ + 738, /* GL_MAP1_TEXTURE_COORD_2 */ + 739, /* GL_MAP1_TEXTURE_COORD_3 */ + 740, /* GL_MAP1_TEXTURE_COORD_4 */ + 741, /* GL_MAP1_VERTEX_3 */ + 742, /* GL_MAP1_VERTEX_4 */ + 759, /* GL_MAP2_COLOR_4 */ + 762, /* GL_MAP2_INDEX */ + 763, /* GL_MAP2_NORMAL */ + 764, /* GL_MAP2_TEXTURE_COORD_1 */ + 765, /* GL_MAP2_TEXTURE_COORD_2 */ + 766, /* GL_MAP2_TEXTURE_COORD_3 */ + 767, /* GL_MAP2_TEXTURE_COORD_4 */ + 768, /* GL_MAP2_VERTEX_3 */ + 769, /* GL_MAP2_VERTEX_4 */ + 733, /* GL_MAP1_GRID_DOMAIN */ + 734, /* GL_MAP1_GRID_SEGMENTS */ + 760, /* GL_MAP2_GRID_DOMAIN */ + 761, /* GL_MAP2_GRID_SEGMENTS */ + 1589, /* GL_TEXTURE_1D */ + 1591, /* GL_TEXTURE_2D */ 474, /* GL_FEEDBACK_BUFFER_POINTER */ 475, /* GL_FEEDBACK_BUFFER_SIZE */ 476, /* GL_FEEDBACK_BUFFER_TYPE */ - 1389, /* GL_SELECTION_BUFFER_POINTER */ - 1390, /* GL_SELECTION_BUFFER_SIZE */ - 1693, /* GL_TEXTURE_WIDTH */ - 1660, /* GL_TEXTURE_HEIGHT */ - 1616, /* GL_TEXTURE_COMPONENTS */ - 1600, /* GL_TEXTURE_BORDER_COLOR */ - 1599, /* GL_TEXTURE_BORDER */ + 1399, /* GL_SELECTION_BUFFER_POINTER */ + 1400, /* GL_SELECTION_BUFFER_SIZE */ + 1703, /* GL_TEXTURE_WIDTH */ + 1670, /* GL_TEXTURE_HEIGHT */ + 1626, /* GL_TEXTURE_COMPONENTS */ + 1610, /* GL_TEXTURE_BORDER_COLOR */ + 1609, /* GL_TEXTURE_BORDER */ 378, /* GL_DONT_CARE */ 472, /* GL_FASTEST */ - 995, /* GL_NICEST */ + 1003, /* GL_NICEST */ 47, /* GL_AMBIENT */ 375, /* GL_DIFFUSE */ - 1437, /* GL_SPECULAR */ - 1158, /* GL_POSITION */ - 1440, /* GL_SPOT_DIRECTION */ - 1441, /* GL_SPOT_EXPONENT */ - 1439, /* GL_SPOT_CUTOFF */ + 1447, /* GL_SPECULAR */ + 1166, /* GL_POSITION */ + 1450, /* GL_SPOT_DIRECTION */ + 1451, /* GL_SPOT_EXPONENT */ + 1449, /* GL_SPOT_CUTOFF */ 271, /* GL_CONSTANT_ATTENUATION */ - 680, /* GL_LINEAR_ATTENUATION */ - 1255, /* GL_QUADRATIC_ATTENUATION */ + 682, /* GL_LINEAR_ATTENUATION */ + 1264, /* GL_QUADRATIC_ATTENUATION */ 241, /* GL_COMPILE */ 242, /* GL_COMPILE_AND_EXECUTE */ 117, /* GL_BYTE */ - 1724, /* GL_UNSIGNED_BYTE */ - 1403, /* GL_SHORT */ - 1735, /* GL_UNSIGNED_SHORT */ - 631, /* GL_INT */ - 1727, /* GL_UNSIGNED_INT */ - 479, /* GL_FLOAT */ + 1734, /* GL_UNSIGNED_BYTE */ + 1413, /* GL_SHORT */ + 1745, /* GL_UNSIGNED_SHORT */ + 632, /* GL_INT */ + 1737, /* GL_UNSIGNED_INT */ + 480, /* GL_FLOAT */ 1, /* GL_2_BYTES */ 5, /* GL_3_BYTES */ 7, /* GL_4_BYTES */ @@ -4009,284 +4031,284 @@ static const unsigned reduced_enums[1321] = 51, /* GL_AND_REVERSE */ 295, /* GL_COPY */ 50, /* GL_AND_INVERTED */ - 997, /* GL_NOOP */ - 1816, /* GL_XOR */ - 1059, /* GL_OR */ - 998, /* GL_NOR */ + 1005, /* GL_NOOP */ + 1827, /* GL_XOR */ + 1067, /* GL_OR */ + 1006, /* GL_NOR */ 462, /* GL_EQUIV */ - 658, /* GL_INVERT */ - 1062, /* GL_OR_REVERSE */ + 659, /* GL_INVERT */ + 1070, /* GL_OR_REVERSE */ 296, /* GL_COPY_INVERTED */ - 1061, /* GL_OR_INVERTED */ - 988, /* GL_NAND */ - 1394, /* GL_SET */ + 1069, /* GL_OR_INVERTED */ + 996, /* GL_NAND */ + 1404, /* GL_SET */ 459, /* GL_EMISSION */ - 1402, /* GL_SHININESS */ + 1412, /* GL_SHININESS */ 48, /* GL_AMBIENT_AND_DIFFUSE */ 187, /* GL_COLOR_INDEXES */ - 938, /* GL_MODELVIEW */ - 1234, /* GL_PROJECTION */ - 1514, /* GL_TEXTURE */ + 946, /* GL_MODELVIEW */ + 1242, /* GL_PROJECTION */ + 1524, /* GL_TEXTURE */ 144, /* GL_COLOR */ 342, /* GL_DEPTH */ - 1463, /* GL_STENCIL */ + 1473, /* GL_STENCIL */ 186, /* GL_COLOR_INDEX */ - 1482, /* GL_STENCIL_INDEX */ + 1492, /* GL_STENCIL_INDEX */ 353, /* GL_DEPTH_COMPONENT */ - 1276, /* GL_RED */ - 586, /* GL_GREEN */ + 1286, /* GL_RED */ + 587, /* GL_GREEN */ 89, /* GL_BLUE */ 31, /* GL_ALPHA */ - 1311, /* GL_RGB */ - 1330, /* GL_RGBA */ - 708, /* GL_LUMINANCE */ - 729, /* GL_LUMINANCE_ALPHA */ + 1321, /* GL_RGB */ + 1340, /* GL_RGBA */ + 710, /* GL_LUMINANCE */ + 731, /* GL_LUMINANCE_ALPHA */ 72, /* GL_BITMAP */ - 1114, /* GL_POINT */ - 678, /* GL_LINE */ + 1122, /* GL_POINT */ + 680, /* GL_LINE */ 477, /* GL_FILL */ - 1285, /* GL_RENDER */ + 1295, /* GL_RENDER */ 473, /* GL_FEEDBACK */ - 1388, /* GL_SELECT */ - 478, /* GL_FLAT */ - 1412, /* GL_SMOOTH */ - 659, /* GL_KEEP */ - 1305, /* GL_REPLACE */ - 613, /* GL_INCR */ + 1398, /* GL_SELECT */ + 479, /* GL_FLAT */ + 1422, /* GL_SMOOTH */ + 660, /* GL_KEEP */ + 1315, /* GL_REPLACE */ + 614, /* GL_INCR */ 338, /* GL_DECR */ - 1750, /* GL_VENDOR */ - 1302, /* GL_RENDERER */ - 1751, /* GL_VERSION */ + 1760, /* GL_VENDOR */ + 1312, /* GL_RENDERER */ + 1761, /* GL_VERSION */ 466, /* GL_EXTENSIONS */ - 1353, /* GL_S */ - 1505, /* GL_T */ - 1265, /* GL_R */ - 1254, /* GL_Q */ - 974, /* GL_MODULATE */ + 1363, /* GL_S */ + 1515, /* GL_T */ + 1275, /* GL_R */ + 1263, /* GL_Q */ + 982, /* GL_MODULATE */ 337, /* GL_DECAL */ - 1650, /* GL_TEXTURE_ENV_MODE */ - 1649, /* GL_TEXTURE_ENV_COLOR */ - 1648, /* GL_TEXTURE_ENV */ + 1660, /* GL_TEXTURE_ENV_MODE */ + 1659, /* GL_TEXTURE_ENV_COLOR */ + 1658, /* GL_TEXTURE_ENV */ 467, /* GL_EYE_LINEAR */ - 1021, /* GL_OBJECT_LINEAR */ - 1438, /* GL_SPHERE_MAP */ - 1652, /* GL_TEXTURE_GEN_MODE */ - 1023, /* GL_OBJECT_PLANE */ + 1029, /* GL_OBJECT_LINEAR */ + 1448, /* GL_SPHERE_MAP */ + 1662, /* GL_TEXTURE_GEN_MODE */ + 1031, /* GL_OBJECT_PLANE */ 468, /* GL_EYE_PLANE */ - 989, /* GL_NEAREST */ - 679, /* GL_LINEAR */ - 993, /* GL_NEAREST_MIPMAP_NEAREST */ - 684, /* GL_LINEAR_MIPMAP_NEAREST */ - 992, /* GL_NEAREST_MIPMAP_LINEAR */ - 683, /* GL_LINEAR_MIPMAP_LINEAR */ - 1673, /* GL_TEXTURE_MAG_FILTER */ - 1681, /* GL_TEXTURE_MIN_FILTER */ - 1695, /* GL_TEXTURE_WRAP_S */ - 1696, /* GL_TEXTURE_WRAP_T */ + 997, /* GL_NEAREST */ + 681, /* GL_LINEAR */ + 1001, /* GL_NEAREST_MIPMAP_NEAREST */ + 686, /* GL_LINEAR_MIPMAP_NEAREST */ + 1000, /* GL_NEAREST_MIPMAP_LINEAR */ + 685, /* GL_LINEAR_MIPMAP_LINEAR */ + 1683, /* GL_TEXTURE_MAG_FILTER */ + 1691, /* GL_TEXTURE_MIN_FILTER */ + 1705, /* GL_TEXTURE_WRAP_S */ + 1706, /* GL_TEXTURE_WRAP_T */ 123, /* GL_CLAMP */ - 1304, /* GL_REPEAT */ - 1152, /* GL_POLYGON_OFFSET_UNITS */ - 1151, /* GL_POLYGON_OFFSET_POINT */ - 1150, /* GL_POLYGON_OFFSET_LINE */ - 1266, /* GL_R3_G3_B2 */ - 1747, /* GL_V2F */ - 1748, /* GL_V3F */ + 1314, /* GL_REPEAT */ + 1160, /* GL_POLYGON_OFFSET_UNITS */ + 1159, /* GL_POLYGON_OFFSET_POINT */ + 1158, /* GL_POLYGON_OFFSET_LINE */ + 1276, /* GL_R3_G3_B2 */ + 1757, /* GL_V2F */ + 1758, /* GL_V3F */ 120, /* GL_C4UB_V2F */ 121, /* GL_C4UB_V3F */ 118, /* GL_C3F_V3F */ - 986, /* GL_N3F_V3F */ + 994, /* GL_N3F_V3F */ 119, /* GL_C4F_N3F_V3F */ - 1510, /* GL_T2F_V3F */ - 1512, /* GL_T4F_V4F */ - 1508, /* GL_T2F_C4UB_V3F */ - 1506, /* GL_T2F_C3F_V3F */ - 1509, /* GL_T2F_N3F_V3F */ - 1507, /* GL_T2F_C4F_N3F_V3F */ - 1511, /* GL_T4F_C4F_N3F_V4F */ + 1520, /* GL_T2F_V3F */ + 1522, /* GL_T4F_V4F */ + 1518, /* GL_T2F_C4UB_V3F */ + 1516, /* GL_T2F_C3F_V3F */ + 1519, /* GL_T2F_N3F_V3F */ + 1517, /* GL_T2F_C4F_N3F_V3F */ + 1521, /* GL_T4F_C4F_N3F_V4F */ 136, /* GL_CLIP_PLANE0 */ 137, /* GL_CLIP_PLANE1 */ 138, /* GL_CLIP_PLANE2 */ 139, /* GL_CLIP_PLANE3 */ 140, /* GL_CLIP_PLANE4 */ 141, /* GL_CLIP_PLANE5 */ - 663, /* GL_LIGHT0 */ - 664, /* GL_LIGHT1 */ - 665, /* GL_LIGHT2 */ - 666, /* GL_LIGHT3 */ - 667, /* GL_LIGHT4 */ - 668, /* GL_LIGHT5 */ - 669, /* GL_LIGHT6 */ - 670, /* GL_LIGHT7 */ - 590, /* GL_HINT_BIT */ + 665, /* GL_LIGHT0 */ + 666, /* GL_LIGHT1 */ + 667, /* GL_LIGHT2 */ + 668, /* GL_LIGHT3 */ + 669, /* GL_LIGHT4 */ + 670, /* GL_LIGHT5 */ + 671, /* GL_LIGHT6 */ + 672, /* GL_LIGHT7 */ + 591, /* GL_HINT_BIT */ 273, /* GL_CONSTANT_COLOR */ - 1033, /* GL_ONE_MINUS_CONSTANT_COLOR */ + 1041, /* GL_ONE_MINUS_CONSTANT_COLOR */ 268, /* GL_CONSTANT_ALPHA */ - 1031, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + 1039, /* GL_ONE_MINUS_CONSTANT_ALPHA */ 75, /* GL_BLEND_COLOR */ - 574, /* GL_FUNC_ADD */ - 922, /* GL_MIN */ - 833, /* GL_MAX */ + 575, /* GL_FUNC_ADD */ + 930, /* GL_MIN */ + 841, /* GL_MAX */ 80, /* GL_BLEND_EQUATION */ - 578, /* GL_FUNC_SUBTRACT */ - 576, /* GL_FUNC_REVERSE_SUBTRACT */ + 579, /* GL_FUNC_SUBTRACT */ + 577, /* GL_FUNC_REVERSE_SUBTRACT */ 276, /* GL_CONVOLUTION_1D */ 277, /* GL_CONVOLUTION_2D */ - 1391, /* GL_SEPARABLE_2D */ + 1401, /* GL_SEPARABLE_2D */ 280, /* GL_CONVOLUTION_BORDER_MODE */ 284, /* GL_CONVOLUTION_FILTER_SCALE */ 282, /* GL_CONVOLUTION_FILTER_BIAS */ - 1277, /* GL_REDUCE */ + 1287, /* GL_REDUCE */ 286, /* GL_CONVOLUTION_FORMAT */ 290, /* GL_CONVOLUTION_WIDTH */ 288, /* GL_CONVOLUTION_HEIGHT */ - 848, /* GL_MAX_CONVOLUTION_WIDTH */ - 846, /* GL_MAX_CONVOLUTION_HEIGHT */ - 1191, /* GL_POST_CONVOLUTION_RED_SCALE */ - 1187, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - 1182, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - 1178, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - 1189, /* GL_POST_CONVOLUTION_RED_BIAS */ - 1185, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - 1180, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - 1176, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - 591, /* GL_HISTOGRAM */ - 1238, /* GL_PROXY_HISTOGRAM */ - 607, /* GL_HISTOGRAM_WIDTH */ - 597, /* GL_HISTOGRAM_FORMAT */ - 603, /* GL_HISTOGRAM_RED_SIZE */ - 599, /* GL_HISTOGRAM_GREEN_SIZE */ - 594, /* GL_HISTOGRAM_BLUE_SIZE */ - 592, /* GL_HISTOGRAM_ALPHA_SIZE */ - 601, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - 605, /* GL_HISTOGRAM_SINK */ - 923, /* GL_MINMAX */ - 925, /* GL_MINMAX_FORMAT */ - 927, /* GL_MINMAX_SINK */ - 1513, /* GL_TABLE_TOO_LARGE_EXT */ - 1726, /* GL_UNSIGNED_BYTE_3_3_2 */ - 1737, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - 1739, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - 1732, /* GL_UNSIGNED_INT_8_8_8_8 */ - 1728, /* GL_UNSIGNED_INT_10_10_10_2 */ - 1149, /* GL_POLYGON_OFFSET_FILL */ - 1148, /* GL_POLYGON_OFFSET_FACTOR */ - 1147, /* GL_POLYGON_OFFSET_BIAS */ - 1308, /* GL_RESCALE_NORMAL */ + 856, /* GL_MAX_CONVOLUTION_WIDTH */ + 854, /* GL_MAX_CONVOLUTION_HEIGHT */ + 1199, /* GL_POST_CONVOLUTION_RED_SCALE */ + 1195, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + 1190, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + 1186, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + 1197, /* GL_POST_CONVOLUTION_RED_BIAS */ + 1193, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + 1188, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + 1184, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + 592, /* GL_HISTOGRAM */ + 1247, /* GL_PROXY_HISTOGRAM */ + 608, /* GL_HISTOGRAM_WIDTH */ + 598, /* GL_HISTOGRAM_FORMAT */ + 604, /* GL_HISTOGRAM_RED_SIZE */ + 600, /* GL_HISTOGRAM_GREEN_SIZE */ + 595, /* GL_HISTOGRAM_BLUE_SIZE */ + 593, /* GL_HISTOGRAM_ALPHA_SIZE */ + 602, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + 606, /* GL_HISTOGRAM_SINK */ + 931, /* GL_MINMAX */ + 933, /* GL_MINMAX_FORMAT */ + 935, /* GL_MINMAX_SINK */ + 1523, /* GL_TABLE_TOO_LARGE_EXT */ + 1736, /* GL_UNSIGNED_BYTE_3_3_2 */ + 1747, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 1749, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 1742, /* GL_UNSIGNED_INT_8_8_8_8 */ + 1738, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1157, /* GL_POLYGON_OFFSET_FILL */ + 1156, /* GL_POLYGON_OFFSET_FACTOR */ + 1155, /* GL_POLYGON_OFFSET_BIAS */ + 1318, /* GL_RESCALE_NORMAL */ 36, /* GL_ALPHA4 */ 38, /* GL_ALPHA8 */ 32, /* GL_ALPHA12 */ 34, /* GL_ALPHA16 */ - 719, /* GL_LUMINANCE4 */ - 725, /* GL_LUMINANCE8 */ - 709, /* GL_LUMINANCE12 */ - 715, /* GL_LUMINANCE16 */ - 720, /* GL_LUMINANCE4_ALPHA4 */ - 723, /* GL_LUMINANCE6_ALPHA2 */ - 726, /* GL_LUMINANCE8_ALPHA8 */ - 712, /* GL_LUMINANCE12_ALPHA4 */ - 710, /* GL_LUMINANCE12_ALPHA12 */ - 716, /* GL_LUMINANCE16_ALPHA16 */ - 632, /* GL_INTENSITY */ - 637, /* GL_INTENSITY4 */ - 639, /* GL_INTENSITY8 */ - 633, /* GL_INTENSITY12 */ - 635, /* GL_INTENSITY16 */ - 1320, /* GL_RGB2_EXT */ - 1321, /* GL_RGB4 */ - 1324, /* GL_RGB5 */ - 1328, /* GL_RGB8 */ - 1312, /* GL_RGB10 */ - 1316, /* GL_RGB12 */ - 1318, /* GL_RGB16 */ - 1335, /* GL_RGBA2 */ - 1337, /* GL_RGBA4 */ - 1325, /* GL_RGB5_A1 */ - 1341, /* GL_RGBA8 */ - 1313, /* GL_RGB10_A2 */ - 1331, /* GL_RGBA12 */ - 1333, /* GL_RGBA16 */ - 1686, /* GL_TEXTURE_RED_SIZE */ - 1658, /* GL_TEXTURE_GREEN_SIZE */ - 1597, /* GL_TEXTURE_BLUE_SIZE */ - 1584, /* GL_TEXTURE_ALPHA_SIZE */ - 1671, /* GL_TEXTURE_LUMINANCE_SIZE */ - 1662, /* GL_TEXTURE_INTENSITY_SIZE */ - 1306, /* GL_REPLACE_EXT */ - 1242, /* GL_PROXY_TEXTURE_1D */ - 1245, /* GL_PROXY_TEXTURE_2D */ - 1691, /* GL_TEXTURE_TOO_LARGE_EXT */ - 1683, /* GL_TEXTURE_PRIORITY */ - 1688, /* GL_TEXTURE_RESIDENT */ - 1587, /* GL_TEXTURE_BINDING_1D */ - 1589, /* GL_TEXTURE_BINDING_2D */ - 1591, /* GL_TEXTURE_BINDING_3D */ - 1069, /* GL_PACK_SKIP_IMAGES */ - 1065, /* GL_PACK_IMAGE_HEIGHT */ - 1720, /* GL_UNPACK_SKIP_IMAGES */ - 1717, /* GL_UNPACK_IMAGE_HEIGHT */ - 1583, /* GL_TEXTURE_3D */ - 1248, /* GL_PROXY_TEXTURE_3D */ - 1645, /* GL_TEXTURE_DEPTH */ - 1694, /* GL_TEXTURE_WRAP_R */ - 834, /* GL_MAX_3D_TEXTURE_SIZE */ - 1752, /* GL_VERTEX_ARRAY */ - 1000, /* GL_NORMAL_ARRAY */ + 721, /* GL_LUMINANCE4 */ + 727, /* GL_LUMINANCE8 */ + 711, /* GL_LUMINANCE12 */ + 717, /* GL_LUMINANCE16 */ + 722, /* GL_LUMINANCE4_ALPHA4 */ + 725, /* GL_LUMINANCE6_ALPHA2 */ + 728, /* GL_LUMINANCE8_ALPHA8 */ + 714, /* GL_LUMINANCE12_ALPHA4 */ + 712, /* GL_LUMINANCE12_ALPHA12 */ + 718, /* GL_LUMINANCE16_ALPHA16 */ + 633, /* GL_INTENSITY */ + 638, /* GL_INTENSITY4 */ + 640, /* GL_INTENSITY8 */ + 634, /* GL_INTENSITY12 */ + 636, /* GL_INTENSITY16 */ + 1330, /* GL_RGB2_EXT */ + 1331, /* GL_RGB4 */ + 1334, /* GL_RGB5 */ + 1338, /* GL_RGB8 */ + 1322, /* GL_RGB10 */ + 1326, /* GL_RGB12 */ + 1328, /* GL_RGB16 */ + 1345, /* GL_RGBA2 */ + 1347, /* GL_RGBA4 */ + 1335, /* GL_RGB5_A1 */ + 1351, /* GL_RGBA8 */ + 1323, /* GL_RGB10_A2 */ + 1341, /* GL_RGBA12 */ + 1343, /* GL_RGBA16 */ + 1696, /* GL_TEXTURE_RED_SIZE */ + 1668, /* GL_TEXTURE_GREEN_SIZE */ + 1607, /* GL_TEXTURE_BLUE_SIZE */ + 1594, /* GL_TEXTURE_ALPHA_SIZE */ + 1681, /* GL_TEXTURE_LUMINANCE_SIZE */ + 1672, /* GL_TEXTURE_INTENSITY_SIZE */ + 1316, /* GL_REPLACE_EXT */ + 1251, /* GL_PROXY_TEXTURE_1D */ + 1254, /* GL_PROXY_TEXTURE_2D */ + 1701, /* GL_TEXTURE_TOO_LARGE_EXT */ + 1693, /* GL_TEXTURE_PRIORITY */ + 1698, /* GL_TEXTURE_RESIDENT */ + 1597, /* GL_TEXTURE_BINDING_1D */ + 1599, /* GL_TEXTURE_BINDING_2D */ + 1601, /* GL_TEXTURE_BINDING_3D */ + 1077, /* GL_PACK_SKIP_IMAGES */ + 1073, /* GL_PACK_IMAGE_HEIGHT */ + 1730, /* GL_UNPACK_SKIP_IMAGES */ + 1727, /* GL_UNPACK_IMAGE_HEIGHT */ + 1593, /* GL_TEXTURE_3D */ + 1257, /* GL_PROXY_TEXTURE_3D */ + 1655, /* GL_TEXTURE_DEPTH */ + 1704, /* GL_TEXTURE_WRAP_R */ + 842, /* GL_MAX_3D_TEXTURE_SIZE */ + 1762, /* GL_VERTEX_ARRAY */ + 1008, /* GL_NORMAL_ARRAY */ 145, /* GL_COLOR_ARRAY */ - 617, /* GL_INDEX_ARRAY */ - 1624, /* GL_TEXTURE_COORD_ARRAY */ + 618, /* GL_INDEX_ARRAY */ + 1634, /* GL_TEXTURE_COORD_ARRAY */ 451, /* GL_EDGE_FLAG_ARRAY */ - 1757, /* GL_VERTEX_ARRAY_SIZE */ - 1759, /* GL_VERTEX_ARRAY_TYPE */ - 1758, /* GL_VERTEX_ARRAY_STRIDE */ - 1005, /* GL_NORMAL_ARRAY_TYPE */ - 1004, /* GL_NORMAL_ARRAY_STRIDE */ + 1768, /* GL_VERTEX_ARRAY_SIZE */ + 1770, /* GL_VERTEX_ARRAY_TYPE */ + 1769, /* GL_VERTEX_ARRAY_STRIDE */ + 1013, /* GL_NORMAL_ARRAY_TYPE */ + 1012, /* GL_NORMAL_ARRAY_STRIDE */ 149, /* GL_COLOR_ARRAY_SIZE */ 151, /* GL_COLOR_ARRAY_TYPE */ 150, /* GL_COLOR_ARRAY_STRIDE */ - 622, /* GL_INDEX_ARRAY_TYPE */ - 621, /* GL_INDEX_ARRAY_STRIDE */ - 1628, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - 1630, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - 1629, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 623, /* GL_INDEX_ARRAY_TYPE */ + 622, /* GL_INDEX_ARRAY_STRIDE */ + 1638, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 1640, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 1639, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ 455, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - 1756, /* GL_VERTEX_ARRAY_POINTER */ - 1003, /* GL_NORMAL_ARRAY_POINTER */ + 1767, /* GL_VERTEX_ARRAY_POINTER */ + 1011, /* GL_NORMAL_ARRAY_POINTER */ 148, /* GL_COLOR_ARRAY_POINTER */ - 620, /* GL_INDEX_ARRAY_POINTER */ - 1627, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 621, /* GL_INDEX_ARRAY_POINTER */ + 1637, /* GL_TEXTURE_COORD_ARRAY_POINTER */ 454, /* GL_EDGE_FLAG_ARRAY_POINTER */ - 979, /* GL_MULTISAMPLE */ - 1365, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - 1367, /* GL_SAMPLE_ALPHA_TO_ONE */ - 1372, /* GL_SAMPLE_COVERAGE */ - 1369, /* GL_SAMPLE_BUFFERS */ - 1360, /* GL_SAMPLES */ - 1376, /* GL_SAMPLE_COVERAGE_VALUE */ - 1374, /* GL_SAMPLE_COVERAGE_INVERT */ + 987, /* GL_MULTISAMPLE */ + 1375, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + 1377, /* GL_SAMPLE_ALPHA_TO_ONE */ + 1382, /* GL_SAMPLE_COVERAGE */ + 1379, /* GL_SAMPLE_BUFFERS */ + 1370, /* GL_SAMPLES */ + 1386, /* GL_SAMPLE_COVERAGE_VALUE */ + 1384, /* GL_SAMPLE_COVERAGE_INVERT */ 192, /* GL_COLOR_MATRIX */ 194, /* GL_COLOR_MATRIX_STACK_DEPTH */ - 842, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - 1174, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - 1170, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - 1165, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - 1161, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - 1172, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - 1168, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - 1163, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - 1159, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - 1607, /* GL_TEXTURE_COLOR_TABLE_SGI */ - 1249, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - 1609, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 850, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + 1182, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + 1178, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + 1173, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + 1169, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + 1180, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + 1176, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + 1171, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + 1167, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + 1617, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1258, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + 1619, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ 79, /* GL_BLEND_DST_RGB */ 88, /* GL_BLEND_SRC_RGB */ 78, /* GL_BLEND_DST_ALPHA */ 87, /* GL_BLEND_SRC_ALPHA */ 198, /* GL_COLOR_TABLE */ - 1184, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - 1167, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - 1237, /* GL_PROXY_COLOR_TABLE */ - 1241, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - 1240, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + 1192, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + 1175, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + 1246, /* GL_PROXY_COLOR_TABLE */ + 1250, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + 1249, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ 222, /* GL_COLOR_TABLE_SCALE */ 202, /* GL_COLOR_TABLE_BIAS */ 207, /* GL_COLOR_TABLE_FORMAT */ @@ -4299,374 +4321,374 @@ static const unsigned reduced_enums[1321] = 213, /* GL_COLOR_TABLE_INTENSITY_SIZE */ 70, /* GL_BGR */ 71, /* GL_BGRA */ - 856, /* GL_MAX_ELEMENTS_VERTICES */ - 855, /* GL_MAX_ELEMENTS_INDICES */ - 1661, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 864, /* GL_MAX_ELEMENTS_VERTICES */ + 863, /* GL_MAX_ELEMENTS_INDICES */ + 1671, /* GL_TEXTURE_INDEX_SIZE_EXT */ 142, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - 1131, /* GL_POINT_SIZE_MIN */ - 1127, /* GL_POINT_SIZE_MAX */ - 1121, /* GL_POINT_FADE_THRESHOLD_SIZE */ - 1117, /* GL_POINT_DISTANCE_ATTENUATION */ + 1139, /* GL_POINT_SIZE_MIN */ + 1135, /* GL_POINT_SIZE_MAX */ + 1129, /* GL_POINT_FADE_THRESHOLD_SIZE */ + 1125, /* GL_POINT_DISTANCE_ATTENUATION */ 124, /* GL_CLAMP_TO_BORDER */ 127, /* GL_CLAMP_TO_EDGE */ - 1682, /* GL_TEXTURE_MIN_LOD */ - 1680, /* GL_TEXTURE_MAX_LOD */ - 1586, /* GL_TEXTURE_BASE_LEVEL */ - 1679, /* GL_TEXTURE_MAX_LEVEL */ - 610, /* GL_IGNORE_BORDER_HP */ + 1692, /* GL_TEXTURE_MIN_LOD */ + 1690, /* GL_TEXTURE_MAX_LOD */ + 1596, /* GL_TEXTURE_BASE_LEVEL */ + 1689, /* GL_TEXTURE_MAX_LEVEL */ + 611, /* GL_IGNORE_BORDER_HP */ 272, /* GL_CONSTANT_BORDER_HP */ - 1307, /* GL_REPLICATE_BORDER_HP */ + 1317, /* GL_REPLICATE_BORDER_HP */ 278, /* GL_CONVOLUTION_BORDER_COLOR */ - 1028, /* GL_OCCLUSION_TEST_HP */ - 1029, /* GL_OCCLUSION_TEST_RESULT_HP */ - 681, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - 1601, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - 1603, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - 1605, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - 1606, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1604, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - 1602, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - 838, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - 839, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1194, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - 1196, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - 1193, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - 1195, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - 1669, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - 1670, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - 1668, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - 580, /* GL_GENERATE_MIPMAP */ - 581, /* GL_GENERATE_MIPMAP_HINT */ - 522, /* GL_FOG_OFFSET_SGIX */ - 523, /* GL_FOG_OFFSET_VALUE_SGIX */ - 1615, /* GL_TEXTURE_COMPARE_SGIX */ - 1614, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - 1665, /* GL_TEXTURE_LEQUAL_R_SGIX */ - 1657, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 1036, /* GL_OCCLUSION_TEST_HP */ + 1037, /* GL_OCCLUSION_TEST_RESULT_HP */ + 683, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + 1611, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1613, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1615, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1616, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1614, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1612, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 846, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + 847, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1202, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + 1204, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + 1201, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + 1203, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + 1679, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 1680, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 1678, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 581, /* GL_GENERATE_MIPMAP */ + 582, /* GL_GENERATE_MIPMAP_HINT */ + 523, /* GL_FOG_OFFSET_SGIX */ + 524, /* GL_FOG_OFFSET_VALUE_SGIX */ + 1625, /* GL_TEXTURE_COMPARE_SGIX */ + 1624, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 1675, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 1667, /* GL_TEXTURE_GEQUAL_R_SGIX */ 354, /* GL_DEPTH_COMPONENT16 */ 357, /* GL_DEPTH_COMPONENT24 */ 360, /* GL_DEPTH_COMPONENT32 */ 302, /* GL_CULL_VERTEX_EXT */ 304, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ 303, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - 1813, /* GL_WRAP_BORDER_SUN */ - 1608, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - 674, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - 1405, /* GL_SINGLE_COLOR */ - 1392, /* GL_SEPARATE_SPECULAR_COLOR */ - 1401, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - 533, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - 534, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - 541, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - 536, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - 532, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - 531, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - 535, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - 542, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - 553, /* GL_FRAMEBUFFER_DEFAULT */ - 566, /* GL_FRAMEBUFFER_UNDEFINED */ + 1824, /* GL_WRAP_BORDER_SUN */ + 1618, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 676, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + 1415, /* GL_SINGLE_COLOR */ + 1402, /* GL_SEPARATE_SPECULAR_COLOR */ + 1411, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + 534, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + 535, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + 542, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + 537, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + 533, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + 532, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + 536, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + 543, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + 554, /* GL_FRAMEBUFFER_DEFAULT */ + 567, /* GL_FRAMEBUFFER_UNDEFINED */ 367, /* GL_DEPTH_STENCIL_ATTACHMENT */ - 616, /* GL_INDEX */ - 1725, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - 1740, /* GL_UNSIGNED_SHORT_5_6_5 */ - 1741, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - 1738, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - 1736, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - 1733, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - 1731, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - 1677, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - 1678, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - 1676, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - 930, /* GL_MIRRORED_REPEAT */ - 1348, /* GL_RGB_S3TC */ - 1323, /* GL_RGB4_S3TC */ - 1346, /* GL_RGBA_S3TC */ - 1340, /* GL_RGBA4_S3TC */ - 1344, /* GL_RGBA_DXT5_S3TC */ - 1338, /* GL_RGBA4_DXT5_S3TC */ + 617, /* GL_INDEX */ + 1735, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 1750, /* GL_UNSIGNED_SHORT_5_6_5 */ + 1751, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 1748, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 1746, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 1743, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 1741, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 1687, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 1688, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 1686, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 938, /* GL_MIRRORED_REPEAT */ + 1358, /* GL_RGB_S3TC */ + 1333, /* GL_RGB4_S3TC */ + 1356, /* GL_RGBA_S3TC */ + 1350, /* GL_RGBA4_S3TC */ + 1354, /* GL_RGBA_DXT5_S3TC */ + 1348, /* GL_RGBA4_DXT5_S3TC */ 261, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ 256, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ 257, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ 258, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - 991, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - 990, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - 682, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - 509, /* GL_FOG_COORDINATE_SOURCE */ - 501, /* GL_FOG_COORD */ - 525, /* GL_FRAGMENT_DEPTH */ + 999, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + 998, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + 684, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + 510, /* GL_FOG_COORDINATE_SOURCE */ + 502, /* GL_FOG_COORD */ + 526, /* GL_FRAGMENT_DEPTH */ 308, /* GL_CURRENT_FOG_COORD */ - 508, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - 507, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - 506, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - 503, /* GL_FOG_COORDINATE_ARRAY */ + 509, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + 508, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + 507, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + 504, /* GL_FOG_COORDINATE_ARRAY */ 196, /* GL_COLOR_SUM */ 328, /* GL_CURRENT_SECONDARY_COLOR */ - 1385, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - 1387, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - 1386, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - 1384, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - 1381, /* GL_SECONDARY_COLOR_ARRAY */ + 1395, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + 1397, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + 1396, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + 1394, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + 1391, /* GL_SECONDARY_COLOR_ARRAY */ 326, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ 28, /* GL_ALIASED_POINT_SIZE_RANGE */ 27, /* GL_ALIASED_LINE_WIDTH_RANGE */ - 1515, /* GL_TEXTURE0 */ - 1517, /* GL_TEXTURE1 */ - 1539, /* GL_TEXTURE2 */ - 1561, /* GL_TEXTURE3 */ - 1567, /* GL_TEXTURE4 */ - 1569, /* GL_TEXTURE5 */ - 1571, /* GL_TEXTURE6 */ - 1573, /* GL_TEXTURE7 */ - 1575, /* GL_TEXTURE8 */ - 1577, /* GL_TEXTURE9 */ - 1518, /* GL_TEXTURE10 */ - 1520, /* GL_TEXTURE11 */ - 1522, /* GL_TEXTURE12 */ - 1524, /* GL_TEXTURE13 */ - 1526, /* GL_TEXTURE14 */ - 1528, /* GL_TEXTURE15 */ - 1530, /* GL_TEXTURE16 */ - 1532, /* GL_TEXTURE17 */ - 1534, /* GL_TEXTURE18 */ - 1536, /* GL_TEXTURE19 */ - 1540, /* GL_TEXTURE20 */ - 1542, /* GL_TEXTURE21 */ - 1544, /* GL_TEXTURE22 */ - 1546, /* GL_TEXTURE23 */ - 1548, /* GL_TEXTURE24 */ - 1550, /* GL_TEXTURE25 */ - 1552, /* GL_TEXTURE26 */ - 1554, /* GL_TEXTURE27 */ - 1556, /* GL_TEXTURE28 */ - 1558, /* GL_TEXTURE29 */ - 1562, /* GL_TEXTURE30 */ - 1564, /* GL_TEXTURE31 */ + 1525, /* GL_TEXTURE0 */ + 1527, /* GL_TEXTURE1 */ + 1549, /* GL_TEXTURE2 */ + 1571, /* GL_TEXTURE3 */ + 1577, /* GL_TEXTURE4 */ + 1579, /* GL_TEXTURE5 */ + 1581, /* GL_TEXTURE6 */ + 1583, /* GL_TEXTURE7 */ + 1585, /* GL_TEXTURE8 */ + 1587, /* GL_TEXTURE9 */ + 1528, /* GL_TEXTURE10 */ + 1530, /* GL_TEXTURE11 */ + 1532, /* GL_TEXTURE12 */ + 1534, /* GL_TEXTURE13 */ + 1536, /* GL_TEXTURE14 */ + 1538, /* GL_TEXTURE15 */ + 1540, /* GL_TEXTURE16 */ + 1542, /* GL_TEXTURE17 */ + 1544, /* GL_TEXTURE18 */ + 1546, /* GL_TEXTURE19 */ + 1550, /* GL_TEXTURE20 */ + 1552, /* GL_TEXTURE21 */ + 1554, /* GL_TEXTURE22 */ + 1556, /* GL_TEXTURE23 */ + 1558, /* GL_TEXTURE24 */ + 1560, /* GL_TEXTURE25 */ + 1562, /* GL_TEXTURE26 */ + 1564, /* GL_TEXTURE27 */ + 1566, /* GL_TEXTURE28 */ + 1568, /* GL_TEXTURE29 */ + 1572, /* GL_TEXTURE30 */ + 1574, /* GL_TEXTURE31 */ 18, /* GL_ACTIVE_TEXTURE */ 130, /* GL_CLIENT_ACTIVE_TEXTURE */ - 908, /* GL_MAX_TEXTURE_UNITS */ - 1704, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - 1707, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - 1709, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - 1701, /* GL_TRANSPOSE_COLOR_MATRIX */ - 1503, /* GL_SUBTRACT */ - 896, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + 916, /* GL_MAX_TEXTURE_UNITS */ + 1714, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 1717, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 1719, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 1711, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1513, /* GL_SUBTRACT */ + 904, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ 244, /* GL_COMPRESSED_ALPHA */ 248, /* GL_COMPRESSED_LUMINANCE */ 249, /* GL_COMPRESSED_LUMINANCE_ALPHA */ 246, /* GL_COMPRESSED_INTENSITY */ 252, /* GL_COMPRESSED_RGB */ 253, /* GL_COMPRESSED_RGBA */ - 1622, /* GL_TEXTURE_COMPRESSION_HINT */ - 1684, /* GL_TEXTURE_RECTANGLE_ARB */ - 1594, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - 1252, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - 894, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + 1632, /* GL_TEXTURE_COMPRESSION_HINT */ + 1694, /* GL_TEXTURE_RECTANGLE_ARB */ + 1604, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + 1261, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + 902, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ 366, /* GL_DEPTH_STENCIL */ - 1729, /* GL_UNSIGNED_INT_24_8 */ - 904, /* GL_MAX_TEXTURE_LOD_BIAS */ - 1675, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - 905, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - 1651, /* GL_TEXTURE_FILTER_CONTROL */ - 1666, /* GL_TEXTURE_LOD_BIAS */ + 1739, /* GL_UNSIGNED_INT_24_8 */ + 912, /* GL_MAX_TEXTURE_LOD_BIAS */ + 1685, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 913, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + 1661, /* GL_TEXTURE_FILTER_CONTROL */ + 1676, /* GL_TEXTURE_LOD_BIAS */ 229, /* GL_COMBINE4 */ - 898, /* GL_MAX_SHININESS_NV */ - 899, /* GL_MAX_SPOT_EXPONENT_NV */ - 614, /* GL_INCR_WRAP */ + 906, /* GL_MAX_SHININESS_NV */ + 907, /* GL_MAX_SPOT_EXPONENT_NV */ + 615, /* GL_INCR_WRAP */ 339, /* GL_DECR_WRAP */ - 950, /* GL_MODELVIEW1_ARB */ - 1006, /* GL_NORMAL_MAP */ - 1282, /* GL_REFLECTION_MAP */ - 1631, /* GL_TEXTURE_CUBE_MAP */ - 1592, /* GL_TEXTURE_BINDING_CUBE_MAP */ - 1639, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - 1633, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - 1641, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - 1635, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - 1643, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - 1637, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - 1250, /* GL_PROXY_TEXTURE_CUBE_MAP */ - 850, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - 985, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - 517, /* GL_FOG_DISTANCE_MODE_NV */ + 958, /* GL_MODELVIEW1_ARB */ + 1014, /* GL_NORMAL_MAP */ + 1292, /* GL_REFLECTION_MAP */ + 1641, /* GL_TEXTURE_CUBE_MAP */ + 1602, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 1649, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 1643, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 1651, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 1645, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 1653, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 1647, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1259, /* GL_PROXY_TEXTURE_CUBE_MAP */ + 858, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + 993, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + 518, /* GL_FOG_DISTANCE_MODE_NV */ 470, /* GL_EYE_RADIAL_NV */ 469, /* GL_EYE_PLANE_ABSOLUTE_NV */ 228, /* GL_COMBINE */ 235, /* GL_COMBINE_RGB */ 230, /* GL_COMBINE_ALPHA */ - 1349, /* GL_RGB_SCALE */ + 1359, /* GL_RGB_SCALE */ 24, /* GL_ADD_SIGNED */ - 642, /* GL_INTERPOLATE */ + 643, /* GL_INTERPOLATE */ 267, /* GL_CONSTANT */ - 1200, /* GL_PRIMARY_COLOR */ - 1197, /* GL_PREVIOUS */ - 1420, /* GL_SOURCE0_RGB */ - 1426, /* GL_SOURCE1_RGB */ - 1432, /* GL_SOURCE2_RGB */ - 1436, /* GL_SOURCE3_RGB_NV */ - 1417, /* GL_SOURCE0_ALPHA */ - 1423, /* GL_SOURCE1_ALPHA */ - 1429, /* GL_SOURCE2_ALPHA */ - 1435, /* GL_SOURCE3_ALPHA_NV */ - 1042, /* GL_OPERAND0_RGB */ - 1048, /* GL_OPERAND1_RGB */ - 1054, /* GL_OPERAND2_RGB */ - 1058, /* GL_OPERAND3_RGB_NV */ - 1039, /* GL_OPERAND0_ALPHA */ - 1045, /* GL_OPERAND1_ALPHA */ - 1051, /* GL_OPERAND2_ALPHA */ - 1057, /* GL_OPERAND3_ALPHA_NV */ - 1753, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - 1817, /* GL_YCBCR_422_APPLE */ - 1742, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - 1744, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - 1407, /* GL_SLICE_ACCUM_SUN */ - 1257, /* GL_QUAD_MESH_SUN */ - 1713, /* GL_TRIANGLE_MESH_SUN */ - 1791, /* GL_VERTEX_PROGRAM_ARB */ - 1802, /* GL_VERTEX_STATE_PROGRAM_NV */ - 1778, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - 1784, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - 1786, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - 1788, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + 1208, /* GL_PRIMARY_COLOR */ + 1205, /* GL_PREVIOUS */ + 1430, /* GL_SOURCE0_RGB */ + 1436, /* GL_SOURCE1_RGB */ + 1442, /* GL_SOURCE2_RGB */ + 1446, /* GL_SOURCE3_RGB_NV */ + 1427, /* GL_SOURCE0_ALPHA */ + 1433, /* GL_SOURCE1_ALPHA */ + 1439, /* GL_SOURCE2_ALPHA */ + 1445, /* GL_SOURCE3_ALPHA_NV */ + 1050, /* GL_OPERAND0_RGB */ + 1056, /* GL_OPERAND1_RGB */ + 1062, /* GL_OPERAND2_RGB */ + 1066, /* GL_OPERAND3_RGB_NV */ + 1047, /* GL_OPERAND0_ALPHA */ + 1053, /* GL_OPERAND1_ALPHA */ + 1059, /* GL_OPERAND2_ALPHA */ + 1065, /* GL_OPERAND3_ALPHA_NV */ + 1763, /* GL_VERTEX_ARRAY_BINDING */ + 1828, /* GL_YCBCR_422_APPLE */ + 1752, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 1754, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 1417, /* GL_SLICE_ACCUM_SUN */ + 1267, /* GL_QUAD_MESH_SUN */ + 1723, /* GL_TRIANGLE_MESH_SUN */ + 1802, /* GL_VERTEX_PROGRAM_ARB */ + 1813, /* GL_VERTEX_STATE_PROGRAM_NV */ + 1789, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + 1795, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + 1797, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + 1799, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ 330, /* GL_CURRENT_VERTEX_ATTRIB */ - 1213, /* GL_PROGRAM_LENGTH_ARB */ - 1227, /* GL_PROGRAM_STRING_ARB */ - 972, /* GL_MODELVIEW_PROJECTION_NV */ - 609, /* GL_IDENTITY_NV */ - 656, /* GL_INVERSE_NV */ - 1706, /* GL_TRANSPOSE_NV */ - 657, /* GL_INVERSE_TRANSPOSE_NV */ - 880, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - 879, /* GL_MAX_PROGRAM_MATRICES_ARB */ - 787, /* GL_MATRIX0_NV */ - 799, /* GL_MATRIX1_NV */ - 811, /* GL_MATRIX2_NV */ - 815, /* GL_MATRIX3_NV */ - 817, /* GL_MATRIX4_NV */ - 819, /* GL_MATRIX5_NV */ - 821, /* GL_MATRIX6_NV */ - 823, /* GL_MATRIX7_NV */ + 1221, /* GL_PROGRAM_LENGTH_ARB */ + 1235, /* GL_PROGRAM_STRING_ARB */ + 980, /* GL_MODELVIEW_PROJECTION_NV */ + 610, /* GL_IDENTITY_NV */ + 657, /* GL_INVERSE_NV */ + 1716, /* GL_TRANSPOSE_NV */ + 658, /* GL_INVERSE_TRANSPOSE_NV */ + 888, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + 887, /* GL_MAX_PROGRAM_MATRICES_ARB */ + 795, /* GL_MATRIX0_NV */ + 807, /* GL_MATRIX1_NV */ + 819, /* GL_MATRIX2_NV */ + 823, /* GL_MATRIX3_NV */ + 825, /* GL_MATRIX4_NV */ + 827, /* GL_MATRIX5_NV */ + 829, /* GL_MATRIX6_NV */ + 831, /* GL_MATRIX7_NV */ 314, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ 311, /* GL_CURRENT_MATRIX_ARB */ - 1794, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - 1797, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - 1225, /* GL_PROGRAM_PARAMETER_NV */ - 1782, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - 1229, /* GL_PROGRAM_TARGET_NV */ - 1226, /* GL_PROGRAM_RESIDENT_NV */ - 1698, /* GL_TRACK_MATRIX_NV */ - 1699, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - 1792, /* GL_VERTEX_PROGRAM_BINDING_NV */ - 1207, /* GL_PROGRAM_ERROR_POSITION_ARB */ + 1805, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + 1808, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + 1233, /* GL_PROGRAM_PARAMETER_NV */ + 1793, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + 1237, /* GL_PROGRAM_TARGET_NV */ + 1234, /* GL_PROGRAM_RESIDENT_NV */ + 1708, /* GL_TRACK_MATRIX_NV */ + 1709, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 1803, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1215, /* GL_PROGRAM_ERROR_POSITION_ARB */ 351, /* GL_DEPTH_CLAMP_NV */ - 1760, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - 1767, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - 1768, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - 1769, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - 1770, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - 1771, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - 1772, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - 1773, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - 1774, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - 1775, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - 1761, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - 1762, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - 1763, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - 1764, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - 1765, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - 1766, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - 741, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - 748, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - 749, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - 750, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - 751, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - 752, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - 753, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - 754, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - 755, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - 756, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - 742, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - 743, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - 744, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - 745, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - 746, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - 747, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - 768, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - 775, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - 776, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - 777, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - 778, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - 779, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - 780, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - 1206, /* GL_PROGRAM_BINDING_ARB */ - 782, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - 783, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - 769, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - 770, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - 771, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - 772, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - 773, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - 774, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - 1620, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - 1617, /* GL_TEXTURE_COMPRESSED */ - 1011, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + 1771, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 1778, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 1779, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 1780, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 1781, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 1782, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 1783, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 1784, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 1785, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 1786, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 1772, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 1773, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 1774, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 1775, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 1776, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 1777, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 743, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + 750, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + 751, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + 752, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + 753, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + 754, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + 755, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + 756, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + 757, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + 758, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + 744, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + 745, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + 746, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + 747, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + 748, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + 749, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + 770, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + 777, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + 778, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + 779, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + 780, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + 781, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + 782, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + 1214, /* GL_PROGRAM_BINDING_ARB */ + 784, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + 785, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + 771, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + 772, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + 773, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + 774, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + 775, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + 776, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + 1630, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 1627, /* GL_TEXTURE_COMPRESSED */ + 1019, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ 266, /* GL_COMPRESSED_TEXTURE_FORMATS */ - 920, /* GL_MAX_VERTEX_UNITS_ARB */ + 928, /* GL_MAX_VERTEX_UNITS_ARB */ 22, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - 1812, /* GL_WEIGHT_SUM_UNITY_ARB */ - 1790, /* GL_VERTEX_BLEND_ARB */ + 1823, /* GL_WEIGHT_SUM_UNITY_ARB */ + 1801, /* GL_VERTEX_BLEND_ARB */ 332, /* GL_CURRENT_WEIGHT_ARB */ - 1811, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - 1810, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - 1809, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - 1808, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - 1805, /* GL_WEIGHT_ARRAY_ARB */ + 1822, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 1821, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 1820, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 1819, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 1816, /* GL_WEIGHT_ARRAY_ARB */ 379, /* GL_DOT3_RGB */ 380, /* GL_DOT3_RGBA */ 260, /* GL_COMPRESSED_RGB_FXT1_3DFX */ 255, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - 980, /* GL_MULTISAMPLE_3DFX */ - 1370, /* GL_SAMPLE_BUFFERS_3DFX */ - 1361, /* GL_SAMPLES_3DFX */ - 961, /* GL_MODELVIEW2_ARB */ - 964, /* GL_MODELVIEW3_ARB */ - 965, /* GL_MODELVIEW4_ARB */ - 966, /* GL_MODELVIEW5_ARB */ - 967, /* GL_MODELVIEW6_ARB */ - 968, /* GL_MODELVIEW7_ARB */ - 969, /* GL_MODELVIEW8_ARB */ - 970, /* GL_MODELVIEW9_ARB */ - 940, /* GL_MODELVIEW10_ARB */ - 941, /* GL_MODELVIEW11_ARB */ - 942, /* GL_MODELVIEW12_ARB */ - 943, /* GL_MODELVIEW13_ARB */ - 944, /* GL_MODELVIEW14_ARB */ - 945, /* GL_MODELVIEW15_ARB */ - 946, /* GL_MODELVIEW16_ARB */ - 947, /* GL_MODELVIEW17_ARB */ - 948, /* GL_MODELVIEW18_ARB */ - 949, /* GL_MODELVIEW19_ARB */ - 951, /* GL_MODELVIEW20_ARB */ - 952, /* GL_MODELVIEW21_ARB */ - 953, /* GL_MODELVIEW22_ARB */ - 954, /* GL_MODELVIEW23_ARB */ - 955, /* GL_MODELVIEW24_ARB */ - 956, /* GL_MODELVIEW25_ARB */ - 957, /* GL_MODELVIEW26_ARB */ - 958, /* GL_MODELVIEW27_ARB */ - 959, /* GL_MODELVIEW28_ARB */ - 960, /* GL_MODELVIEW29_ARB */ - 962, /* GL_MODELVIEW30_ARB */ - 963, /* GL_MODELVIEW31_ARB */ + 988, /* GL_MULTISAMPLE_3DFX */ + 1380, /* GL_SAMPLE_BUFFERS_3DFX */ + 1371, /* GL_SAMPLES_3DFX */ + 969, /* GL_MODELVIEW2_ARB */ + 972, /* GL_MODELVIEW3_ARB */ + 973, /* GL_MODELVIEW4_ARB */ + 974, /* GL_MODELVIEW5_ARB */ + 975, /* GL_MODELVIEW6_ARB */ + 976, /* GL_MODELVIEW7_ARB */ + 977, /* GL_MODELVIEW8_ARB */ + 978, /* GL_MODELVIEW9_ARB */ + 948, /* GL_MODELVIEW10_ARB */ + 949, /* GL_MODELVIEW11_ARB */ + 950, /* GL_MODELVIEW12_ARB */ + 951, /* GL_MODELVIEW13_ARB */ + 952, /* GL_MODELVIEW14_ARB */ + 953, /* GL_MODELVIEW15_ARB */ + 954, /* GL_MODELVIEW16_ARB */ + 955, /* GL_MODELVIEW17_ARB */ + 956, /* GL_MODELVIEW18_ARB */ + 957, /* GL_MODELVIEW19_ARB */ + 959, /* GL_MODELVIEW20_ARB */ + 960, /* GL_MODELVIEW21_ARB */ + 961, /* GL_MODELVIEW22_ARB */ + 962, /* GL_MODELVIEW23_ARB */ + 963, /* GL_MODELVIEW24_ARB */ + 964, /* GL_MODELVIEW25_ARB */ + 965, /* GL_MODELVIEW26_ARB */ + 966, /* GL_MODELVIEW27_ARB */ + 967, /* GL_MODELVIEW28_ARB */ + 968, /* GL_MODELVIEW29_ARB */ + 970, /* GL_MODELVIEW30_ARB */ + 971, /* GL_MODELVIEW31_ARB */ 384, /* GL_DOT3_RGB_EXT */ 382, /* GL_DOT3_RGBA_EXT */ - 934, /* GL_MIRROR_CLAMP_EXT */ - 937, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - 975, /* GL_MODULATE_ADD_ATI */ - 976, /* GL_MODULATE_SIGNED_ADD_ATI */ - 977, /* GL_MODULATE_SUBTRACT_ATI */ - 1818, /* GL_YCBCR_MESA */ - 1066, /* GL_PACK_INVERT_MESA */ + 942, /* GL_MIRROR_CLAMP_EXT */ + 945, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + 983, /* GL_MODULATE_ADD_ATI */ + 984, /* GL_MODULATE_SIGNED_ADD_ATI */ + 985, /* GL_MODULATE_SUBTRACT_ATI */ + 1829, /* GL_YCBCR_MESA */ + 1074, /* GL_PACK_INVERT_MESA */ 335, /* GL_DEBUG_OBJECT_MESA */ 336, /* GL_DEBUG_PRINT_MESA */ 334, /* GL_DEBUG_ASSERT_MESA */ @@ -4680,24 +4702,24 @@ static const unsigned reduced_enums[1321] = 442, /* GL_DU8DV8_ATI */ 111, /* GL_BUMP_ENVMAP_ATI */ 115, /* GL_BUMP_TARGET_ATI */ - 1468, /* GL_STENCIL_BACK_FUNC */ - 1466, /* GL_STENCIL_BACK_FAIL */ - 1470, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - 1472, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - 526, /* GL_FRAGMENT_PROGRAM_ARB */ - 1204, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 1232, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 1231, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - 1216, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 1222, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 1221, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 869, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 892, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 891, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - 882, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 888, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 887, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 852, /* GL_MAX_DRAW_BUFFERS */ + 1478, /* GL_STENCIL_BACK_FUNC */ + 1476, /* GL_STENCIL_BACK_FAIL */ + 1480, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + 1482, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + 527, /* GL_FRAGMENT_PROGRAM_ARB */ + 1212, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 1240, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 1239, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + 1224, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 1230, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 1229, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 877, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 900, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 899, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + 890, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 896, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 895, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 860, /* GL_MAX_DRAW_BUFFERS */ 388, /* GL_DRAW_BUFFER0 */ 391, /* GL_DRAW_BUFFER1 */ 412, /* GL_DRAW_BUFFER2 */ @@ -4715,251 +4737,251 @@ static const unsigned reduced_enums[1321] = 404, /* GL_DRAW_BUFFER14 */ 407, /* GL_DRAW_BUFFER15 */ 81, /* GL_BLEND_EQUATION_ALPHA */ - 832, /* GL_MATRIX_PALETTE_ARB */ - 863, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - 866, /* GL_MAX_PALETTE_MATRICES_ARB */ + 840, /* GL_MATRIX_PALETTE_ARB */ + 871, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + 874, /* GL_MAX_PALETTE_MATRICES_ARB */ 317, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - 826, /* GL_MATRIX_INDEX_ARRAY_ARB */ + 834, /* GL_MATRIX_INDEX_ARRAY_ARB */ 312, /* GL_CURRENT_MATRIX_INDEX_ARB */ - 828, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - 830, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - 829, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - 827, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - 1646, /* GL_TEXTURE_DEPTH_SIZE */ + 836, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + 838, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + 837, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + 835, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + 1656, /* GL_TEXTURE_DEPTH_SIZE */ 372, /* GL_DEPTH_TEXTURE_MODE */ - 1612, /* GL_TEXTURE_COMPARE_MODE */ - 1610, /* GL_TEXTURE_COMPARE_FUNC */ + 1622, /* GL_TEXTURE_COMPARE_MODE */ + 1620, /* GL_TEXTURE_COMPARE_FUNC */ 239, /* GL_COMPARE_R_TO_TEXTURE */ - 1138, /* GL_POINT_SPRITE */ + 1146, /* GL_POINT_SPRITE */ 292, /* GL_COORD_REPLACE */ - 1142, /* GL_POINT_SPRITE_R_MODE_NV */ - 1259, /* GL_QUERY_COUNTER_BITS */ + 1150, /* GL_POINT_SPRITE_R_MODE_NV */ + 1269, /* GL_QUERY_COUNTER_BITS */ 319, /* GL_CURRENT_QUERY */ - 1261, /* GL_QUERY_RESULT */ - 1263, /* GL_QUERY_RESULT_AVAILABLE */ - 914, /* GL_MAX_VERTEX_ATTRIBS */ - 1780, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + 1271, /* GL_QUERY_RESULT */ + 1273, /* GL_QUERY_RESULT_AVAILABLE */ + 922, /* GL_MAX_VERTEX_ATTRIBS */ + 1791, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ 370, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ 369, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - 900, /* GL_MAX_TEXTURE_COORDS */ - 902, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - 1209, /* GL_PROGRAM_ERROR_STRING_ARB */ - 1211, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - 1210, /* GL_PROGRAM_FORMAT_ARB */ - 1692, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 908, /* GL_MAX_TEXTURE_COORDS */ + 910, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + 1217, /* GL_PROGRAM_ERROR_STRING_ARB */ + 1219, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + 1218, /* GL_PROGRAM_FORMAT_ARB */ + 1702, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ 349, /* GL_DEPTH_BOUNDS_TEST_EXT */ 348, /* GL_DEPTH_BOUNDS_EXT */ 52, /* GL_ARRAY_BUFFER */ 456, /* GL_ELEMENT_ARRAY_BUFFER */ 53, /* GL_ARRAY_BUFFER_BINDING */ 457, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - 1754, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - 1001, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + 1765, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 1009, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ 146, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - 618, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - 1625, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 619, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + 1635, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ 452, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - 1382, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - 504, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - 1806, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - 1776, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - 1212, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - 875, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - 1218, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 884, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 1230, /* GL_PROGRAM_TEMPORARIES_ARB */ - 890, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - 1220, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 886, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 1224, /* GL_PROGRAM_PARAMETERS_ARB */ - 889, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - 1219, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - 885, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - 1205, /* GL_PROGRAM_ATTRIBS_ARB */ - 870, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - 1217, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - 883, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - 1203, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - 868, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - 1215, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 881, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 876, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - 872, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - 1233, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - 1703, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - 1272, /* GL_READ_ONLY */ - 1814, /* GL_WRITE_ONLY */ - 1274, /* GL_READ_WRITE */ + 1392, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + 505, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + 1817, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 1787, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1220, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + 883, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + 1226, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 892, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 1238, /* GL_PROGRAM_TEMPORARIES_ARB */ + 898, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + 1228, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 894, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 1232, /* GL_PROGRAM_PARAMETERS_ARB */ + 897, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + 1227, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + 893, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + 1213, /* GL_PROGRAM_ATTRIBS_ARB */ + 878, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + 1225, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + 891, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + 1211, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + 876, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + 1223, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 889, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 884, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + 880, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + 1241, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + 1713, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1282, /* GL_READ_ONLY */ + 1825, /* GL_WRITE_ONLY */ + 1284, /* GL_READ_WRITE */ 101, /* GL_BUFFER_ACCESS */ 103, /* GL_BUFFER_MAPPED */ 105, /* GL_BUFFER_MAP_POINTER */ - 1697, /* GL_TIME_ELAPSED_EXT */ - 786, /* GL_MATRIX0_ARB */ - 798, /* GL_MATRIX1_ARB */ - 810, /* GL_MATRIX2_ARB */ - 814, /* GL_MATRIX3_ARB */ - 816, /* GL_MATRIX4_ARB */ - 818, /* GL_MATRIX5_ARB */ - 820, /* GL_MATRIX6_ARB */ - 822, /* GL_MATRIX7_ARB */ - 824, /* GL_MATRIX8_ARB */ - 825, /* GL_MATRIX9_ARB */ - 788, /* GL_MATRIX10_ARB */ - 789, /* GL_MATRIX11_ARB */ - 790, /* GL_MATRIX12_ARB */ - 791, /* GL_MATRIX13_ARB */ - 792, /* GL_MATRIX14_ARB */ - 793, /* GL_MATRIX15_ARB */ - 794, /* GL_MATRIX16_ARB */ - 795, /* GL_MATRIX17_ARB */ - 796, /* GL_MATRIX18_ARB */ - 797, /* GL_MATRIX19_ARB */ - 800, /* GL_MATRIX20_ARB */ - 801, /* GL_MATRIX21_ARB */ - 802, /* GL_MATRIX22_ARB */ - 803, /* GL_MATRIX23_ARB */ - 804, /* GL_MATRIX24_ARB */ - 805, /* GL_MATRIX25_ARB */ - 806, /* GL_MATRIX26_ARB */ - 807, /* GL_MATRIX27_ARB */ - 808, /* GL_MATRIX28_ARB */ - 809, /* GL_MATRIX29_ARB */ - 812, /* GL_MATRIX30_ARB */ - 813, /* GL_MATRIX31_ARB */ - 1498, /* GL_STREAM_DRAW */ - 1500, /* GL_STREAM_READ */ - 1496, /* GL_STREAM_COPY */ - 1459, /* GL_STATIC_DRAW */ - 1461, /* GL_STATIC_READ */ - 1457, /* GL_STATIC_COPY */ + 1707, /* GL_TIME_ELAPSED_EXT */ + 794, /* GL_MATRIX0_ARB */ + 806, /* GL_MATRIX1_ARB */ + 818, /* GL_MATRIX2_ARB */ + 822, /* GL_MATRIX3_ARB */ + 824, /* GL_MATRIX4_ARB */ + 826, /* GL_MATRIX5_ARB */ + 828, /* GL_MATRIX6_ARB */ + 830, /* GL_MATRIX7_ARB */ + 832, /* GL_MATRIX8_ARB */ + 833, /* GL_MATRIX9_ARB */ + 796, /* GL_MATRIX10_ARB */ + 797, /* GL_MATRIX11_ARB */ + 798, /* GL_MATRIX12_ARB */ + 799, /* GL_MATRIX13_ARB */ + 800, /* GL_MATRIX14_ARB */ + 801, /* GL_MATRIX15_ARB */ + 802, /* GL_MATRIX16_ARB */ + 803, /* GL_MATRIX17_ARB */ + 804, /* GL_MATRIX18_ARB */ + 805, /* GL_MATRIX19_ARB */ + 808, /* GL_MATRIX20_ARB */ + 809, /* GL_MATRIX21_ARB */ + 810, /* GL_MATRIX22_ARB */ + 811, /* GL_MATRIX23_ARB */ + 812, /* GL_MATRIX24_ARB */ + 813, /* GL_MATRIX25_ARB */ + 814, /* GL_MATRIX26_ARB */ + 815, /* GL_MATRIX27_ARB */ + 816, /* GL_MATRIX28_ARB */ + 817, /* GL_MATRIX29_ARB */ + 820, /* GL_MATRIX30_ARB */ + 821, /* GL_MATRIX31_ARB */ + 1508, /* GL_STREAM_DRAW */ + 1510, /* GL_STREAM_READ */ + 1506, /* GL_STREAM_COPY */ + 1469, /* GL_STATIC_DRAW */ + 1471, /* GL_STATIC_READ */ + 1467, /* GL_STATIC_COPY */ 446, /* GL_DYNAMIC_DRAW */ 448, /* GL_DYNAMIC_READ */ 444, /* GL_DYNAMIC_COPY */ - 1106, /* GL_PIXEL_PACK_BUFFER */ - 1110, /* GL_PIXEL_UNPACK_BUFFER */ - 1107, /* GL_PIXEL_PACK_BUFFER_BINDING */ - 1111, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + 1114, /* GL_PIXEL_PACK_BUFFER */ + 1118, /* GL_PIXEL_UNPACK_BUFFER */ + 1115, /* GL_PIXEL_PACK_BUFFER_BINDING */ + 1119, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ 343, /* GL_DEPTH24_STENCIL8 */ - 1690, /* GL_TEXTURE_STENCIL_SIZE */ - 873, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - 871, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - 874, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - 878, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - 877, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - 835, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - 1492, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 1700, /* GL_TEXTURE_STENCIL_SIZE */ + 881, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + 879, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + 882, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + 886, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + 885, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + 843, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + 1502, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ 17, /* GL_ACTIVE_STENCIL_FACE_EXT */ - 935, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - 1363, /* GL_SAMPLES_PASSED */ - 527, /* GL_FRAGMENT_SHADER */ - 1800, /* GL_VERTEX_SHADER */ - 1223, /* GL_PROGRAM_OBJECT_ARB */ - 1395, /* GL_SHADER_OBJECT_ARB */ - 859, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - 918, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - 912, /* GL_MAX_VARYING_FLOATS */ - 916, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - 844, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - 1026, /* GL_OBJECT_TYPE_ARB */ - 1397, /* GL_SHADER_TYPE */ - 492, /* GL_FLOAT_VEC2 */ - 494, /* GL_FLOAT_VEC3 */ - 496, /* GL_FLOAT_VEC4 */ - 645, /* GL_INT_VEC2 */ - 647, /* GL_INT_VEC3 */ - 649, /* GL_INT_VEC4 */ + 943, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + 1373, /* GL_SAMPLES_PASSED */ + 528, /* GL_FRAGMENT_SHADER */ + 1811, /* GL_VERTEX_SHADER */ + 1231, /* GL_PROGRAM_OBJECT_ARB */ + 1405, /* GL_SHADER_OBJECT_ARB */ + 867, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + 926, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + 920, /* GL_MAX_VARYING_FLOATS */ + 924, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + 852, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + 1034, /* GL_OBJECT_TYPE_ARB */ + 1407, /* GL_SHADER_TYPE */ + 493, /* GL_FLOAT_VEC2 */ + 495, /* GL_FLOAT_VEC3 */ + 497, /* GL_FLOAT_VEC4 */ + 646, /* GL_INT_VEC2 */ + 648, /* GL_INT_VEC3 */ + 650, /* GL_INT_VEC4 */ 93, /* GL_BOOL */ 95, /* GL_BOOL_VEC2 */ 97, /* GL_BOOL_VEC3 */ 99, /* GL_BOOL_VEC4 */ - 480, /* GL_FLOAT_MAT2 */ - 484, /* GL_FLOAT_MAT3 */ - 488, /* GL_FLOAT_MAT4 */ - 1354, /* GL_SAMPLER_1D */ - 1356, /* GL_SAMPLER_2D */ - 1358, /* GL_SAMPLER_3D */ - 1359, /* GL_SAMPLER_CUBE */ - 1355, /* GL_SAMPLER_1D_SHADOW */ - 1357, /* GL_SAMPLER_2D_SHADOW */ - 482, /* GL_FLOAT_MAT2x3 */ - 483, /* GL_FLOAT_MAT2x4 */ - 486, /* GL_FLOAT_MAT3x2 */ - 487, /* GL_FLOAT_MAT3x4 */ - 490, /* GL_FLOAT_MAT4x2 */ - 491, /* GL_FLOAT_MAT4x3 */ + 481, /* GL_FLOAT_MAT2 */ + 485, /* GL_FLOAT_MAT3 */ + 489, /* GL_FLOAT_MAT4 */ + 1364, /* GL_SAMPLER_1D */ + 1366, /* GL_SAMPLER_2D */ + 1368, /* GL_SAMPLER_3D */ + 1369, /* GL_SAMPLER_CUBE */ + 1365, /* GL_SAMPLER_1D_SHADOW */ + 1367, /* GL_SAMPLER_2D_SHADOW */ + 483, /* GL_FLOAT_MAT2x3 */ + 484, /* GL_FLOAT_MAT2x4 */ + 487, /* GL_FLOAT_MAT3x2 */ + 488, /* GL_FLOAT_MAT3x4 */ + 491, /* GL_FLOAT_MAT4x2 */ + 492, /* GL_FLOAT_MAT4x3 */ 341, /* GL_DELETE_STATUS */ 243, /* GL_COMPILE_STATUS */ - 699, /* GL_LINK_STATUS */ - 1749, /* GL_VALIDATE_STATUS */ - 630, /* GL_INFO_LOG_LENGTH */ + 701, /* GL_LINK_STATUS */ + 1759, /* GL_VALIDATE_STATUS */ + 631, /* GL_INFO_LOG_LENGTH */ 55, /* GL_ATTACHED_SHADERS */ 20, /* GL_ACTIVE_UNIFORMS */ 21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ - 1396, /* GL_SHADER_SOURCE_LENGTH */ + 1406, /* GL_SHADER_SOURCE_LENGTH */ 15, /* GL_ACTIVE_ATTRIBUTES */ 16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ - 529, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - 1399, /* GL_SHADING_LANGUAGE_VERSION */ + 530, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + 1409, /* GL_SHADING_LANGUAGE_VERSION */ 318, /* GL_CURRENT_PROGRAM */ - 1075, /* GL_PALETTE4_RGB8_OES */ - 1077, /* GL_PALETTE4_RGBA8_OES */ - 1073, /* GL_PALETTE4_R5_G6_B5_OES */ - 1076, /* GL_PALETTE4_RGBA4_OES */ - 1074, /* GL_PALETTE4_RGB5_A1_OES */ - 1080, /* GL_PALETTE8_RGB8_OES */ - 1082, /* GL_PALETTE8_RGBA8_OES */ - 1078, /* GL_PALETTE8_R5_G6_B5_OES */ - 1081, /* GL_PALETTE8_RGBA4_OES */ - 1079, /* GL_PALETTE8_RGB5_A1_OES */ - 612, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - 611, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - 1734, /* GL_UNSIGNED_NORMALIZED */ - 1580, /* GL_TEXTURE_1D_ARRAY_EXT */ - 1243, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - 1582, /* GL_TEXTURE_2D_ARRAY_EXT */ - 1246, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - 1588, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - 1590, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - 1451, /* GL_SRGB */ - 1452, /* GL_SRGB8 */ - 1454, /* GL_SRGB_ALPHA */ - 1453, /* GL_SRGB8_ALPHA8 */ - 1411, /* GL_SLUMINANCE_ALPHA */ - 1410, /* GL_SLUMINANCE8_ALPHA8 */ - 1408, /* GL_SLUMINANCE */ - 1409, /* GL_SLUMINANCE8 */ + 1083, /* GL_PALETTE4_RGB8_OES */ + 1085, /* GL_PALETTE4_RGBA8_OES */ + 1081, /* GL_PALETTE4_R5_G6_B5_OES */ + 1084, /* GL_PALETTE4_RGBA4_OES */ + 1082, /* GL_PALETTE4_RGB5_A1_OES */ + 1088, /* GL_PALETTE8_RGB8_OES */ + 1090, /* GL_PALETTE8_RGBA8_OES */ + 1086, /* GL_PALETTE8_R5_G6_B5_OES */ + 1089, /* GL_PALETTE8_RGBA4_OES */ + 1087, /* GL_PALETTE8_RGB5_A1_OES */ + 613, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + 612, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + 1744, /* GL_UNSIGNED_NORMALIZED */ + 1590, /* GL_TEXTURE_1D_ARRAY_EXT */ + 1252, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + 1592, /* GL_TEXTURE_2D_ARRAY_EXT */ + 1255, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + 1598, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + 1600, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + 1461, /* GL_SRGB */ + 1462, /* GL_SRGB8 */ + 1464, /* GL_SRGB_ALPHA */ + 1463, /* GL_SRGB8_ALPHA8 */ + 1421, /* GL_SLUMINANCE_ALPHA */ + 1420, /* GL_SLUMINANCE8_ALPHA8 */ + 1418, /* GL_SLUMINANCE */ + 1419, /* GL_SLUMINANCE8 */ 264, /* GL_COMPRESSED_SRGB */ 265, /* GL_COMPRESSED_SRGB_ALPHA */ 262, /* GL_COMPRESSED_SLUMINANCE */ 263, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ - 1140, /* GL_POINT_SPRITE_COORD_ORIGIN */ - 707, /* GL_LOWER_LEFT */ - 1746, /* GL_UPPER_LEFT */ - 1474, /* GL_STENCIL_BACK_REF */ - 1475, /* GL_STENCIL_BACK_VALUE_MASK */ - 1476, /* GL_STENCIL_BACK_WRITEMASK */ + 1148, /* GL_POINT_SPRITE_COORD_ORIGIN */ + 709, /* GL_LOWER_LEFT */ + 1756, /* GL_UPPER_LEFT */ + 1484, /* GL_STENCIL_BACK_REF */ + 1485, /* GL_STENCIL_BACK_VALUE_MASK */ + 1486, /* GL_STENCIL_BACK_WRITEMASK */ 437, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - 1288, /* GL_RENDERBUFFER_BINDING_EXT */ - 1269, /* GL_READ_FRAMEBUFFER */ + 1298, /* GL_RENDERBUFFER_BINDING_EXT */ + 1279, /* GL_READ_FRAMEBUFFER */ 436, /* GL_DRAW_FRAMEBUFFER */ - 1270, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - 1298, /* GL_RENDERBUFFER_SAMPLES */ - 539, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - 537, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - 548, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - 544, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - 546, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - 551, /* GL_FRAMEBUFFER_COMPLETE */ - 555, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - 561, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - 559, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - 557, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - 560, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - 558, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - 564, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - 567, /* GL_FRAMEBUFFER_UNSUPPORTED */ - 565, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - 841, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + 1280, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + 1308, /* GL_RENDERBUFFER_SAMPLES */ + 540, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + 538, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + 549, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + 545, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + 547, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + 552, /* GL_FRAMEBUFFER_COMPLETE */ + 556, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + 562, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + 560, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + 558, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + 561, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + 559, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + 565, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + 568, /* GL_FRAMEBUFFER_UNSUPPORTED */ + 566, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + 849, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ 152, /* GL_COLOR_ATTACHMENT0 */ 154, /* GL_COLOR_ATTACHMENT1 */ 168, /* GL_COLOR_ATTACHMENT2 */ @@ -4977,37 +4999,41 @@ static const unsigned reduced_enums[1321] = 163, /* GL_COLOR_ATTACHMENT14 */ 165, /* GL_COLOR_ATTACHMENT15 */ 344, /* GL_DEPTH_ATTACHMENT */ - 1464, /* GL_STENCIL_ATTACHMENT */ - 530, /* GL_FRAMEBUFFER */ - 1286, /* GL_RENDERBUFFER */ - 1300, /* GL_RENDERBUFFER_WIDTH */ - 1293, /* GL_RENDERBUFFER_HEIGHT */ - 1295, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - 1487, /* GL_STENCIL_INDEX_EXT */ - 1484, /* GL_STENCIL_INDEX1_EXT */ - 1485, /* GL_STENCIL_INDEX4_EXT */ - 1486, /* GL_STENCIL_INDEX8_EXT */ - 1483, /* GL_STENCIL_INDEX16_EXT */ - 1297, /* GL_RENDERBUFFER_RED_SIZE */ - 1292, /* GL_RENDERBUFFER_GREEN_SIZE */ - 1289, /* GL_RENDERBUFFER_BLUE_SIZE */ - 1287, /* GL_RENDERBUFFER_ALPHA_SIZE */ - 1290, /* GL_RENDERBUFFER_DEPTH_SIZE */ - 1299, /* GL_RENDERBUFFER_STENCIL_SIZE */ - 563, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - 897, /* GL_MAX_SAMPLES */ + 1474, /* GL_STENCIL_ATTACHMENT */ + 531, /* GL_FRAMEBUFFER */ + 1296, /* GL_RENDERBUFFER */ + 1310, /* GL_RENDERBUFFER_WIDTH */ + 1303, /* GL_RENDERBUFFER_HEIGHT */ + 1305, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + 1497, /* GL_STENCIL_INDEX_EXT */ + 1494, /* GL_STENCIL_INDEX1_EXT */ + 1495, /* GL_STENCIL_INDEX4_EXT */ + 1496, /* GL_STENCIL_INDEX8_EXT */ + 1493, /* GL_STENCIL_INDEX16_EXT */ + 1307, /* GL_RENDERBUFFER_RED_SIZE */ + 1302, /* GL_RENDERBUFFER_GREEN_SIZE */ + 1299, /* GL_RENDERBUFFER_BLUE_SIZE */ + 1297, /* GL_RENDERBUFFER_ALPHA_SIZE */ + 1300, /* GL_RENDERBUFFER_DEPTH_SIZE */ + 1309, /* GL_RENDERBUFFER_STENCIL_SIZE */ + 564, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + 905, /* GL_MAX_SAMPLES */ + 1266, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ + 478, /* GL_FIRST_VERTEX_CONVENTION_EXT */ + 661, /* GL_LAST_VERTEX_CONVENTION_EXT */ + 1245, /* GL_PROVOKING_VERTEX_EXT */ 298, /* GL_COPY_READ_BUFFER */ 299, /* GL_COPY_WRITE_BUFFER */ - 1347, /* GL_RGBA_SNORM */ - 1343, /* GL_RGBA8_SNORM */ - 1404, /* GL_SIGNED_NORMALIZED */ + 1357, /* GL_RGBA_SNORM */ + 1353, /* GL_RGBA8_SNORM */ + 1414, /* GL_SIGNED_NORMALIZED */ 463, /* GL_EVAL_BIT */ - 1267, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - 701, /* GL_LIST_BIT */ - 1596, /* GL_TEXTURE_BIT */ - 1378, /* GL_SCISSOR_BIT */ + 1277, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + 703, /* GL_LIST_BIT */ + 1606, /* GL_TEXTURE_BIT */ + 1388, /* GL_SCISSOR_BIT */ 29, /* GL_ALL_ATTRIB_BITS */ - 982, /* GL_MULTISAMPLE_BIT */ + 990, /* GL_MULTISAMPLE_BIT */ 30, /* GL_ALL_CLIENT_ATTRIB_BITS */ }; @@ -5065,6 +5091,29 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } } +/* Get the name of an enum given that it is a primitive type. Avoids + * GL_FALSE/GL_POINTS ambiguity and others. + */ +const char *_mesa_lookup_prim_by_nr( int nr ) +{ + switch (nr) { + case GL_POINTS: return "GL_POINTS"; + case GL_LINES: return "GL_LINES"; + case GL_LINE_STRIP: return "GL_LINE_STRIP"; + case GL_LINE_LOOP: return "GL_LINE_LOOP"; + case GL_TRIANGLES: return "GL_TRIANGLES"; + case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP"; + case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN"; + case GL_QUADS: return "GL_QUADS"; + case GL_QUAD_STRIP: return "GL_QUAD_STRIP"; + case GL_POLYGON: return "GL_POLYGON"; + case GL_POLYGON+1: return "OUTSIDE_BEGIN_END"; + default: return "<invalid>"; + } +} + + + int _mesa_lookup_enum_by_name( const char *symbol ) { enum_elt * f = NULL; diff --git a/src/mesa/main/enums.h b/src/mesa/main/enums.h index 23a4767f350..b5f69001b84 100644 --- a/src/mesa/main/enums.h +++ b/src/mesa/main/enums.h @@ -40,6 +40,12 @@ #if defined(_HAVE_FULL_GL) && _HAVE_FULL_GL extern const char *_mesa_lookup_enum_by_nr( int nr ); + +/* Get the name of an enum given that it is a primitive type. Avoids + * GL_FALSE/GL_POINTS ambiguity and others. + */ +const char *_mesa_lookup_prim_by_nr( int nr ); + extern int _mesa_lookup_enum_by_name( const char *symbol ); #else diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 490110a6d24..c60b58a4926 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.3 + * Version: 7.6 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. 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"), @@ -53,6 +54,7 @@ static const struct { { OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) }, { OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) }, { OFF, "GL_ARB_imaging", F(ARB_imaging) }, + { OFF, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range) }, { ON, "GL_ARB_multisample", F(ARB_multisample) }, { OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, { OFF, "GL_ARB_occlusion_query", F(ARB_occlusion_query) }, @@ -76,6 +78,7 @@ static const struct { { OFF, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two)}, { OFF, "GL_ARB_texture_rectangle", F(NV_texture_rectangle) }, { ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) }, + { OFF, "GL_ARB_vertex_array_object", F(ARB_vertex_array_object) }, { ON, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object) }, { OFF, "GL_ARB_vertex_program", F(ARB_vertex_program) }, { OFF, "GL_ARB_vertex_shader", F(ARB_vertex_shader) }, @@ -107,6 +110,7 @@ static const struct { { OFF, "GL_EXT_pixel_buffer_object", F(EXT_pixel_buffer_object) }, { OFF, "GL_EXT_point_parameters", F(EXT_point_parameters) }, { ON, "GL_EXT_polygon_offset", F(EXT_polygon_offset) }, + { OFF, "GL_EXT_provoking_vertex", F(EXT_provoking_vertex) }, { ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) }, { OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) }, { ON, "GL_EXT_separate_specular_color", F(EXT_separate_specular_color) }, @@ -199,6 +203,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #endif ctx->Extensions.ARB_half_float_pixel = GL_TRUE; ctx->Extensions.ARB_imaging = GL_TRUE; + ctx->Extensions.ARB_map_buffer_range = GL_TRUE; ctx->Extensions.ARB_multitexture = GL_TRUE; #if FEATURE_ARB_occlusion_query ctx->Extensions.ARB_occlusion_query = GL_TRUE; @@ -223,6 +228,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/ ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; + ctx->Extensions.ARB_vertex_array_object = GL_TRUE; #if FEATURE_ARB_vertex_program ctx->Extensions.ARB_vertex_program = GL_TRUE; #endif @@ -263,6 +269,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; #endif ctx->Extensions.EXT_point_parameters = GL_TRUE; + ctx->Extensions.EXT_provoking_vertex = GL_TRUE; ctx->Extensions.EXT_shadow_funcs = GL_TRUE; ctx->Extensions.EXT_secondary_color = GL_TRUE; ctx->Extensions.EXT_shared_texture_palette = GL_TRUE; diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 43325b13529..80dde4b5aa2 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -1,8 +1,8 @@ /************************************************************************** - * + * * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. * 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 @@ -10,11 +10,11 @@ * 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. @@ -22,7 +22,7 @@ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * **************************************************************************/ /** @@ -48,20 +48,16 @@ struct state_key { unsigned light_color_material_mask:12; - unsigned light_material_mask:12; unsigned light_global_enabled:1; unsigned light_local_viewer:1; unsigned light_twoside:1; - unsigned light_color_material:1; unsigned material_shininess_is_zero:1; unsigned need_eye_coords:1; unsigned normalize:1; unsigned rescale_normals:1; unsigned fog_source_is_depth:1; - unsigned tnl_do_vertex_fog:1; unsigned separate_specular:1; - unsigned fog_mode:2; unsigned point_attenuated:1; unsigned point_array:1; unsigned texture_enabled_global:1; @@ -73,7 +69,7 @@ struct state_key { unsigned light_enabled:1; unsigned light_eyepos3_is_zero:1; unsigned light_spotcutoff_is_180:1; - unsigned light_attenuated:1; + unsigned light_attenuated:1; unsigned texunit_really_enabled:1; unsigned texmat_enabled:1; unsigned texgen_enabled:4; @@ -85,23 +81,6 @@ struct state_key { }; - -#define FOG_NONE 0 -#define FOG_LINEAR 1 -#define FOG_EXP 2 -#define FOG_EXP2 3 - -static GLuint translate_fog_mode( GLenum mode ) -{ - switch (mode) { - case GL_LINEAR: return FOG_LINEAR; - case GL_EXP: return FOG_EXP; - case GL_EXP2: return FOG_EXP2; - default: return FOG_NONE; - } -} - - #define TXG_NONE 0 #define TXG_OBJ_LINEAR 1 #define TXG_EYE_LINEAR 2 @@ -125,42 +104,6 @@ static GLuint translate_texgen( GLboolean enabled, GLenum mode ) } -/** - * Returns bitmask of flags indicating which materials are set per-vertex - * in the current VB. - * XXX get these from the VBO... - */ -static GLbitfield -tnl_get_per_vertex_materials(GLcontext *ctx) -{ - GLbitfield mask = 0x0; -#if 0 - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint i; - - for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) - if (VB->AttribPtr[i] && VB->AttribPtr[i]->stride) - mask |= 1 << (i - _TNL_FIRST_MAT); -#endif - return mask; -} - - -/** - * Should fog be computed per-vertex? - */ -static GLboolean -tnl_get_per_vertex_fog(GLcontext *ctx) -{ -#if 0 - TNLcontext *tnl = TNL_CONTEXT(ctx); - return tnl->_DoVertexFog; -#else - return GL_FALSE; -#endif -} - static GLboolean check_active_shininess( GLcontext *ctx, const struct state_key *key, @@ -168,10 +111,11 @@ static GLboolean check_active_shininess( GLcontext *ctx, { GLuint bit = 1 << (MAT_ATTRIB_FRONT_SHININESS + side); - if (key->light_color_material_mask & bit) + if ((key->varying_vp_inputs & VERT_BIT_COLOR0) && + (key->light_color_material_mask & bit)) return GL_TRUE; - if (key->light_material_mask & bit) + if (key->varying_vp_inputs & (bit << 16)) return GL_TRUE; if (ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS + side][0] != 0.0F) @@ -216,12 +160,9 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) key->light_twoside = 1; if (ctx->Light.ColorMaterialEnabled) { - key->light_color_material = 1; key->light_color_material_mask = ctx->Light.ColorMaterialBitmask; } - key->light_material_mask = tnl_get_per_vertex_materials(ctx); - for (i = 0; i < MAX_LIGHTS; i++) { struct gl_light *light = &ctx->Light.Light[i]; @@ -230,7 +171,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) if (light->EyePosition[3] == 0.0) key->unit[i].light_eyepos3_is_zero = 1; - + if (light->SpotCutoff == 180.0) key->unit[i].light_spotcutoff_is_180 = 1; @@ -259,12 +200,8 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) if (ctx->Transform.RescaleNormals) key->rescale_normals = 1; - key->fog_mode = translate_fog_mode(fp->FogOption); - if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) key->fog_source_is_depth = 1; - - key->tnl_do_vertex_fog = tnl_get_per_vertex_fog(ctx); if (ctx->Point._Attenuated) key->point_attenuated = 1; @@ -278,29 +215,29 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) ctx->Texture._TexMatEnabled || ctx->Texture._EnabledUnits) key->texture_enabled_global = 1; - + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; if (texUnit->_ReallyEnabled) key->unit[i].texunit_really_enabled = 1; - if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) + if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) key->unit[i].texmat_enabled = 1; - + if (texUnit->TexGenEnabled) { key->unit[i].texgen_enabled = 1; - - key->unit[i].texgen_mode0 = + + key->unit[i].texgen_mode0 = translate_texgen( texUnit->TexGenEnabled & (1<<0), texUnit->GenS.Mode ); - key->unit[i].texgen_mode1 = + key->unit[i].texgen_mode1 = translate_texgen( texUnit->TexGenEnabled & (1<<1), texUnit->GenT.Mode ); - key->unit[i].texgen_mode2 = + key->unit[i].texgen_mode2 = translate_texgen( texUnit->TexGenEnabled & (1<<2), texUnit->GenR.Mode ); - key->unit[i].texgen_mode3 = + key->unit[i].texgen_mode3 = translate_texgen( texUnit->TexGenEnabled & (1<<3), texUnit->GenQ.Mode ); } @@ -308,7 +245,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) } - + /* Very useful debugging tool - produces annotated listing of * generated program with line/function references for each * instruction back into this file: @@ -317,7 +254,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) /* Use uregs to represent registers internally, translate to Mesa's - * expected formats on emit. + * expected formats on emit. * * NOTE: These are passed by value extensively in this file rather * than as usual by pointer reference. If this disturbs you, try @@ -343,10 +280,10 @@ struct tnl_program { struct gl_vertex_program *program; GLint max_inst; /** number of instructions allocated for program */ GLboolean mvp_with_dp4; - + GLuint temp_in_use; GLuint temp_reserved; - + struct ureg eye_position; struct ureg eye_position_z; struct ureg eye_position_normalized; @@ -450,7 +387,7 @@ static void release_temps( struct tnl_program *p ) } -static struct ureg register_param5(struct tnl_program *p, +static struct ureg register_param5(struct tnl_program *p, GLint s0, GLint s1, GLint s2, @@ -481,9 +418,9 @@ static struct ureg register_param5(struct tnl_program *p, */ static struct ureg register_input( struct tnl_program *p, GLuint input ) { - /* Material attribs are passed here as inputs >= 32 - */ - if (input >= 32 || (p->state->varying_vp_inputs & (1<<input))) { + assert(input < 32); + + if (p->state->varying_vp_inputs & (1<<input)) { p->program->Base.InputsRead |= (1<<input); return make_ureg(PROGRAM_INPUT, input); } @@ -503,7 +440,7 @@ static struct ureg register_output( struct tnl_program *p, GLuint output ) } -static struct ureg register_const4f( struct tnl_program *p, +static struct ureg register_const4f( struct tnl_program *p, GLfloat s0, GLfloat s1, GLfloat s2, @@ -535,7 +472,7 @@ static GLboolean is_undef( struct ureg reg ) static struct ureg get_identity_param( struct tnl_program *p ) { - if (is_undef(p->identity)) + if (is_undef(p->identity)) p->identity = register_const4f(p, 0,0,0,1); return p->identity; @@ -554,7 +491,7 @@ static void register_matrix_param5( struct tnl_program *p, /* This is a bit sad as the support is there to pull the whole * matrix out in one go: */ - for (i = 0; i <= s3 - s2; i++) + for (i = 0; i <= s3 - s2; i++) matrix[i] = register_param5( p, s0, s1, i, i, s4 ); } @@ -579,7 +516,7 @@ static void emit_dst( struct prog_dst_register *dst, dst->File = reg.file; dst->Index = reg.idx; /* allow zero as a shorthand for xyzw */ - dst->WriteMask = mask ? mask : WRITEMASK_XYZW; + dst->WriteMask = mask ? mask : WRITEMASK_XYZW; dst->CondMask = COND_TR; /* always pass cond test */ dst->CondSwizzle = SWIZZLE_NOOP; dst->CondSrc = 0; @@ -594,12 +531,12 @@ static void debug_insn( struct prog_instruction *inst, const char *fn, { if (DISASSEM) { static const char *last_fn; - + if (fn != last_fn) { last_fn = fn; _mesa_printf("%s:\n", fn); } - + _mesa_printf("%d:\t", line); _mesa_print_instruction(inst); } @@ -618,7 +555,7 @@ static void emit_op3fn(struct tnl_program *p, { GLuint nr; struct prog_instruction *inst; - + assert((GLint) p->program->Base.NumInstructions <= p->max_inst); if (p->program->Base.NumInstructions == p->max_inst) { @@ -643,16 +580,16 @@ static void emit_op3fn(struct tnl_program *p, p->program->Base.Instructions = newInst; } - + nr = p->program->Base.NumInstructions++; inst = &p->program->Base.Instructions[nr]; - inst->Opcode = (enum prog_opcode) op; + inst->Opcode = (enum prog_opcode) op; inst->Data = 0; - + emit_arg( &inst->SrcReg[0], src0 ); emit_arg( &inst->SrcReg[1], src1 ); - emit_arg( &inst->SrcReg[2], src2 ); + emit_arg( &inst->SrcReg[2], src2 ); emit_dst( &inst->DstReg, dest, mask ); @@ -672,7 +609,7 @@ static void emit_op3fn(struct tnl_program *p, static struct ureg make_temp( struct tnl_program *p, struct ureg reg ) { - if (reg.file == PROGRAM_TEMPORARY && + if (reg.file == PROGRAM_TEMPORARY && !(p->temp_reserved & (1<<reg.idx))) return reg; else { @@ -753,19 +690,19 @@ static void emit_normalize_vec3( struct tnl_program *p, } -static void emit_passthrough( struct tnl_program *p, +static void emit_passthrough( struct tnl_program *p, GLuint input, GLuint output ) { struct ureg out = register_output(p, output); - emit_op1(p, OPCODE_MOV, out, 0, register_input(p, input)); + emit_op1(p, OPCODE_MOV, out, 0, register_input(p, input)); } static struct ureg get_eye_position( struct tnl_program *p ) { if (is_undef(p->eye_position)) { - struct ureg pos = register_input( p, VERT_ATTRIB_POS ); + struct ureg pos = register_input( p, VERT_ATTRIB_POS ); struct ureg modelview[4]; p->eye_position = reserve_temp(p); @@ -783,18 +720,18 @@ static struct ureg get_eye_position( struct tnl_program *p ) emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos); } } - + return p->eye_position; } static struct ureg get_eye_position_z( struct tnl_program *p ) { - if (!is_undef(p->eye_position)) + if (!is_undef(p->eye_position)) return swizzle1(p->eye_position, Z); if (is_undef(p->eye_position_z)) { - struct ureg pos = register_input( p, VERT_ATTRIB_POS ); + struct ureg pos = register_input( p, VERT_ATTRIB_POS ); struct ureg modelview[4]; p->eye_position_z = reserve_temp(p); @@ -804,10 +741,10 @@ static struct ureg get_eye_position_z( struct tnl_program *p ) emit_op2(p, OPCODE_DP4, p->eye_position_z, 0, pos, modelview[2]); } - + return p->eye_position_z; } - + static struct ureg get_eye_position_normalized( struct tnl_program *p ) { @@ -816,7 +753,7 @@ static struct ureg get_eye_position_normalized( struct tnl_program *p ) p->eye_position_normalized = reserve_temp(p); emit_normalize_vec3(p, p->eye_position_normalized, eye); } - + return p->eye_position_normalized; } @@ -830,7 +767,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p ) { p->transformed_normal = register_input(p, VERT_ATTRIB_NORMAL ); } - else if (is_undef(p->transformed_normal)) + else if (is_undef(p->transformed_normal)) { struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL ); struct ureg mvinv[3]; @@ -861,7 +798,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p ) emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale ); normal = transformed_normal; } - + assert(normal.file == PROGRAM_TEMPORARY); p->transformed_normal = normal; } @@ -872,17 +809,17 @@ static struct ureg get_transformed_normal( struct tnl_program *p ) static void build_hpos( struct tnl_program *p ) { - struct ureg pos = register_input( p, VERT_ATTRIB_POS ); + struct ureg pos = register_input( p, VERT_ATTRIB_POS ); struct ureg hpos = register_output( p, VERT_RESULT_HPOS ); struct ureg mvp[4]; if (p->mvp_with_dp4) { - register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, + register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, 0, mvp ); emit_matrix_transform_vec4( p, hpos, mvp, pos ); } else { - register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, + register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, STATE_MATRIX_TRANSPOSE, mvp ); emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos ); } @@ -903,27 +840,28 @@ static void set_material_flags( struct tnl_program *p ) p->color_materials = 0; p->materials = 0; - if (p->state->light_color_material) { - p->materials = + if (p->state->varying_vp_inputs & VERT_BIT_COLOR0) { + p->materials = p->color_materials = p->state->light_color_material_mask; } - p->materials |= p->state->light_material_mask; + p->materials |= (p->state->varying_vp_inputs >> 16); } -/* XXX temporary!!! */ -#define _TNL_ATTRIB_MAT_FRONT_AMBIENT 32 - -static struct ureg get_material( struct tnl_program *p, GLuint side, +static struct ureg get_material( struct tnl_program *p, GLuint side, GLuint property ) { GLuint attrib = material_attrib(side, property); if (p->color_materials & (1<<attrib)) return register_input(p, VERT_ATTRIB_COLOR0); - else if (p->materials & (1<<attrib)) - return register_input( p, attrib + _TNL_ATTRIB_MAT_FRONT_AMBIENT ); + else if (p->materials & (1<<attrib)) { + /* Put material values in the GENERIC slots -- they are not used + * for anything in fixed function mode. + */ + return register_input( p, attrib + VERT_ATTRIB_GENERIC0 ); + } else return register_param3( p, STATE_MATERIAL, side, property ); } @@ -952,7 +890,7 @@ static struct ureg get_scenecolor( struct tnl_program *p, GLuint side ) struct ureg material_ambient = get_material(p, side, STATE_AMBIENT); struct ureg material_diffuse = get_material(p, side, STATE_DIFFUSE); struct ureg tmp = make_temp(p, material_diffuse); - emit_op3(p, OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient, + emit_op3(p, OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient, material_ambient, material_emission); return tmp; } @@ -961,12 +899,12 @@ static struct ureg get_scenecolor( struct tnl_program *p, GLuint side ) } -static struct ureg get_lightprod( struct tnl_program *p, GLuint light, +static struct ureg get_lightprod( struct tnl_program *p, GLuint light, GLuint side, GLuint property ) { GLuint attrib = material_attrib(side, property); if (p->materials & (1<<attrib)) { - struct ureg light_value = + struct ureg light_value = register_param3(p, STATE_LIGHT, light, property); struct ureg material_value = get_material(p, side, property); struct ureg tmp = get_temp(p); @@ -979,7 +917,7 @@ static struct ureg get_lightprod( struct tnl_program *p, GLuint light, static struct ureg calculate_light_attenuation( struct tnl_program *p, - GLuint i, + GLuint i, struct ureg VPpli, struct ureg dist ) { @@ -1008,27 +946,27 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p, */ if (p->state->unit[i].light_attenuated) { /* 1/d,d,d,1/d */ - emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist); + emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist); /* 1,d,d*d,1/d */ - emit_op2(p, OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y)); + emit_op2(p, OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y)); /* 1/dist-atten */ - emit_op2(p, OPCODE_DP3, dist, 0, attenuation, dist); + emit_op2(p, OPCODE_DP3, dist, 0, attenuation, dist); if (!p->state->unit[i].light_spotcutoff_is_180) { /* dist-atten */ - emit_op1(p, OPCODE_RCP, dist, 0, dist); + emit_op1(p, OPCODE_RCP, dist, 0, dist); /* spot-atten * dist-atten */ - emit_op2(p, OPCODE_MUL, att, 0, dist, att); + emit_op2(p, OPCODE_MUL, att, 0, dist, att); } else { /* dist-atten */ - emit_op1(p, OPCODE_RCP, att, 0, dist); + emit_op1(p, OPCODE_RCP, att, 0, dist); } } return att; } - + /** * Compute: @@ -1047,7 +985,7 @@ static void emit_degenerate_lit( struct tnl_program *p, /* MAX lit, id, dots; */ - emit_op2(p, OPCODE_MAX, lit, WRITEMASK_XYZW, id, dots); + emit_op2(p, OPCODE_MAX, lit, WRITEMASK_XYZW, id, dots); /* result[2] = (in > 0 ? 1 : 0) * SLT lit.z, id.z, dots; # lit.z = (0 < dots.z) ? 1 : 0 @@ -1080,10 +1018,10 @@ static void build_lighting( struct tnl_program *p ) * dots.w = front.shininess */ - for (i = 0; i < MAX_LIGHTS; i++) + for (i = 0; i < MAX_LIGHTS; i++) if (p->state->unit[i].light_enabled) nr_lights++; - + set_material_flags(p); { @@ -1106,7 +1044,7 @@ static void build_lighting( struct tnl_program *p ) * The negation will be un-done later in the back-face code below. */ struct ureg shininess = get_material(p, 1, STATE_SHININESS); - emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z, + emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z, negate(swizzle1(shininess,X))); release_temp(p, shininess); } @@ -1134,12 +1072,12 @@ static void build_lighting( struct tnl_program *p ) struct ureg res0 = register_output( p, VERT_RESULT_BFC0 ); emit_op1(p, OPCODE_MOV, res0, 0, _bfc0); } - + if (twoside && separate) { struct ureg res1 = register_output( p, VERT_RESULT_BFC1 ); emit_op1(p, OPCODE_MOV, res1, 0, _bfc1); } - + if (nr_lights == 0) { release_temps(p); return; @@ -1149,16 +1087,16 @@ static void build_lighting( struct tnl_program *p ) if (p->state->unit[i].light_enabled) { struct ureg half = undef; struct ureg att = undef, VPpli = undef; - + count++; if (p->state->unit[i].light_eyepos3_is_zero) { /* Can used precomputed constants in this case. * Attenuation never applies to infinite lights. */ - VPpli = register_param3(p, STATE_INTERNAL, - STATE_LIGHT_POSITION_NORMALIZED, i); - + VPpli = register_param3(p, STATE_INTERNAL, + STATE_LIGHT_POSITION_NORMALIZED, i); + if (!p->state->material_shininess_is_zero) { if (p->state->light_local_viewer) { struct ureg eye_hat = get_eye_position_normalized(p); @@ -1167,22 +1105,22 @@ static void build_lighting( struct tnl_program *p ) emit_normalize_vec3(p, half, half); } else { - half = register_param3(p, STATE_INTERNAL, + half = register_param3(p, STATE_INTERNAL, STATE_LIGHT_HALF_VECTOR, i); } } } else { - struct ureg Ppli = register_param3(p, STATE_INTERNAL, - STATE_LIGHT_POSITION, i); + struct ureg Ppli = register_param3(p, STATE_INTERNAL, + STATE_LIGHT_POSITION, i); struct ureg V = get_eye_position(p); struct ureg dist = get_temp(p); - VPpli = get_temp(p); - + VPpli = get_temp(p); + /* Calculate VPpli vector */ - emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V); + emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V); /* Normalize VPpli. The dist value also used in * attenuation below. @@ -1192,7 +1130,7 @@ static void build_lighting( struct tnl_program *p ) emit_op2(p, OPCODE_MUL, VPpli, 0, VPpli, dist); /* Calculate attenuation: - */ + */ if (!p->state->unit[i].light_spotcutoff_is_180 || p->state->unit[i].light_attenuated) { att = calculate_light_attenuation(p, i, VPpli, dist); @@ -1208,7 +1146,7 @@ static void build_lighting( struct tnl_program *p ) emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); } else { - struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z); + struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z); emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir); } @@ -1277,7 +1215,7 @@ static void build_lighting( struct tnl_program *p ) emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0); emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1); - + release_temp(p, ambient); release_temp(p, diffuse); release_temp(p, specular); @@ -1291,7 +1229,7 @@ static void build_lighting( struct tnl_program *p ) struct ureg specular = get_lightprod(p, i, 1, STATE_SPECULAR); struct ureg res0, res1; GLuint mask0, mask1; - + if (count == nr_lights) { if (separate) { mask0 = WRITEMASK_XYZ; @@ -1368,52 +1306,10 @@ static void build_fog( struct tnl_program *p ) input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X); } - if (p->state->fog_mode && p->state->tnl_do_vertex_fog) { - struct ureg params = register_param2(p, STATE_INTERNAL, - STATE_FOG_PARAMS_OPTIMIZED); - struct ureg tmp = get_temp(p); - GLboolean useabs = (p->state->fog_mode != FOG_EXP2); - - if (useabs) { - emit_op1(p, OPCODE_ABS, tmp, 0, input); - } - - switch (p->state->fog_mode) { - case FOG_LINEAR: { - struct ureg id = get_identity_param(p); - emit_op3(p, OPCODE_MAD, tmp, 0, useabs ? tmp : input, - swizzle1(params,X), swizzle1(params,Y)); - emit_op2(p, OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */ - emit_op2(p, OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W)); - break; - } - case FOG_EXP: - emit_op2(p, OPCODE_MUL, tmp, 0, useabs ? tmp : input, - swizzle1(params,Z)); - emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp)); - break; - case FOG_EXP2: - emit_op2(p, OPCODE_MUL, tmp, 0, input, swizzle1(params,W)); - emit_op2(p, OPCODE_MUL, tmp, 0, tmp, tmp); - emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp)); - break; - } - - release_temp(p, tmp); - } - else { - /* results = incoming fog coords (compute fog per-fragment later) - * - * KW: Is it really necessary to do anything in this case? - * BP: Yes, we always need to compute the absolute value, unless - * we want to push that down into the fragment program... - */ - GLboolean useabs = GL_TRUE; - emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, WRITEMASK_X, input); - } + emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input); } - + static void build_reflect_texgen( struct tnl_program *p, struct ureg dest, GLuint writemask ) @@ -1423,9 +1319,9 @@ static void build_reflect_texgen( struct tnl_program *p, struct ureg tmp = get_temp(p); /* n.u */ - emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat); + emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat); /* 2n.u */ - emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp); + emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp); /* (-2n.u)n + u */ emit_op3(p, OPCODE_MAD, dest, writemask, negate(tmp), normal, eye_hat); @@ -1454,22 +1350,22 @@ static void build_sphere_texgen( struct tnl_program *p, */ /* n.u */ - emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat); + emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat); /* 2n.u */ - emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp); + emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp); /* (-2n.u)n + u */ - emit_op3(p, OPCODE_MAD, r, 0, negate(tmp), normal, eye_hat); + emit_op3(p, OPCODE_MAD, r, 0, negate(tmp), normal, eye_hat); /* r + 0,0,1 */ - emit_op2(p, OPCODE_ADD, tmp, 0, r, swizzle(id,X,Y,W,Z)); + emit_op2(p, OPCODE_ADD, tmp, 0, r, swizzle(id,X,Y,W,Z)); /* rx^2 + ry^2 + (rz+1)^2 */ - emit_op2(p, OPCODE_DP3, tmp, 0, tmp, tmp); + emit_op2(p, OPCODE_DP3, tmp, 0, tmp, tmp); /* 2/m */ - emit_op1(p, OPCODE_RSQ, tmp, 0, tmp); + emit_op1(p, OPCODE_RSQ, tmp, 0, tmp); /* 1/m */ - emit_op2(p, OPCODE_MUL, inv_m, 0, tmp, half); + emit_op2(p, OPCODE_MUL, inv_m, 0, tmp, half); /* r/m + 1/2 */ - emit_op3(p, OPCODE_MAD, dest, writemask, r, inv_m, half); - + emit_op3(p, OPCODE_MAD, dest, writemask, r, inv_m, half); + release_temp(p, tmp); release_temp(p, r); release_temp(p, inv_m); @@ -1484,10 +1380,10 @@ static void build_texture_transform( struct tnl_program *p ) if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i))) continue; - - if (p->state->unit[i].texgen_enabled || + + if (p->state->unit[i].texgen_enabled || p->state->unit[i].texmat_enabled) { - + GLuint texmat_enabled = p->state->unit[i].texmat_enabled; struct ureg out = register_output(p, VERT_RESULT_TEX0 + i); struct ureg out_texgen = undef; @@ -1498,8 +1394,8 @@ static void build_texture_transform( struct tnl_program *p ) GLuint reflect_mask = 0; GLuint normal_mask = 0; GLuint modes[4]; - - if (texmat_enabled) + + if (texmat_enabled) out_texgen = get_temp(p); else out_texgen = out; @@ -1513,31 +1409,31 @@ static void build_texture_transform( struct tnl_program *p ) switch (modes[j]) { case TXG_OBJ_LINEAR: { struct ureg obj = register_input(p, VERT_ATTRIB_POS); - struct ureg plane = + struct ureg plane = register_param3(p, STATE_TEXGEN, i, STATE_TEXGEN_OBJECT_S + j); - emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j, + emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j, obj, plane ); break; } case TXG_EYE_LINEAR: { struct ureg eye = get_eye_position(p); - struct ureg plane = - register_param3(p, STATE_TEXGEN, i, + struct ureg plane = + register_param3(p, STATE_TEXGEN, i, STATE_TEXGEN_EYE_S + j); - emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j, + emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j, eye, plane ); break; } - case TXG_SPHERE_MAP: + case TXG_SPHERE_MAP: sphere_mask |= WRITEMASK_X << j; break; case TXG_REFLECTION_MAP: reflect_mask |= WRITEMASK_X << j; break; - case TXG_NORMAL_MAP: + case TXG_NORMAL_MAP: normal_mask |= WRITEMASK_X << j; break; case TXG_NONE: @@ -1566,8 +1462,8 @@ static void build_texture_transform( struct tnl_program *p ) if (texmat_enabled) { struct ureg texmat[4]; - struct ureg in = (!is_undef(out_texgen) ? - out_texgen : + struct ureg in = (!is_undef(out_texgen) ? + out_texgen : register_input(p, VERT_ATTRIB_TEX0+i)); if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3, @@ -1629,17 +1525,6 @@ static void build_atten_pointsize( struct tnl_program *p ) /** - * Emit constant point size. - */ -static void build_constant_pointsize( struct tnl_program *p ) -{ - struct ureg state_size = register_param1(p, STATE_POINT_SIZE); - struct ureg out = register_output(p, VERT_RESULT_PSIZ); - emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, state_size); -} - - -/** * Pass-though per-vertex point size, from user's point size array. */ static void build_array_pointsize( struct tnl_program *p ) @@ -1670,8 +1555,7 @@ static void build_tnl_program( struct tnl_program *p ) } } - if ((p->state->fragprog_inputs_read & FRAG_BIT_FOGC) || - p->state->fog_mode != FOG_NONE) + if (p->state->fragprog_inputs_read & FRAG_BIT_FOGC) build_fog(p); if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY) @@ -1681,12 +1565,6 @@ static void build_tnl_program( struct tnl_program *p ) build_atten_pointsize(p); else if (p->state->point_array) build_array_pointsize(p); -#if 0 - else - build_constant_pointsize(p); -#else - (void) build_constant_pointsize; -#endif /* Finish up: */ @@ -1718,7 +1596,7 @@ create_new_program( const struct state_key *key, p.identity = undef; p.temp_in_use = 0; p.mvp_with_dp4 = mvp_with_dp4; - + if (max_temps >= sizeof(int) * 8) p.temp_reserved = 0; else @@ -1761,14 +1639,14 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) */ prog = (struct gl_vertex_program *) _mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key)); - + if (!prog) { /* OK, we'll have to build a new one */ if (0) _mesa_printf("Build new TNL program\n"); - + prog = (struct gl_vertex_program *) - ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); if (!prog) return NULL; @@ -1778,7 +1656,7 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) #if 0 if (ctx->Driver.ProgramStringNotify) - ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB, + ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB, &prog->Base ); #endif _mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache, diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 1ed6fc33832..516159bbf2f 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1835,6 +1835,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) CHECK_EXT1(EXT_framebuffer_blit, "GetBooleanv"); params[0] = INT_TO_BOOLEAN(ctx->ReadBuffer->Name); break; + case GL_PROVOKING_VERTEX_EXT: + CHECK_EXT1(EXT_provoking_vertex, "GetBooleanv"); + params[0] = ctx->Light.ProvokingVertex; + break; + case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: + CHECK_EXT1(EXT_provoking_vertex, "GetBooleanv"); + params[0] = ctx->Const.QuadsFollowProvokingVertexConvention; + break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetBooleanv"); params[0] = INT_TO_BOOLEAN(ctx->Const.FragmentProgram.MaxUniformComponents); @@ -3649,6 +3657,14 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) CHECK_EXT1(EXT_framebuffer_blit, "GetFloatv"); params[0] = (GLfloat)(ctx->ReadBuffer->Name); break; + case GL_PROVOKING_VERTEX_EXT: + CHECK_EXT1(EXT_provoking_vertex, "GetFloatv"); + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.ProvokingVertex); + break; + case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: + CHECK_EXT1(EXT_provoking_vertex, "GetFloatv"); + params[0] = BOOLEAN_TO_FLOAT(ctx->Const.QuadsFollowProvokingVertexConvention); + break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetFloatv"); params[0] = (GLfloat)(ctx->Const.FragmentProgram.MaxUniformComponents); @@ -5463,6 +5479,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) CHECK_EXT1(EXT_framebuffer_blit, "GetIntegerv"); params[0] = ctx->ReadBuffer->Name; break; + case GL_PROVOKING_VERTEX_EXT: + CHECK_EXT1(EXT_provoking_vertex, "GetIntegerv"); + params[0] = BOOLEAN_TO_INT(ctx->Light.ProvokingVertex); + break; + case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: + CHECK_EXT1(EXT_provoking_vertex, "GetIntegerv"); + params[0] = BOOLEAN_TO_INT(ctx->Const.QuadsFollowProvokingVertexConvention); + break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetIntegerv"); params[0] = ctx->Const.FragmentProgram.MaxUniformComponents; diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 43ee5fff109..5666ad0e42e 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -976,6 +976,13 @@ StateVars = [ ( "GL_READ_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->ReadBuffer->Name"], "", ["EXT_framebuffer_blit"] ), + # GL_EXT_provoking_vertex + ( "GL_PROVOKING_VERTEX_EXT", GLboolean, + ["ctx->Light.ProvokingVertex"], "", ["EXT_provoking_vertex"] ), + ( "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT", GLboolean, + ["ctx->Const.QuadsFollowProvokingVertexConvention"], "", + ["EXT_provoking_vertex"] ), + # GL_ARB_fragment_shader ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint, ["ctx->Const.FragmentProgram.MaxUniformComponents"], "", diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index ac604fd12cc..0f0d831feef 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.0 + * Version: 7.5 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. 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"), @@ -64,6 +65,37 @@ _mesa_ShadeModel( GLenum mode ) /** + * Set the provoking vertex (the vertex which specifies the prim's + * color when flat shading) to either the first or last vertex of the + * triangle or line. + */ +void GLAPIENTRY +_mesa_ProvokingVertexEXT(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE&VERBOSE_API) + _mesa_debug(ctx, "glProvokingVertexEXT 0x%x\n", mode); + + switch (mode) { + case GL_FIRST_VERTEX_CONVENTION_EXT: + case GL_LAST_VERTEX_CONVENTION_EXT: + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glProvokingVertexEXT(0x%x)", mode); + return; + } + + if (ctx->Light.ProvokingVertex == mode) + return; + + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.ProvokingVertex = mode; +} + + +/** * Helper function called by _mesa_Lightfv and _mesa_PopAttrib to set * per-light state. * For GL_POSITION and GL_SPOT_DIRECTION the params position/direction @@ -1348,6 +1380,7 @@ _mesa_init_lighting( GLcontext *ctx ) init_lightmodel( &ctx->Light.Model ); init_material( &ctx->Light.Material ); ctx->Light.ShadeModel = GL_SMOOTH; + ctx->Light.ProvokingVertex = GL_LAST_VERTEX_CONVENTION_EXT; ctx->Light.Enabled = GL_FALSE; ctx->Light.ColorMaterialFace = GL_FRONT_AND_BACK; ctx->Light.ColorMaterialMode = GL_AMBIENT_AND_DIFFUSE; diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h index b97e17b5be4..9c1a5eefadd 100644 --- a/src/mesa/main/light.h +++ b/src/mesa/main/light.h @@ -1,13 +1,9 @@ -/** - * \file light.h - * Lighting. - */ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 7.5 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. 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"), @@ -37,6 +33,10 @@ extern void GLAPIENTRY _mesa_ShadeModel( GLenum mode ); +extern void GLAPIENTRY +_mesa_ProvokingVertexEXT(GLenum mode); + + #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_ColorMaterial( GLenum face, GLenum mode ); diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 01d59dd42da..4ca7957ffad 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -55,7 +55,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; /** Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0], texture/fb data */ -#define BYTE_TO_FLOAT_TEX(B) ((B) == -128 ? -1.0 : (B) * (1.0F/127.0F)) +#define BYTE_TO_FLOAT_TEX(B) ((B) == -128 ? -1.0F : (B) * (1.0F/127.0F)) /** Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127], texture/fb data */ #define FLOAT_TO_BYTE_TEX(X) ( (GLint) (127.0F * (X)) ) @@ -65,7 +65,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F)) /** Convert GLfloat in [0.0,1.0] to GLushort in [0, 65535] */ -#define FLOAT_TO_USHORT(X) ((GLuint) ((X) * 65535.0)) +#define FLOAT_TO_USHORT(X) ((GLuint) ((X) * 65535.0F)) /** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */ @@ -76,35 +76,35 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; /** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0], texture/fb data */ -#define SHORT_TO_FLOAT_TEX(S) ((S) == -32768 ? -1.0 : (S) * (1.0F/32767.0F)) +#define SHORT_TO_FLOAT_TEX(S) ((S) == -32768 ? -1.0F : (S) * (1.0F/32767.0F)) /** Convert GLfloat in [-1.0,1.0] to GLshort in [-32768,32767], texture/fb data */ #define FLOAT_TO_SHORT_TEX(X) ( (GLint) (32767.0F * (X)) ) /** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */ -#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0F)) +#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0)) /** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */ #define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0)) /** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */ -#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0F)) +#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0)) /** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */ /* causes overflow: -#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0F * (X))) - 1) / 2 ) +#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0 * (X))) - 1) / 2 ) */ /* a close approximation: */ #define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) ) /** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0], texture/fb data */ -#define INT_TO_FLOAT_TEX(I) ((I) == -2147483648 ? -1.0 : (I) * (1.0F/2147483647.0)) +#define INT_TO_FLOAT_TEX(I) ((I) == -2147483648 ? -1.0F : (I) * (1.0F/2147483647.0)) /** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647], texture/fb data */ -#define FLOAT_TO_INT_TEX(X) ( (GLint) (2147483647.0F * (X)) ) +#define FLOAT_TO_INT_TEX(X) ( (GLint) (2147483647.0 * (X)) ) #define BYTE_TO_UBYTE(b) ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b))) @@ -120,7 +120,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #define INT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 15))) #define UINT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 16))) #define UNCLAMPED_FLOAT_TO_USHORT(us, f) \ - us = ( (GLushort) IROUND( CLAMP((f), 0.0, 1.0) * 65535.0F) ) + us = ( (GLushort) IROUND( CLAMP((f), 0.0F, 1.0F) * 65535.0F) ) #define CLAMPED_FLOAT_TO_USHORT(us, f) \ us = ( (GLushort) IROUND( (f) * 65535.0F) ) diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 62c3ead3e1b..ef973314e35 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -61,6 +61,7 @@ #define FEATURE_ARB_occlusion_query _HAVE_FULL_GL #define FEATURE_ARB_fragment_program _HAVE_FULL_GL #define FEATURE_ARB_framebuffer_object _HAVE_FULL_GL +#define FEATURE_ARB_map_buffer_range _HAVE_FULL_GL #define FEATURE_ARB_pixel_buffer_object _HAVE_FULL_GL #define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL #define FEATURE_ARB_vertex_program _HAVE_FULL_GL diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 872982fa430..3dca09d9f28 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1601,9 +1601,6 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, return; } - if (dstImage->ImageOffsets) - _mesa_free(dstImage->ImageOffsets); - /* Free old image data */ if (dstImage->Data) ctx->Driver.FreeTexImageData(ctx, dstImage); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 46020eb210e..d7e7d2ac21e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -770,6 +770,7 @@ struct gl_light_attrib GLboolean Enabled; /**< Lighting enabled flag */ GLenum ShadeModel; /**< GL_FLAT or GL_SMOOTH */ + GLenum ProvokingVertex; /**< GL_EXT_provoking_vertex */ GLenum ColorMaterialFace; /**< GL_FRONT, BACK or FRONT_AND_BACK */ GLenum ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */ GLbitfield ColorMaterialBitmask; /**< bitmask formed from Face and Mode */ @@ -1503,7 +1504,7 @@ struct gl_buffer_object GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ /** Fields describing a mapped buffer */ /*@{*/ - GLenum Access; /**< GL_READ_ONLY_ARB, GL_WRITE_ONLY_ARB, etc. */ + GLbitfield AccessFlags; /**< Mask of GL_MAP_x_BIT flags */ GLvoid *Pointer; /**< User-space address of mapping */ GLintptr Offset; /**< Mapped offset */ GLsizeiptr Length; /**< Mapped length */ @@ -1562,6 +1563,7 @@ struct gl_array_object GLint RefCount; _glthread_Mutex Mutex; + GLboolean VBOonly; /**< require all arrays to live in VBOs? */ /** Conventional vertex arrays */ /*@{*/ @@ -1607,6 +1609,9 @@ struct gl_array_attrib /** The default vertex array object */ struct gl_array_object *DefaultArrayObj; + /** Array objects (GL_ARB/APPLE_vertex_array_object) */ + struct _mesa_HashTable *Objects; + GLint ActiveTexture; /**< Client Active Texture */ GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */ GLuint LockCount; /**< GL_EXT_compiled_vertex_array */ @@ -2048,6 +2053,7 @@ struct gl_shader_state struct gl_shader_program *CurrentProgram; /**< The user-bound program */ /** Driver-selectable options: */ GLboolean EmitHighLevelInstructions; /**< IF/ELSE/ENDIF vs. BRA, etc. */ + GLboolean EmitContReturn; /**< Emit CONT/RET opcodes? */ GLboolean EmitCondCodes; /**< Use condition codes? */ GLboolean EmitComments; /**< Annotated instructions */ void *MemPool; @@ -2118,9 +2124,6 @@ struct gl_shared_state struct _mesa_HashTable *FrameBuffers; #endif - /** Objects associated with the GL_APPLE_vertex_array_object extension. */ - struct _mesa_HashTable *ArrayObjects; - void *DriverData; /**< Device driver shared state */ }; @@ -2424,6 +2427,9 @@ struct gl_constants GLuint MaxVarying; /**< Number of float[4] varying parameters */ GLbitfield SupportedBumpUnits; /**> units supporting GL_ATI_envmap_bumpmap as targets */ + + /**< GL_EXT_provoking_vertex */ + GLboolean QuadsFollowProvokingVertexConvention; }; @@ -2443,6 +2449,7 @@ struct gl_extensions GLboolean ARB_framebuffer_object; GLboolean ARB_half_float_pixel; GLboolean ARB_imaging; + GLboolean ARB_map_buffer_range; GLboolean ARB_multisample; GLboolean ARB_multitexture; GLboolean ARB_occlusion_query; @@ -2462,6 +2469,7 @@ struct gl_extensions GLboolean ARB_texture_mirrored_repeat; GLboolean ARB_texture_non_power_of_two; GLboolean ARB_transpose_matrix; + GLboolean ARB_vertex_array_object; GLboolean ARB_vertex_buffer_object; GLboolean ARB_vertex_program; GLboolean ARB_vertex_shader; @@ -2493,6 +2501,7 @@ struct gl_extensions GLboolean EXT_pixel_buffer_object; GLboolean EXT_point_parameters; GLboolean EXT_polygon_offset; + GLboolean EXT_provoking_vertex; GLboolean EXT_rescale_normal; GLboolean EXT_shadow_funcs; GLboolean EXT_secondary_color; @@ -2825,6 +2834,13 @@ struct gl_dlist_state GLubyte ActiveEdgeFlag; GLboolean CurrentEdgeFlag; + + struct { + /* State known to have been set by the currently-compiling display + * list. Used to eliminate some redundant state changes. + */ + GLenum ShadeModel; + } Current; }; @@ -2973,6 +2989,8 @@ struct __GLcontextRec GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLbitfield NewState; /**< bitwise-or of _NEW_* flags */ + GLboolean ViewportInitialized; /**< has viewport size been initialized? */ + GLbitfield varying_vp_inputs; /**< mask of VERT_BIT_* flags */ /** \name Derived state */ diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index c25b31af023..a73c6e05081 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -38,7 +38,7 @@ * \param id - the new object's ID * \return pointer to new query_object object or NULL if out of memory. */ -struct gl_query_object * +static struct gl_query_object * _mesa_new_query_object(GLcontext *ctx, GLuint id) { struct gl_query_object *q = MALLOC_STRUCT(gl_query_object); @@ -57,7 +57,7 @@ _mesa_new_query_object(GLcontext *ctx, GLuint id) * Begin a query. Software driver fallback. * Called via ctx->Driver.BeginQuery(). */ -void +static void _mesa_begin_query(GLcontext *ctx, struct gl_query_object *q) { /* no-op */ @@ -68,7 +68,7 @@ _mesa_begin_query(GLcontext *ctx, struct gl_query_object *q) * End a query. Software driver fallback. * Called via ctx->Driver.EndQuery(). */ -void +static void _mesa_end_query(GLcontext *ctx, struct gl_query_object *q) { q->Ready = GL_TRUE; @@ -79,7 +79,7 @@ _mesa_end_query(GLcontext *ctx, struct gl_query_object *q) * Wait for query to complete. Software driver fallback. * Called via ctx->Driver.WaitQuery(). */ -void +static void _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) { /* For software drivers, _mesa_end_query() should have completed the query. @@ -94,7 +94,7 @@ _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) * Check if a query results are ready. Software driver fallback. * Called via ctx->Driver.CheckQuery(). */ -void +static void _mesa_check_query(GLcontext *ctx, struct gl_query_object *q) { /* No-op for sw rendering. @@ -107,7 +107,7 @@ _mesa_check_query(GLcontext *ctx, struct gl_query_object *q) * Delete a query object. Called via ctx->Driver.DeleteQuery(). * Not removed from hash table here. */ -void +static void _mesa_delete_query(GLcontext *ctx, struct gl_query_object *q) { _mesa_free(q); @@ -123,6 +123,18 @@ lookup_query_object(GLcontext *ctx, GLuint id) +void +_mesa_init_query_object_functions(struct dd_function_table *driver) +{ + driver->NewQueryObject = _mesa_new_query_object; + driver->DeleteQuery = _mesa_delete_query; + driver->BeginQuery = _mesa_begin_query; + driver->EndQuery = _mesa_end_query; + driver->WaitQuery = _mesa_wait_query; + driver->CheckQuery = _mesa_check_query; +} + + void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids) { diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index bc02b65b54c..ee775ef959e 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -27,9 +27,6 @@ #define OCCLUDE_H -extern struct gl_query_object * -_mesa_new_query_object(GLcontext *ctx, GLuint id); - extern void _mesa_init_query(GLcontext *ctx); @@ -37,19 +34,7 @@ extern void _mesa_free_query_data(GLcontext *ctx); extern void -_mesa_delete_query(GLcontext *ctx, struct gl_query_object *q); - -extern void -_mesa_begin_query(GLcontext *ctx, struct gl_query_object *q); - -extern void -_mesa_end_query(GLcontext *ctx, struct gl_query_object *q); - -extern void -_mesa_wait_query(GLcontext *ctx, struct gl_query_object *q); - -extern void -_mesa_check_query(GLcontext *ctx, struct gl_query_object *q); +_mesa_init_query_object_functions(struct dd_function_table *driver); extern void GLAPIENTRY diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 759883743da..ad6e6ce7cd3 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -97,10 +97,8 @@ _mesa_alloc_shared_state(GLcontext *ctx) * it never gets deleted. * XXX with recent/improved refcounting this may not longer be needed. */ - shared->NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0); - shared->NullBufferObj->RefCount = 1000; - - shared->ArrayObjects = _mesa_NewHashTable(); + shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0, 0); + shared->NullBufferObj->RefCount = 1000 * 1000 * 1000; /* Create default texture objects */ for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { @@ -207,18 +205,6 @@ delete_bufferobj_cb(GLuint id, void *data, void *userData) /** - * Callback for deleting an array object. Called by _mesa_HashDeleteAll(). - */ -static void -delete_arrayobj_cb(GLuint id, void *data, void *userData) -{ - struct gl_array_object *arrayObj = (struct gl_array_object *) data; - GLcontext *ctx = (GLcontext *) userData; - _mesa_delete_array_object(ctx, arrayObj); -} - - -/** * Callback for freeing shader program data. Call it before delete_shader_cb * to avoid memory access error. */ @@ -320,9 +306,6 @@ _mesa_free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) _mesa_HashDeleteAll(shared->Programs, delete_program_cb, ctx); _mesa_DeleteHashTable(shared->Programs); - _mesa_HashDeleteAll(shared->ArrayObjects, delete_arrayobj_cb, ctx); - _mesa_DeleteHashTable(shared->ArrayObjects); - #if FEATURE_ARB_vertex_program _mesa_reference_vertprog(ctx, &shared->DefaultVertexProgram, NULL); #endif @@ -350,7 +333,7 @@ _mesa_free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) #endif #if FEATURE_ARB_vertex_buffer_object - _mesa_delete_buffer_object(ctx, shared->NullBufferObj); + ctx->Driver.DeleteBuffer(ctx, shared->NullBufferObj); #endif /* diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 7b41b8f4da4..9ba131bee50 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -75,6 +75,16 @@ compute_max_element(struct gl_client_array *array) { assert(array->Enabled); if (array->BufferObj->Name) { + GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr; + GLsizeiptrARB obj_size = (GLsizeiptrARB) array->BufferObj->Size; + + if (offset < obj_size) { + array->_MaxElement = (obj_size - offset + + array->StrideB - + array->_ElementSize) / array->StrideB; + } else { + array->_MaxElement = 0; + } /* Compute the max element we can access in the VBO without going * out of bounds. */ @@ -537,7 +547,7 @@ _mesa_update_state_locked( GLcontext *ctx ) /* Determine which state flags effect vertex/fragment program state */ if (ctx->FragmentProgram._MaintainTexEnvProgram) { prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR | - _NEW_ARRAY); + _NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE); } if (ctx->VertexProgram._MaintainTnlProgram) { prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 4d511f2f7ed..4c04a7ed375 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -959,7 +959,7 @@ void GLAPIENTRY _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param ) { const struct gl_texture_unit *texUnit; - GLint i; + GLuint i; GLint temp = 0; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -1006,7 +1006,7 @@ void GLAPIENTRY _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param ) { const struct gl_texture_unit *texUnit; - GLint i; + GLuint i; GLint temp = 0; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index a70d069bd9c..a3f1246c985 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -261,6 +261,7 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) */ static GLbitfield get_fp_input_mask( GLcontext *ctx ) { + /* _NEW_PROGRAM */ const GLboolean vertexShader = (ctx->Shader.CurrentProgram && ctx->Shader.CurrentProgram->VertexProgram); const GLboolean vertexProgram = ctx->VertexProgram._Enabled; @@ -274,22 +275,26 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) fp_inputs = ~0; } else if (ctx->RenderMode == GL_FEEDBACK) { + /* _NEW_RENDERMODE */ fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0); } else if (!(vertexProgram || vertexShader) || !ctx->VertexProgram._Current) { /* Fixed function vertex logic */ + /* _NEW_ARRAY */ GLbitfield varying_inputs = ctx->varying_vp_inputs; /* These get generated in the setup routine regardless of the * vertex program: */ + /* _NEW_POINT */ if (ctx->Point.PointSprite) varying_inputs |= FRAG_BITS_TEX_ANY; /* First look at what values may be computed by the generated * vertex program: */ + /* _NEW_LIGHT */ if (ctx->Light.Enabled) { fp_inputs |= FRAG_BIT_COL0; @@ -297,6 +302,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) fp_inputs |= FRAG_BIT_COL1; } + /* _NEW_TEXTURE */ fp_inputs |= (ctx->Texture._TexGenEnabled | ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0; @@ -329,6 +335,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) /* These get generated in the setup routine regardless of the * vertex program: */ + /* _NEW_POINT */ if (ctx->Point.PointSprite) vp_outputs |= FRAG_BITS_TEX_ANY; @@ -355,6 +362,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) memset(key, 0, sizeof(*key)); + /* _NEW_TEXTURE */ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; GLenum format; @@ -408,11 +416,13 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) } } + /* _DD_NEW_SEPARATE_SPECULAR */ if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { key->separate_specular = 1; inputs_referenced |= FRAG_BIT_COL1; } + /* _NEW_FOG */ if (ctx->Fog.Enabled) { key->fog_enabled = 1; key->fog_mode = translate_fog_mode(ctx->Fog.Mode); @@ -877,6 +887,7 @@ static struct ureg get_source( struct texenv_fragment_program *p, default: assert(0); + return undef; } } diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index f3b2fb9c9c4..eb160deff93 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1347,13 +1347,13 @@ static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage, const GLubyte cb = *src0 & 0xff; /* chroma U */ const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ const GLubyte cr = *src1 & 0xff; /* chroma V */ - const GLfloat y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ - GLfloat r = 1.164 * (y - 16) + 1.596 * (cr - 128); - GLfloat g = 1.164 * (y - 16) - 0.813 * (cr - 128) - 0.391 * (cb - 128); - GLfloat b = 1.164 * (y - 16) + 2.018 * (cb - 128); - r *= (1.0 / 255.0F); - g *= (1.0 / 255.0F); - b *= (1.0 / 255.0F); + const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); + GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); + GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); + r *= (1.0F / 255.0F); + g *= (1.0F / 255.0F); + b *= (1.0F / 255.0F); texel[RCOMP] = CLAMP(r, 0.0F, 1.0F); texel[GCOMP] = CLAMP(g, 0.0F, 1.0F); texel[BCOMP] = CLAMP(b, 0.0F, 1.0F); @@ -1388,13 +1388,13 @@ static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage, const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */ const GLubyte y1 = *src1 & 0xff; /* luminance */ const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */ - const GLfloat y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ - GLfloat r = 1.164 * (y - 16) + 1.596 * (cr - 128); - GLfloat g = 1.164 * (y - 16) - 0.813 * (cr - 128) - 0.391 * (cb - 128); - GLfloat b = 1.164 * (y - 16) + 2.018 * (cb - 128); - r *= (1.0 / 255.0F); - g *= (1.0 / 255.0F); - b *= (1.0 / 255.0F); + const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); + GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); + GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); + r *= (1.0F / 255.0F); + g *= (1.0F / 255.0F); + b *= (1.0F / 255.0F); texel[RCOMP] = CLAMP(r, 0.0F, 1.0F); texel[GCOMP] = CLAMP(g, 0.0F, 1.0F); texel[BCOMP] = CLAMP(b, 0.0F, 1.0F); diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 70a25080cb0..02409d80098 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -73,11 +73,11 @@ linear_to_nonlinear(GLfloat cl) { /* can't have values outside [0, 1] */ GLfloat cs; - if (cl < 0.0031308) { - cs = 12.92 * cl; + if (cl < 0.0031308f) { + cs = 12.92f * cl; } else { - cs = 1.055 * _mesa_pow(cl, 0.41666) - 0.055; + cs = (GLfloat)(1.055 * _mesa_pow(cl, 0.41666) - 0.055); } return cs; } diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 76b46d700b5..6e21066537b 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1250,6 +1250,8 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, * We allocate the array for 1D/2D textures too in order to avoid special- * case code in the texstore routines. */ + if (img->ImageOffsets) + _mesa_free(img->ImageOffsets); img->ImageOffsets = (GLuint *) _mesa_malloc(depth * sizeof(GLuint)); for (i = 0; i < depth; i++) { img->ImageOffsets[i] = i * width * height; diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 2195a334d3e..d27c59381c5 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -882,7 +882,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, "glGetTexLevelParameter[if]v(pname)"); break; case GL_TEXTURE_STENCIL_SIZE_EXT: - if (ctx->Extensions.EXT_packed_depth_stencil) { + if (ctx->Extensions.EXT_packed_depth_stencil || + ctx->Extensions.ARB_framebuffer_object) { *params = img->TexFormat->StencilBits; } else { diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index f04c137c6d3..3d5b8faecff 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -30,6 +30,7 @@ #include "context.h" #include "enable.h" #include "enums.h" +#include "hash.h" #include "mtypes.h" #include "varray.h" #include "arrayobj.h" @@ -38,6 +39,8 @@ /** * Set the fields of a vertex array. + * Also do an error check for GL_ARB_vertex_array_object: check that + * all arrays reside in VBOs when using a vertex array object. * * \param array the array to update * \param dirtyBit which bit to set in ctx->Array.NewState for this array @@ -48,14 +51,26 @@ * \param stride stride between elements, in elements * \param normalized are integer types converted to floats in [-1, 1]? * \param ptr the address (or offset inside VBO) of the array data + * \return GL_TRUE if no error, GL_FALSE if error */ -static void +static GLboolean update_array(GLcontext *ctx, struct gl_client_array *array, GLbitfield dirtyBit, GLsizei elementSize, GLint size, GLenum type, GLenum format, GLsizei stride, GLboolean normalized, const GLvoid *ptr) { ASSERT(format == GL_RGBA || format == GL_BGRA); + + if (ctx->Array.ArrayObj->VBOonly && + ctx->Array.ArrayBufferObj->Name == 0) { + /* GL_ARB_vertex_array_object requires that all arrays reside in VBOs. + * Generate GL_INVALID_OPERATION if that's not true. + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glVertex/Normal/EtcPointer(non-VBO array)"); + return GL_FALSE; + } + array->Size = size; array->Type = type; array->Format = format; @@ -70,6 +85,8 @@ update_array(GLcontext *ctx, struct gl_client_array *array, ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= dirtyBit; + + return GL_TRUE; } @@ -122,8 +139,9 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX, - elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX, + elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr)) + return; if (ctx->Driver.VertexPointer) ctx->Driver.VertexPointer( ctx, size, type, stride, ptr ); @@ -172,8 +190,9 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) return; } - update_array(ctx, &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL, - elementSize, 3, type, GL_RGBA, stride, GL_TRUE, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL, + elementSize, 3, type, GL_RGBA, stride, GL_TRUE, ptr)) + return; if (ctx->Driver.NormalPointer) ctx->Driver.NormalPointer( ctx, type, stride, ptr ); @@ -250,8 +269,9 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0, - elementSize, size, type, format, stride, GL_TRUE, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0, + elementSize, size, type, format, stride, GL_TRUE, ptr)) + return; if (ctx->Driver.ColorPointer) ctx->Driver.ColorPointer( ctx, size, type, stride, ptr ); @@ -282,8 +302,9 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD, - elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD, + elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr)) + return; if (ctx->Driver.FogCoordPointer) ctx->Driver.FogCoordPointer( ctx, type, stride, ptr ); @@ -323,8 +344,9 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX, - elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX, + elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr)) + return; if (ctx->Driver.IndexPointer) ctx->Driver.IndexPointer( ctx, type, stride, ptr ); @@ -397,8 +419,10 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, return; } - update_array(ctx, &ctx->Array.ArrayObj->SecondaryColor, _NEW_ARRAY_COLOR1, - elementSize, size, type, format, stride, GL_TRUE, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->SecondaryColor, + _NEW_ARRAY_COLOR1, elementSize, size, type, + format, stride, GL_TRUE, ptr)) + return; if (ctx->Driver.SecondaryColorPointer) ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr ); @@ -456,9 +480,10 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, return; } - update_array(ctx, &ctx->Array.ArrayObj->TexCoord[unit], - _NEW_ARRAY_TEXCOORD(unit), - elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->TexCoord[unit], + _NEW_ARRAY_TEXCOORD(unit), + elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr)) + return; if (ctx->Driver.TexCoordPointer) ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr ); @@ -476,9 +501,10 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG, - sizeof(GLboolean), 1, GL_UNSIGNED_BYTE, GL_RGBA, - stride, GL_FALSE, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG, + sizeof(GLboolean), 1, GL_UNSIGNED_BYTE, GL_RGBA, + stride, GL_FALSE, ptr)) + return; if (ctx->Driver.EdgeFlagPointer) ctx->Driver.EdgeFlagPointer( ctx, stride, ptr ); @@ -588,9 +614,10 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, return; } - update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], - _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, format, stride, normalized, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], + _NEW_ARRAY_ATTRIB(index), + elementSize, size, type, format, stride, normalized, ptr)) + return; if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); @@ -687,9 +714,10 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, return; } - update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], - _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, format, stride, normalized, ptr); + if (!update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], + _NEW_ARRAY_ATTRIB(index), + elementSize, size, type, format, stride, normalized, ptr)) + return; if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer(ctx, index, size, type, stride, ptr); @@ -1120,4 +1148,29 @@ _mesa_init_varray(GLcontext *ctx) _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, ctx->Array.DefaultArrayObj); ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ + + ctx->Array.Objects = _mesa_NewHashTable(); +} + + +/** + * Callback for deleting an array object. Called by _mesa_HashDeleteAll(). + */ +static void +delete_arrayobj_cb(GLuint id, void *data, void *userData) +{ + struct gl_array_object *arrayObj = (struct gl_array_object *) data; + GLcontext *ctx = (GLcontext *) userData; + _mesa_delete_array_object(ctx, arrayObj); +} + + +/** + * Free vertex array state for given context. + */ +void +_mesa_free_varray_data(GLcontext *ctx) +{ + _mesa_HashDeleteAll(ctx->Array.Objects, delete_arrayobj_cb, ctx); + _mesa_DeleteHashTable(ctx->Array.Objects); } diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 46cc3ee3425..d4d505ae049 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -166,10 +166,14 @@ _mesa_print_arrays(GLcontext *ctx); extern void _mesa_init_varray( GLcontext * ctx ); +extern void +_mesa_free_varray_data(GLcontext *ctx); + #else /** No-op */ #define _mesa_init_varray( c ) ((void)0) +#define _mesa_free_varray_data( c ) ((void)0) #endif diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index ead856d32c3..50e0402d278 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -73,8 +73,8 @@ _mesa_set_viewport(GLcontext *ctx, GLint x, GLint y, } /* clamp width and height to the implementation dependent range */ - width = CLAMP(width, 1, (GLsizei) ctx->Const.MaxViewportWidth); - height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight); + width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth); + height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight); ctx->Viewport.X = x; ctx->Viewport.Width = width; diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 7e166830fd5..bc65aba39a1 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -3973,6 +3973,13 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, if (program->FogOption) program->Base.InputsRead |= FRAG_BIT_FOGC; + + /* XXX: assume that ARB fragment programs don't have access to the + * FrontFacing and PointCoord values stuffed into the fog + * coordinate in GLSL shaders. + */ + if (program->Base.InputsRead & FRAG_BIT_FOGC) + program->UsesFogFragCoord = GL_TRUE; if (program->Base.Instructions) _mesa_free(program->Base.Instructions); diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index d270bf9e1c3..4623ff60de6 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -820,3 +820,63 @@ _mesa_find_free_register(const struct gl_program *prog, GLuint regFile) return -1; } + + + +/** + * "Post-process" a GPU program. This is intended to be used for debugging. + * Example actions include no-op'ing instructions or changing instruction + * behaviour. + */ +void +_mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog) +{ + static const GLfloat white[4] = { 0.5, 0.5, 0.5, 0.5 }; + GLuint i; + GLuint whiteSwizzle; + GLint whiteIndex = _mesa_add_unnamed_constant(prog->Parameters, + white, 4, &whiteSwizzle); + + (void) whiteIndex; + + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + const GLuint n = _mesa_num_inst_src_regs(inst->Opcode); + + (void) n; + + if (_mesa_is_tex_instruction(inst->Opcode)) { +#if 0 + /* replace TEX/TXP/TXB with MOV */ + inst->Opcode = OPCODE_MOV; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->SrcReg[0].Swizzle = SWIZZLE_XYZW; + inst->SrcReg[0].Negate = NEGATE_NONE; +#endif + +#if 0 + /* disable shadow texture mode */ + inst->TexShadow = 0; +#endif + } + + if (inst->Opcode == OPCODE_TXP) { +#if 0 + inst->Opcode = OPCODE_MOV; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->SrcReg[0].File = PROGRAM_CONSTANT; + inst->SrcReg[0].Index = whiteIndex; + inst->SrcReg[0].Swizzle = SWIZZLE_XYZW; + inst->SrcReg[0].Negate = NEGATE_NONE; +#endif +#if 0 + inst->TexShadow = 0; +#endif +#if 0 + inst->Opcode = OPCODE_TEX; + inst->TexShadow = 0; +#endif + } + + } +} diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h index 48176162c35..56a4191f578 100644 --- a/src/mesa/shader/program.h +++ b/src/mesa/shader/program.h @@ -122,6 +122,8 @@ _mesa_combine_programs(GLcontext *ctx, extern GLint _mesa_find_free_register(const struct gl_program *prog, GLuint regFile); +extern void +_mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog); #endif /* PROGRAM_H */ diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index f70c75cec8e..ac5fe0f691f 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -396,6 +396,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) fprog->Base.Instructions = newInst; fprog->Base.NumInstructions = inst - newInst; fprog->Base.InputsRead |= FRAG_BIT_FOGC; + fprog->UsesFogFragCoord = GL_TRUE; /* XXX do this? fprog->FogOption = GL_NONE; */ } diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index a8390d30942..648fbc186bb 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -402,6 +402,7 @@ _mesa_init_shader_state(GLcontext * ctx) * are generated by the GLSL compiler. */ ctx->Shader.EmitHighLevelInstructions = GL_TRUE; + ctx->Shader.EmitContReturn = GL_TRUE; ctx->Shader.EmitCondCodes = GL_FALSE; ctx->Shader.EmitComments = GL_FALSE; ctx->Shader.Flags = get_shader_flags(); diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c index 83e76b77db3..289d94644f0 100644 --- a/src/mesa/shader/slang/slang_builtin.c +++ b/src/mesa/shader/slang/slang_builtin.c @@ -85,7 +85,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field, { "gl_TextureMatrixTranspose", STATE_TEXTURE_MATRIX, 0 }, { "gl_TextureMatrixInverseTranspose", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE }, - { "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE }, + { "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, { NULL, 0, 0 } }; @@ -111,10 +111,9 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field, if (isMatrix) { if (tokens[0] == STATE_TEXTURE_MATRIX) { - if (index1 >= 0) { - tokens[1] = index1; /* which texture matrix */ - index1 = 0; /* prevent extra addition at end of function */ - } + /* texture_matrix[index1][index2] */ + tokens[1] = index1 >= 0 ? index1 : 0; /* which texture matrix */ + index1 = index2; /* move matrix row value to index1 */ } if (index1 < 0) { /* index1 is unused: prevent extra addition at end of function */ @@ -682,7 +681,9 @@ _slang_alloc_statevar(slang_ir_node *n, if (n->Opcode == IR_ELEMENT) { /* XXX can only handle constant indexes for now */ if (n->Children[1]->Opcode == IR_FLOAT) { - index2 = (GLint) n->Children[1]->Value[0]; + /* two-dimensional array index: mat[i][j] */ + index2 = index1; + index1 = (GLint) n->Children[1]->Value[0]; } else { *direct = GL_FALSE; diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 6d693c9027a..2b7e781f984 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -75,6 +75,11 @@ const GLuint MAX_FOR_LOOP_UNROLL_COMPLEXITY = 256; static slang_ir_node * _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper); +static void +slang_substitute(slang_assemble_ctx *A, slang_operation *oper, + GLuint substCount, slang_variable **substOld, + slang_operation **substNew, GLboolean isLHS); + /** * Retrieves type information about an operation. @@ -326,6 +331,17 @@ sampler_to_texture_index(const slang_type_specifier_type type) } +/** helper to build a SLANG_OPER_IDENTIFIER node */ +static void +slang_operation_identifier(slang_operation *oper, + slang_assemble_ctx *A, + const char *name) +{ + oper->type = SLANG_OPER_IDENTIFIER; + oper->a_id = slang_atom_pool_atom(A->atoms, name); +} + + #define SWIZZLE_ZWWW MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W) /** @@ -429,6 +445,56 @@ _slang_output_index(const char *name, GLenum target) } +/** + * Called when we begin code/IR generation for a new while/do/for loop. + */ +static void +push_loop(slang_assemble_ctx *A, slang_operation *loopOper, slang_ir_node *loopIR) +{ + A->LoopOperStack[A->LoopDepth] = loopOper; + A->LoopIRStack[A->LoopDepth] = loopIR; + A->LoopDepth++; +} + + +/** + * Called when we end code/IR generation for a new while/do/for loop. + */ +static void +pop_loop(slang_assemble_ctx *A) +{ + assert(A->LoopDepth > 0); + A->LoopDepth--; +} + + +/** + * Return pointer to slang_operation for the loop we're currently inside, + * or NULL if not in a loop. + */ +static const slang_operation * +current_loop_oper(const slang_assemble_ctx *A) +{ + if (A->LoopDepth > 0) + return A->LoopOperStack[A->LoopDepth - 1]; + else + return NULL; +} + + +/** + * Return pointer to slang_ir_node for the loop we're currently inside, + * or NULL if not in a loop. + */ +static slang_ir_node * +current_loop_ir(const slang_assemble_ctx *A) +{ + if (A->LoopDepth > 0) + return A->LoopIRStack[A->LoopDepth - 1]; + else + return NULL; +} + /**********************************************************************/ @@ -636,7 +702,7 @@ new_break(slang_ir_node *loopNode) assert(loopNode); assert(loopNode->Opcode == IR_LOOP); if (n) { - /* insert this node at head of linked list */ + /* insert this node at head of linked list of cont/break instructions */ n->List = loopNode->List; loopNode->List = n; } @@ -648,14 +714,15 @@ new_break(slang_ir_node *loopNode) * Make new IR_BREAK_IF_TRUE. */ static slang_ir_node * -new_break_if_true(slang_ir_node *loopNode, slang_ir_node *cond) +new_break_if_true(slang_assemble_ctx *A, slang_ir_node *cond) { + slang_ir_node *loopNode = current_loop_ir(A); slang_ir_node *n; assert(loopNode); assert(loopNode->Opcode == IR_LOOP); n = new_node1(IR_BREAK_IF_TRUE, cond); if (n) { - /* insert this node at head of linked list */ + /* insert this node at head of linked list of cont/break instructions */ n->List = loopNode->List; loopNode->List = n; } @@ -667,14 +734,16 @@ new_break_if_true(slang_ir_node *loopNode, slang_ir_node *cond) * Make new IR_CONT_IF_TRUE node. */ static slang_ir_node * -new_cont_if_true(slang_ir_node *loopNode, slang_ir_node *cond) +new_cont_if_true(slang_assemble_ctx *A, slang_ir_node *cond) { + slang_ir_node *loopNode = current_loop_ir(A); slang_ir_node *n; assert(loopNode); assert(loopNode->Opcode == IR_LOOP); n = new_node1(IR_CONT_IF_TRUE, cond); if (n) { - /* insert this node at head of linked list */ + n->Parent = loopNode; /* pointer to containing loop */ + /* insert this node at head of linked list of cont/break instructions */ n->List = loopNode->List; loopNode->List = n; } @@ -749,6 +818,7 @@ _slang_is_noop(const slang_operation *oper) /** * Recursively search tree for a node of the given type. */ +#if 0 static slang_operation * _slang_find_node_type(slang_operation *oper, slang_operation_type type) { @@ -762,13 +832,14 @@ _slang_find_node_type(slang_operation *oper, slang_operation_type type) } return NULL; } +#endif /** * Count the number of operations of the given time rooted at 'oper'. */ static GLuint -_slang_count_node_type(slang_operation *oper, slang_operation_type type) +_slang_count_node_type(const slang_operation *oper, slang_operation_type type) { GLuint i, count = 0; if (oper->type == type) { @@ -822,6 +893,37 @@ _slang_is_tail_return(const slang_operation *oper) } +/** + * Generate a variable declaration opeartion. + * I.e.: generate AST code for "bool flag = false;" + */ +static void +slang_generate_declaration(slang_assemble_ctx *A, + slang_variable_scope *scope, + slang_operation *decl, + slang_type_specifier_type type, + const char *name, + GLint initValue) +{ + slang_variable *var; + + assert(type == SLANG_SPEC_BOOL || + type == SLANG_SPEC_INT); + + decl->type = SLANG_OPER_VARIABLE_DECL; + + var = slang_variable_scope_grow(scope); + + slang_fully_specified_type_construct(&var->type); + + var->type.specifier.type = type; + var->a_name = slang_atom_pool_atom(A->atoms, name); + decl->a_id = var->a_name; + var->initializer = slang_operation_new(1); + slang_operation_literal_bool(var->initializer, initValue); +} + + static void slang_resolve_variable(slang_operation *oper) { @@ -832,6 +934,159 @@ slang_resolve_variable(slang_operation *oper) /** + * Rewrite AST code for "return expression;". + * + * We return values from functions by assinging the returned value to + * the hidden __retVal variable which is an extra 'out' parameter we add + * to the function signature. + * This code basically converts "return expr;" into "__retVal = expr; return;" + * + * \return the new AST code. + */ +static slang_operation * +gen_return_with_expression(slang_assemble_ctx *A, slang_operation *oper) +{ + slang_operation *blockOper, *assignOper; + + assert(oper->type == SLANG_OPER_RETURN); + + if (A->CurFunction->header.type.specifier.type == SLANG_SPEC_VOID) { + slang_info_log_error(A->log, "illegal return expression"); + return NULL; + } + + blockOper = slang_operation_new(1); + blockOper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; + blockOper->locals->outer_scope = oper->locals->outer_scope; + slang_operation_add_children(blockOper, 2); + + if (A->UseReturnFlag) { + /* Emit: + * { + * if (__notRetFlag) + * __retVal = expr; + * __notRetFlag = 0; + * } + */ + { + slang_operation *ifOper = slang_oper_child(blockOper, 0); + ifOper->type = SLANG_OPER_IF; + slang_operation_add_children(ifOper, 3); + { + slang_operation *cond = slang_oper_child(ifOper, 0); + cond->type = SLANG_OPER_IDENTIFIER; + cond->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); + } + { + slang_operation *elseOper = slang_oper_child(ifOper, 2); + elseOper->type = SLANG_OPER_VOID; + } + assignOper = slang_oper_child(ifOper, 1); + } + { + slang_operation *setOper = slang_oper_child(blockOper, 1); + setOper->type = SLANG_OPER_ASSIGN; + slang_operation_add_children(setOper, 2); + { + slang_operation *lhs = slang_oper_child(setOper, 0); + lhs->type = SLANG_OPER_IDENTIFIER; + lhs->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); + } + { + slang_operation *rhs = slang_oper_child(setOper, 1); + slang_operation_literal_bool(rhs, GL_FALSE); + } + } + } + else { + /* Emit: + * { + * __retVal = expr; + * return_inlined; + * } + */ + assignOper = slang_oper_child(blockOper, 0); + { + slang_operation *returnOper = slang_oper_child(blockOper, 1); + returnOper->type = SLANG_OPER_RETURN_INLINED; + assert(returnOper->num_children == 0); + } + } + + /* __retVal = expression; */ + assignOper->type = SLANG_OPER_ASSIGN; + slang_operation_add_children(assignOper, 2); + { + slang_operation *lhs = slang_oper_child(assignOper, 0); + lhs->type = SLANG_OPER_IDENTIFIER; + lhs->a_id = slang_atom_pool_atom(A->atoms, "__retVal"); + } + { + slang_operation *rhs = slang_oper_child(assignOper, 1); + slang_operation_copy(rhs, &oper->children[0]); + } + + ///blockOper->locals->outer_scope = oper->locals->outer_scope; + + /*slang_print_tree(blockOper, 0);*/ + + return blockOper; +} + + +/** + * Rewrite AST code for "return;" (no expression). + */ +static slang_operation * +gen_return_without_expression(slang_assemble_ctx *A, slang_operation *oper) +{ + slang_operation *newRet; + + assert(oper->type == SLANG_OPER_RETURN); + + if (A->CurFunction->header.type.specifier.type != SLANG_SPEC_VOID) { + slang_info_log_error(A->log, "return statement requires an expression"); + return NULL; + } + + if (A->UseReturnFlag) { + /* Emit: + * __notRetFlag = 0; + */ + { + newRet = slang_operation_new(1); + newRet->locals->outer_scope = oper->locals->outer_scope; + newRet->type = SLANG_OPER_ASSIGN; + slang_operation_add_children(newRet, 2); + { + slang_operation *lhs = slang_oper_child(newRet, 0); + lhs->type = SLANG_OPER_IDENTIFIER; + lhs->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); + } + { + slang_operation *rhs = slang_oper_child(newRet, 1); + slang_operation_literal_bool(rhs, GL_FALSE); + } + } + } + else { + /* Emit: + * return_inlined; + */ + newRet = slang_operation_new(1); + newRet->locals->outer_scope = oper->locals->outer_scope; + newRet->type = SLANG_OPER_RETURN_INLINED; + } + + /*slang_print_tree(newRet, 0);*/ + + return newRet; +} + + + + +/** * Replace particular variables (SLANG_OPER_IDENTIFIER) with new expressions. */ static void @@ -866,7 +1121,8 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper, GLuint i; v = _slang_variable_locate(oper->locals, id, GL_TRUE); if (!v) { - _mesa_problem(NULL, "var %s not found!\n", (char *) oper->a_id); + if (_mesa_strcmp((char *) oper->a_id, "__notRetFlag")) + _mesa_problem(NULL, "var %s not found!\n", (char *) oper->a_id); return; } @@ -896,62 +1152,24 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper, break; case SLANG_OPER_RETURN: - /* do return replacement here too */ - assert(oper->num_children == 0 || oper->num_children == 1); - if (oper->num_children == 1 && !_slang_is_noop(&oper->children[0])) { - /* replace: - * return expr; - * with: - * __retVal = expr; - * return; - * then do substitutions on the assignment. - */ - slang_operation *blockOper, *assignOper, *returnOper; + { + slang_operation *newReturn; + /* generate new 'return' code' */ + if (slang_oper_child(oper, 0)->type == SLANG_OPER_VOID) + newReturn = gen_return_without_expression(A, oper); + else + newReturn = gen_return_with_expression(A, oper); - /* check if function actually has a return type */ - assert(A->CurFunction); - if (A->CurFunction->header.type.specifier.type == SLANG_SPEC_VOID) { - slang_info_log_error(A->log, "illegal return expression"); + if (!newReturn) return; - } - - blockOper = slang_operation_new(1); - blockOper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; - blockOper->num_children = 2; - blockOper->locals->outer_scope = oper->locals->outer_scope; - blockOper->children = slang_operation_new(2); - assignOper = blockOper->children + 0; - returnOper = blockOper->children + 1; - - assignOper->type = SLANG_OPER_ASSIGN; - assignOper->num_children = 2; - assignOper->locals->outer_scope = blockOper->locals; - assignOper->children = slang_operation_new(2); - assignOper->children[0].type = SLANG_OPER_IDENTIFIER; - assignOper->children[0].a_id = slang_atom_pool_atom(A->atoms, "__retVal"); - assignOper->children[0].locals->outer_scope = assignOper->locals; - - slang_operation_copy(&assignOper->children[1], - &oper->children[0]); - - returnOper->type = SLANG_OPER_RETURN; /* return w/ no value */ - assert(returnOper->num_children == 0); - /* do substitutions on the "__retVal = expr" sub-tree */ - slang_substitute(A, assignOper, + /* do substitutions on the new 'return' code */ + slang_substitute(A, newReturn, substCount, substOld, substNew, GL_FALSE); - /* install new code */ - slang_operation_copy(oper, blockOper); - slang_operation_destruct(blockOper); - } - else { - /* check if return value was expected */ - assert(A->CurFunction); - if (A->CurFunction->header.type.specifier.type != SLANG_SPEC_VOID) { - slang_info_log_error(A->log, "return statement requires an expression"); - return; - } + /* install new 'return' code */ + slang_operation_copy(oper, newReturn); + slang_operation_destruct(newReturn); } break; @@ -1199,8 +1417,9 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun, } else if (p->type.qualifier == SLANG_QUAL_CONST) { /* a constant input param */ - if (args[i].type == SLANG_OPER_IDENTIFIER || - args[i].type == SLANG_OPER_LITERAL_FLOAT) { + if (args[i].type == SLANG_OPER_IDENTIFIER || + args[i].type == SLANG_OPER_LITERAL_FLOAT || + args[i].type == SLANG_OPER_SUBSCRIPT) { /* replace all occurances of this parameter variable with the * actual argument variable or a literal. */ @@ -1346,12 +1565,74 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun, } +/** + * Insert declaration for "bool __notRetFlag" in given block operation. + * This is used when we can't emit "early" return statements in subroutines. + */ +static void +declare_return_flag(slang_assemble_ctx *A, slang_operation *oper) +{ + slang_operation *decl; + + assert(oper->type == SLANG_OPER_BLOCK_NEW_SCOPE || + oper->type == SLANG_OPER_SEQUENCE); + + decl = slang_operation_insert_child(oper, 1); + + slang_generate_declaration(A, oper->locals, decl, + SLANG_SPEC_BOOL, "__notRetFlag", GL_TRUE); + + /*slang_print_tree(oper, 0);*/ +} + + +/** + * Recursively replace instances of the old node type with the new type. + */ +static void +replace_node_type(slang_operation *oper, slang_operation_type oldType, + slang_operation_type newType) +{ + GLuint i; + + if (oper->type == oldType) + oper->type = newType; + + for (i = 0; i < slang_oper_num_children(oper); i++) { + replace_node_type(slang_oper_child(oper, i), oldType, newType); + } +} + + + +/** + * Test if the given function body has an "early return". That is, there's + * a 'return' statement that's not the very last instruction in the body. + */ +static GLboolean +has_early_return(const slang_operation *funcBody) +{ + GLuint retCount = _slang_count_node_type(funcBody, SLANG_OPER_RETURN); + if (retCount == 0) + return GL_FALSE; + else if (retCount == 1 && _slang_is_tail_return(funcBody)) + return GL_FALSE; + else + return GL_TRUE; +} + + +/** + * Emit IR code for a function call. This does one of two things: + * 1. Inline the function's code + * 2. Create an IR for the function's body and create a real call to it. + */ static slang_ir_node * _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun, slang_operation *oper, slang_operation *dest) { slang_ir_node *n; - slang_operation *inlined; + slang_operation *instance; slang_label *prevFuncEndLabel; char name[200]; @@ -1360,9 +1641,14 @@ _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun, A->curFuncEndLabel = _slang_label_new(name); assert(A->curFuncEndLabel); + /* + * 'instance' is basically a copy of the function's body with various + * transformations. + */ + if (slang_is_asm_function(fun) && !dest) { /* assemble assembly function - tree style */ - inlined = slang_inline_asm_function(A, fun, oper); + instance = slang_inline_asm_function(A, fun, oper); } else { /* non-assembly function */ @@ -1371,65 +1657,82 @@ _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun, * 1. insert the inline code * 2. Generate a call to the "inline" code as a subroutine */ + const GLboolean earlyReturn = has_early_return(fun->body); + if (earlyReturn && !A->EmitContReturn) { + A->UseReturnFlag = GL_TRUE; + } - slang_operation *ret = NULL; - - inlined = slang_inline_function_call(A, fun, oper, dest); - if (!inlined) + instance = slang_inline_function_call(A, fun, oper, dest); + if (!instance) return NULL; - ret = _slang_find_node_type(inlined, SLANG_OPER_RETURN); - if (ret) { - /* check if this is a "tail" return */ - if (_slang_count_node_type(inlined, SLANG_OPER_RETURN) == 1 && - _slang_is_tail_return(inlined)) { - /* The only RETURN is the last stmt in the function, no-op it - * and inline the function body. + if (earlyReturn) { + /* The function we're calling has one or more 'return' statements + * that prevent us from inlining the function's code. + * + * In this case, change the function's body type from + * SLANG_OPER_BLOCK_NEW_SCOPE to SLANG_OPER_NON_INLINED_CALL. + * During code emit this will result in a true subroutine call. + * + * Also, convert SLANG_OPER_RETURN_INLINED nodes to SLANG_OPER_RETURN. + */ + slang_operation *callOper; + + assert(instance->type == SLANG_OPER_BLOCK_NEW_SCOPE || + instance->type == SLANG_OPER_SEQUENCE); + + if (_slang_function_has_return_value(fun) && !dest) { + assert(instance->children[0].type == SLANG_OPER_VARIABLE_DECL); + assert(instance->children[2].type == SLANG_OPER_IDENTIFIER); + callOper = &instance->children[1]; + } + else { + callOper = instance; + } + + if (A->UseReturnFlag) { + /* Early returns not supported. Create a _returnFlag variable + * that's set upon 'return' and tested elsewhere to no-op any + * remaining instructions in the subroutine. */ - ret->type = SLANG_OPER_NONE; + assert(callOper->type == SLANG_OPER_BLOCK_NEW_SCOPE || + callOper->type == SLANG_OPER_SEQUENCE); + declare_return_flag(A, callOper); } else { - slang_operation *callOper; - /* The function we're calling has one or more 'return' statements. - * So, we can't truly inline this function because we need to - * implement 'return' with RET (and CAL). - * Nevertheless, we performed "inlining" to make a new instance - * of the function body to deal with static register allocation. - * - * XXX check if there's one 'return' and if it's the very last - * statement in the function - we can optimize that case. + /* We can emit real 'return' statements. If we generated any + * 'inline return' statements during function instantiation, + * change them back to regular 'return' statements. */ - assert(inlined->type == SLANG_OPER_BLOCK_NEW_SCOPE || - inlined->type == SLANG_OPER_SEQUENCE); - - if (_slang_function_has_return_value(fun) && !dest) { - assert(inlined->children[0].type == SLANG_OPER_VARIABLE_DECL); - assert(inlined->children[2].type == SLANG_OPER_IDENTIFIER); - callOper = &inlined->children[1]; - } - else { - callOper = inlined; - } - callOper->type = SLANG_OPER_NON_INLINED_CALL; - callOper->fun = fun; - callOper->label = _slang_label_new_unique((char*) fun->header.a_name); + replace_node_type(instance, SLANG_OPER_RETURN_INLINED, + SLANG_OPER_RETURN); } + + callOper->type = SLANG_OPER_NON_INLINED_CALL; + callOper->fun = fun; + callOper->label = _slang_label_new_unique((char*) fun->header.a_name); + } + else { + /* If there are any 'return' statements remaining, they're at the + * very end of the function and can effectively become no-ops. + */ + replace_node_type(instance, SLANG_OPER_RETURN_INLINED, + SLANG_OPER_VOID); } } - if (!inlined) + if (!instance) return NULL; - /* Replace the function call with the inlined block (or new CALL stmt) */ + /* Replace the function call with the instance block (or new CALL stmt) */ slang_operation_destruct(oper); - *oper = *inlined; - _slang_free(inlined); + *oper = *instance; + _slang_free(instance); #if 0 - assert(inlined->locals); - printf("*** Inlined code for call to %s:\n", - (char*) fun->header.a_name); + assert(instance->locals); + printf("*** Inlined code for call to %s:\n", (char*) fun->header.a_name); slang_print_tree(oper, 10); printf("\n"); #endif @@ -1445,6 +1748,8 @@ _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun, n->Comment = _slang_strdup(s); } + A->UseReturnFlag = GL_FALSE; + return n; } @@ -2337,19 +2642,252 @@ _slang_is_boolean(slang_assemble_ctx *A, slang_operation *oper) /** + * Check if a loop contains a 'continue' statement. + * Stop looking if we find a nested loop. + */ +static GLboolean +_slang_loop_contains_continue(const slang_operation *oper) +{ + switch (oper->type) { + case SLANG_OPER_CONTINUE: + return GL_TRUE; + case SLANG_OPER_FOR: + case SLANG_OPER_DO: + case SLANG_OPER_WHILE: + /* stop upon finding a nested loop */ + return GL_FALSE; + default: + /* recurse */ + { + GLuint i; + for (i = 0; i < oper->num_children; i++) { + const slang_operation *child = slang_oper_child_const(oper, i); + if (_slang_loop_contains_continue(child)) + return GL_TRUE; + } + } + return GL_FALSE; + } +} + + +/** + * Check if a loop contains a 'continue' or 'break' statement. + * Stop looking if we find a nested loop. + */ +static GLboolean +_slang_loop_contains_continue_or_break(const slang_operation *oper) +{ + switch (oper->type) { + case SLANG_OPER_CONTINUE: + case SLANG_OPER_BREAK: + return GL_TRUE; + case SLANG_OPER_FOR: + case SLANG_OPER_DO: + case SLANG_OPER_WHILE: + /* stop upon finding a nested loop */ + return GL_FALSE; + default: + /* recurse */ + { + GLuint i; + for (i = 0; i < oper->num_children; i++) { + const slang_operation *child = slang_oper_child_const(oper, i); + if (_slang_loop_contains_continue_or_break(child)) + return GL_TRUE; + } + } + return GL_FALSE; + } +} + + +/** + * Replace 'break' and 'continue' statements inside a do and while loops. + * This is a recursive helper function used by + * _slang_gen_do/while_without_continue(). + */ +static void +replace_break_and_cont(slang_assemble_ctx *A, slang_operation *oper) +{ + switch (oper->type) { + case SLANG_OPER_BREAK: + /* replace 'break' with "_notBreakFlag = false; break" */ + { + slang_operation *block = oper; + block->type = SLANG_OPER_BLOCK_NEW_SCOPE; + slang_operation_add_children(block, 2); + { + slang_operation *assign = slang_oper_child(block, 0); + assign->type = SLANG_OPER_ASSIGN; + slang_operation_add_children(assign, 2); + { + slang_operation *lhs = slang_oper_child(assign, 0); + slang_operation_identifier(lhs, A, "_notBreakFlag"); + } + { + slang_operation *rhs = slang_oper_child(assign, 1); + slang_operation_literal_bool(rhs, GL_FALSE); + } + } + { + slang_operation *brk = slang_oper_child(block, 1); + brk->type = SLANG_OPER_BREAK; + assert(!brk->children); + } + } + break; + case SLANG_OPER_CONTINUE: + /* convert continue into a break */ + oper->type = SLANG_OPER_BREAK; + break; + case SLANG_OPER_FOR: + case SLANG_OPER_DO: + case SLANG_OPER_WHILE: + /* stop upon finding a nested loop */ + break; + default: + /* recurse */ + { + GLuint i; + for (i = 0; i < oper->num_children; i++) { + replace_break_and_cont(A, slang_oper_child(oper, i)); + } + } + } +} + + +/** + * Transform a while-loop so that continue statements are converted to breaks. + * Then do normal IR code generation. + * + * Before: + * + * while (LOOPCOND) { + * A; + * if (IFCOND) + * continue; + * B; + * break; + * C; + * } + * + * After: + * + * { + * bool _notBreakFlag = 1; + * while (_notBreakFlag && LOOPCOND) { + * do { + * A; + * if (IFCOND) { + * break; // was continue + * } + * B; + * _notBreakFlag = 0; // was + * break; // break + * C; + * } while (0) + * } + * } + */ +static slang_ir_node * +_slang_gen_while_without_continue(slang_assemble_ctx *A, slang_operation *oper) +{ + slang_operation *top; + slang_operation *innerBody; + + assert(oper->type == SLANG_OPER_WHILE); + + top = slang_operation_new(1); + top->type = SLANG_OPER_BLOCK_NEW_SCOPE; + top->locals->outer_scope = oper->locals->outer_scope; + slang_operation_add_children(top, 2); + + /* declare: bool _notBreakFlag = true */ + { + slang_operation *condDecl = slang_oper_child(top, 0); + slang_generate_declaration(A, top->locals, condDecl, + SLANG_SPEC_BOOL, "_notBreakFlag", GL_TRUE); + } + + /* build outer while-loop: while (_notBreakFlag && LOOPCOND) { ... } */ + { + slang_operation *outerWhile = slang_oper_child(top, 1); + outerWhile->type = SLANG_OPER_WHILE; + slang_operation_add_children(outerWhile, 2); + + /* _notBreakFlag && LOOPCOND */ + { + slang_operation *cond = slang_oper_child(outerWhile, 0); + cond->type = SLANG_OPER_LOGICALAND; + slang_operation_add_children(cond, 2); + { + slang_operation *notBreak = slang_oper_child(cond, 0); + slang_operation_identifier(notBreak, A, "_notBreakFlag"); + } + { + slang_operation *origCond = slang_oper_child(cond, 1); + slang_operation_copy(origCond, slang_oper_child(oper, 0)); + } + } + + /* inner loop */ + { + slang_operation *innerDo = slang_oper_child(outerWhile, 1); + innerDo->type = SLANG_OPER_DO; + slang_operation_add_children(innerDo, 2); + + /* copy original do-loop body into inner do-loop's body */ + innerBody = slang_oper_child(innerDo, 0); + slang_operation_copy(innerBody, slang_oper_child(oper, 1)); + innerBody->locals->outer_scope = innerDo->locals; + + /* inner do-loop's condition is constant/false */ + { + slang_operation *constFalse = slang_oper_child(innerDo, 1); + slang_operation_literal_bool(constFalse, GL_FALSE); + } + } + } + + /* Finally, in innerBody, + * replace "break" with "_notBreakFlag = 0; break" + * replace "continue" with "break" + */ + replace_break_and_cont(A, innerBody); + + /*slang_print_tree(top, 0);*/ + + return _slang_gen_operation(A, top); + + return NULL; +} + + +/** * Generate loop code using high-level IR_LOOP instruction */ static slang_ir_node * -_slang_gen_while(slang_assemble_ctx * A, const slang_operation *oper) +_slang_gen_while(slang_assemble_ctx * A, slang_operation *oper) { /* * LOOP: * BREAK if !expr (child[0]) * body code (child[1]) */ - slang_ir_node *prevLoop, *loop, *breakIf, *body; + slang_ir_node *loop, *breakIf, *body; GLboolean isConst, constTrue; + if (!A->EmitContReturn) { + /* We don't want to emit CONT instructions. If this while-loop has + * a continue, translate it away. + */ + if (_slang_loop_contains_continue(slang_oper_child(oper, 1))) { + return _slang_gen_while_without_continue(A, oper); + } + } + /* type-check expression */ if (!_slang_is_boolean(A, &oper->children[0])) { slang_info_log_error(A->log, "scalar/boolean expression expected for 'while'"); @@ -2364,11 +2902,11 @@ _slang_gen_while(slang_assemble_ctx * A, const slang_operation *oper) return new_node0(IR_NOP); } + /* Begin new loop */ loop = new_loop(NULL); - /* save old, push new loop */ - prevLoop = A->CurLoop; - A->CurLoop = loop; + /* save loop state */ + push_loop(A, oper, loop); if (isConst && constTrue) { /* while(nonzero constant), no conditional break */ @@ -2377,7 +2915,7 @@ _slang_gen_while(slang_assemble_ctx * A, const slang_operation *oper) else { slang_ir_node *cond = new_cond(new_not(_slang_gen_operation(A, &oper->children[0]))); - breakIf = new_break_if_true(A->CurLoop, cond); + breakIf = new_break_if_true(A, cond); } body = _slang_gen_operation(A, &oper->children[1]); loop->Children[0] = new_seq(breakIf, body); @@ -2386,23 +2924,128 @@ _slang_gen_while(slang_assemble_ctx * A, const slang_operation *oper) /* loop->List is head of linked list of break/continue nodes */ if (!loop->List && isConst && constTrue) { /* infinite loop detected */ - A->CurLoop = prevLoop; /* clean-up */ + pop_loop(A); slang_info_log_error(A->log, "Infinite loop detected!"); return NULL; } - /* pop loop, restore prev */ - A->CurLoop = prevLoop; + /* restore loop state */ + pop_loop(A); return loop; } /** + * Transform a do-while-loop so that continue statements are converted to breaks. + * Then do normal IR code generation. + * + * Before: + * + * do { + * A; + * if (IFCOND) + * continue; + * B; + * break; + * C; + * } while (LOOPCOND); + * + * After: + * + * { + * bool _notBreakFlag = 1; + * do { + * do { + * A; + * if (IFCOND) { + * break; // was continue + * } + * B; + * _notBreakFlag = 0; // was + * break; // break + * C; + * } while (0) + * } while (_notBreakFlag && LOOPCOND); + * } + */ +static slang_ir_node * +_slang_gen_do_without_continue(slang_assemble_ctx *A, slang_operation *oper) +{ + slang_operation *top; + slang_operation *innerBody; + + assert(oper->type == SLANG_OPER_DO); + + top = slang_operation_new(1); + top->type = SLANG_OPER_BLOCK_NEW_SCOPE; + top->locals->outer_scope = oper->locals->outer_scope; + slang_operation_add_children(top, 2); + + /* declare: bool _notBreakFlag = true */ + { + slang_operation *condDecl = slang_oper_child(top, 0); + slang_generate_declaration(A, top->locals, condDecl, + SLANG_SPEC_BOOL, "_notBreakFlag", GL_TRUE); + } + + /* build outer do-loop: do { ... } while (_notBreakFlag && LOOPCOND) */ + { + slang_operation *outerDo = slang_oper_child(top, 1); + outerDo->type = SLANG_OPER_DO; + slang_operation_add_children(outerDo, 2); + + /* inner do-loop */ + { + slang_operation *innerDo = slang_oper_child(outerDo, 0); + innerDo->type = SLANG_OPER_DO; + slang_operation_add_children(innerDo, 2); + + /* copy original do-loop body into inner do-loop's body */ + innerBody = slang_oper_child(innerDo, 0); + slang_operation_copy(innerBody, slang_oper_child(oper, 0)); + innerBody->locals->outer_scope = innerDo->locals; + + /* inner do-loop's condition is constant/false */ + { + slang_operation *constFalse = slang_oper_child(innerDo, 1); + slang_operation_literal_bool(constFalse, GL_FALSE); + } + } + + /* _notBreakFlag && LOOPCOND */ + { + slang_operation *cond = slang_oper_child(outerDo, 1); + cond->type = SLANG_OPER_LOGICALAND; + slang_operation_add_children(cond, 2); + { + slang_operation *notBreak = slang_oper_child(cond, 0); + slang_operation_identifier(notBreak, A, "_notBreakFlag"); + } + { + slang_operation *origCond = slang_oper_child(cond, 1); + slang_operation_copy(origCond, slang_oper_child(oper, 1)); + } + } + } + + /* Finally, in innerBody, + * replace "break" with "_notBreakFlag = 0; break" + * replace "continue" with "break" + */ + replace_break_and_cont(A, innerBody); + + /*slang_print_tree(top, 0);*/ + + return _slang_gen_operation(A, top); +} + + +/** * Generate IR tree for a do-while loop using high-level LOOP, IF instructions. */ static slang_ir_node * -_slang_gen_do(slang_assemble_ctx * A, const slang_operation *oper) +_slang_gen_do(slang_assemble_ctx * A, slang_operation *oper) { /* * LOOP: @@ -2410,9 +3053,18 @@ _slang_gen_do(slang_assemble_ctx * A, const slang_operation *oper) * tail code: * BREAK if !expr (child[1]) */ - slang_ir_node *prevLoop, *loop; + slang_ir_node *loop; GLboolean isConst, constTrue; + if (!A->EmitContReturn) { + /* We don't want to emit CONT instructions. If this do-loop has + * a continue, translate it away. + */ + if (_slang_loop_contains_continue(slang_oper_child(oper, 0))) { + return _slang_gen_do_without_continue(A, oper); + } + } + /* type-check expression */ if (!_slang_is_boolean(A, &oper->children[1])) { slang_info_log_error(A->log, "scalar/boolean expression expected for 'do/while'"); @@ -2421,9 +3073,8 @@ _slang_gen_do(slang_assemble_ctx * A, const slang_operation *oper) loop = new_loop(NULL); - /* save old, push new loop */ - prevLoop = A->CurLoop; - A->CurLoop = loop; + /* save loop state */ + push_loop(A, oper, loop); /* loop body: */ loop->Children[0] = _slang_gen_operation(A, &oper->children[0]); @@ -2437,13 +3088,13 @@ _slang_gen_do(slang_assemble_ctx * A, const slang_operation *oper) else { slang_ir_node *cond = new_cond(new_not(_slang_gen_operation(A, &oper->children[1]))); - loop->Children[1] = new_break_if_true(A->CurLoop, cond); + loop->Children[1] = new_break_if_true(A, cond); } /* XXX we should do infinite loop detection, as above */ - /* pop loop, restore prev */ - A->CurLoop = prevLoop; + /* restore loop state */ + pop_loop(A); return loop; } @@ -2485,9 +3136,14 @@ _slang_can_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) const char *varName; slang_atom varId; - assert(oper->type == SLANG_OPER_FOR); + if (oper->type != SLANG_OPER_FOR) + return GL_FALSE; + assert(oper->num_children == 4); + if (_slang_loop_contains_continue_or_break(slang_oper_child_const(oper, 3))) + return GL_FALSE; + /* children[0] must be either "int i=constant" or "i=constant" */ if (oper->children[0].type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) { slang_variable *var; @@ -2582,20 +3238,6 @@ _slang_can_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) } -static void -_unroll_loop_inc(slang_assemble_ctx * A) -{ - A->UnrollLoop++; -} - - -static void -_unroll_loop_dec(slang_assemble_ctx * A) -{ - A->UnrollLoop--; -} - - /** * Unroll a for-loop. * First we determine the number of iterations to unroll. @@ -2612,9 +3254,6 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) slang_ir_node *n, *root = NULL; slang_atom varId; - /* Set flag so code generator knows we're unrolling loops */ - _unroll_loop_inc( A ); - if (oper->children[0].type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) { /* for (int i=0; ... */ slang_variable *var; @@ -2637,15 +3276,11 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) /* make a copy of the loop body */ body = slang_operation_new(1); - if (!body) { - _unroll_loop_dec( A ); + if (!body) return NULL; - } - if (!slang_operation_copy(body, &oper->children[3])) { - _unroll_loop_dec( A ); + if (!slang_operation_copy(body, &oper->children[3])) return NULL; - } /* in body, replace instances of 'varId' with literal 'iter' */ { @@ -2656,7 +3291,6 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) if (!oldVar) { /* undeclared loop variable */ slang_operation_delete(body); - _unroll_loop_dec( A ); return NULL; } @@ -2671,36 +3305,195 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) /* do IR codegen for body */ n = _slang_gen_operation(A, body); - if (!n) { - _unroll_loop_dec( A ); + if (!n) return NULL; - } root = new_seq(root, n); slang_operation_delete(body); } - _unroll_loop_dec( A ); - return root; } /** + * Replace 'continue' statement with 'break' inside a for-loop. + * This is a recursive helper function used by _slang_gen_for_without_continue(). + */ +static void +replace_continue_with_break(slang_assemble_ctx *A, slang_operation *oper) +{ + switch (oper->type) { + case SLANG_OPER_CONTINUE: + oper->type = SLANG_OPER_BREAK; + break; + case SLANG_OPER_FOR: + case SLANG_OPER_DO: + case SLANG_OPER_WHILE: + /* stop upon finding a nested loop */ + break; + default: + /* recurse */ + { + GLuint i; + for (i = 0; i < oper->num_children; i++) { + replace_continue_with_break(A, slang_oper_child(oper, i)); + } + } + } +} + + +/** + * Transform a for-loop so that continue statements are converted to breaks. + * Then do normal IR code generation. + * + * Before: + * + * for (INIT; LOOPCOND; INCR) { + * A; + * if (IFCOND) { + * continue; + * } + * B; + * } + * + * After: + * + * { + * bool _condFlag = 1; + * for (INIT; _condFlag; ) { + * for ( ; _condFlag = LOOPCOND; INCR) { + * A; + * if (IFCOND) { + * break; + * } + * B; + * } + * if (_condFlag) + * INCR; + * } + * } + */ +static slang_ir_node * +_slang_gen_for_without_continue(slang_assemble_ctx *A, slang_operation *oper) +{ + slang_operation *top; + slang_operation *outerFor, *innerFor, *init, *cond, *incr; + slang_operation *lhs, *rhs; + + assert(oper->type == SLANG_OPER_FOR); + + top = slang_operation_new(1); + top->type = SLANG_OPER_BLOCK_NEW_SCOPE; + top->locals->outer_scope = oper->locals->outer_scope; + slang_operation_add_children(top, 2); + + /* declare: bool _condFlag = true */ + { + slang_operation *condDecl = slang_oper_child(top, 0); + slang_generate_declaration(A, top->locals, condDecl, + SLANG_SPEC_BOOL, "_condFlag", GL_TRUE); + } + + /* build outer loop: for (INIT; _condFlag; ) { */ + outerFor = slang_oper_child(top, 1); + outerFor->type = SLANG_OPER_FOR; + slang_operation_add_children(outerFor, 4); + + init = slang_oper_child(outerFor, 0); + slang_operation_copy(init, slang_oper_child(oper, 0)); + + cond = slang_oper_child(outerFor, 1); + cond->type = SLANG_OPER_IDENTIFIER; + cond->a_id = slang_atom_pool_atom(A->atoms, "_condFlag"); + + incr = slang_oper_child(outerFor, 2); + incr->type = SLANG_OPER_VOID; + + /* body of the outer loop */ + { + slang_operation *block = slang_oper_child(outerFor, 3); + + slang_operation_add_children(block, 2); + block->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; + + /* build inner loop: for ( ; _condFlag = LOOPCOND; INCR) { */ + { + innerFor = slang_oper_child(block, 0); + + /* make copy of orig loop */ + slang_operation_copy(innerFor, oper); + assert(innerFor->type == SLANG_OPER_FOR); + innerFor->locals->outer_scope = block->locals; + + init = slang_oper_child(innerFor, 0); + init->type = SLANG_OPER_VOID; /* leak? */ + + cond = slang_oper_child(innerFor, 1); + slang_operation_destruct(cond); + cond->type = SLANG_OPER_ASSIGN; + cond->locals = _slang_variable_scope_new(innerFor->locals); + slang_operation_add_children(cond, 2); + + lhs = slang_oper_child(cond, 0); + lhs->type = SLANG_OPER_IDENTIFIER; + lhs->a_id = slang_atom_pool_atom(A->atoms, "_condFlag"); + + rhs = slang_oper_child(cond, 1); + slang_operation_copy(rhs, slang_oper_child(oper, 1)); + } + + /* if (_condFlag) INCR; */ + { + slang_operation *ifop = slang_oper_child(block, 1); + ifop->type = SLANG_OPER_IF; + slang_operation_add_children(ifop, 2); + + /* re-use cond node build above */ + slang_operation_copy(slang_oper_child(ifop, 0), cond); + + /* incr node from original for-loop operation */ + slang_operation_copy(slang_oper_child(ifop, 1), + slang_oper_child(oper, 2)); + } + + /* finally, replace "continue" with "break" in the inner for-loop */ + replace_continue_with_break(A, slang_oper_child(innerFor, 3)); + } + + return _slang_gen_operation(A, top); +} + + + +/** * Generate IR for a for-loop. Unrolling will be done when possible. */ static slang_ir_node * -_slang_gen_for(slang_assemble_ctx * A, const slang_operation *oper) +_slang_gen_for(slang_assemble_ctx * A, slang_operation *oper) { - GLboolean unroll = _slang_can_unroll_for_loop(A, oper); + GLboolean unroll; + + if (!A->EmitContReturn) { + /* We don't want to emit CONT instructions. If this for-loop has + * a continue, translate it away. + */ + if (_slang_loop_contains_continue(slang_oper_child(oper, 3))) { + return _slang_gen_for_without_continue(A, oper); + } + } + unroll = _slang_can_unroll_for_loop(A, oper); if (unroll) { slang_ir_node *code = _slang_unroll_for_loop(A, oper); if (code) return code; } + assert(oper->type == SLANG_OPER_FOR); + /* conventional for-loop code generation */ { /* @@ -2711,24 +3504,23 @@ _slang_gen_for(slang_assemble_ctx * A, const slang_operation *oper) * tail code: * incr code (child[2]) // XXX continue here */ - slang_ir_node *prevLoop, *loop, *cond, *breakIf, *body, *init, *incr; + slang_ir_node *loop, *cond, *breakIf, *body, *init, *incr; init = _slang_gen_operation(A, &oper->children[0]); loop = new_loop(NULL); - /* save old, push new loop */ - prevLoop = A->CurLoop; - A->CurLoop = loop; + /* save loop state */ + push_loop(A, oper, loop); cond = new_cond(new_not(_slang_gen_operation(A, &oper->children[1]))); - breakIf = new_break_if_true(A->CurLoop, cond); + breakIf = new_break_if_true(A, cond); body = _slang_gen_operation(A, &oper->children[3]); incr = _slang_gen_operation(A, &oper->children[2]); loop->Children[0] = new_seq(breakIf, body); loop->Children[1] = incr; /* tail code */ - /* pop loop, restore prev */ - A->CurLoop = prevLoop; + /* restore loop state */ + pop_loop(A); return new_seq(init, loop); } @@ -2738,18 +3530,22 @@ _slang_gen_for(slang_assemble_ctx * A, const slang_operation *oper) static slang_ir_node * _slang_gen_continue(slang_assemble_ctx * A, const slang_operation *oper) { - slang_ir_node *n, *loopNode; + slang_ir_node *n, *cont, *incr = NULL, *loopNode; + assert(oper->type == SLANG_OPER_CONTINUE); - loopNode = A->CurLoop; + loopNode = current_loop_ir(A); assert(loopNode); assert(loopNode->Opcode == IR_LOOP); - n = new_node0(IR_CONT); - if (n) { - n->Parent = loopNode; - /* insert this node at head of linked list */ - n->List = loopNode->List; - loopNode->List = n; + + cont = new_node0(IR_CONT); + if (cont) { + cont->Parent = loopNode; + /* insert this node at head of linked list of cont/break instructions */ + cont->List = loopNode->List; + loopNode->List = cont; } + + n = new_seq(incr, cont); return n; } @@ -2819,24 +3615,20 @@ _slang_gen_if(slang_assemble_ctx * A, const slang_operation *oper) if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK) && !haveElseClause) { /* Special case: generate a conditional break */ - if (!A->CurLoop && A->UnrollLoop) /* trying to unroll */ - return NULL; - ifBody = new_break_if_true(A->CurLoop, cond); + ifBody = new_break_if_true(A, cond); return ifBody; } else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE) - && !haveElseClause) { + && !haveElseClause + && current_loop_oper(A) + && current_loop_oper(A)->type != SLANG_OPER_FOR) { /* Special case: generate a conditional continue */ - if (!A->CurLoop && A->UnrollLoop) /* trying to unroll */ - return NULL; - ifBody = new_cont_if_true(A->CurLoop, cond); + ifBody = new_cont_if_true(A, cond); return ifBody; } else { /* general case */ ifBody = _slang_gen_operation(A, &oper->children[1]); - if (!ifBody) - return NULL; if (haveElseClause) elseBody = _slang_gen_operation(A, &oper->children[2]); else @@ -3242,14 +4034,11 @@ _slang_gen_logical_and(slang_assemble_ctx *A, slang_operation *oper) select = slang_operation_new(1); select->type = SLANG_OPER_SELECT; - select->num_children = 3; - select->children = slang_operation_new(3); + slang_operation_add_children(select, 3); - slang_operation_copy(&select->children[0], &oper->children[0]); - slang_operation_copy(&select->children[1], &oper->children[1]); - select->children[2].type = SLANG_OPER_LITERAL_BOOL; - ASSIGN_4V(select->children[2].literal, 0, 0, 0, 0); /* false */ - select->children[2].literal_size = 1; + slang_operation_copy(slang_oper_child(select, 0), &oper->children[0]); + slang_operation_copy(slang_oper_child(select, 1), &oper->children[1]); + slang_operation_literal_bool(slang_oper_child(select, 2), GL_FALSE); n = _slang_gen_select(A, select); return n; @@ -3268,14 +4057,11 @@ _slang_gen_logical_or(slang_assemble_ctx *A, slang_operation *oper) select = slang_operation_new(1); select->type = SLANG_OPER_SELECT; - select->num_children = 3; - select->children = slang_operation_new(3); + slang_operation_add_children(select, 3); - slang_operation_copy(&select->children[0], &oper->children[0]); - select->children[1].type = SLANG_OPER_LITERAL_BOOL; - ASSIGN_4V(select->children[1].literal, 1, 1, 1, 1); /* true */ - select->children[1].literal_size = 1; - slang_operation_copy(&select->children[2], &oper->children[1]); + slang_operation_copy(slang_oper_child(select, 0), &oper->children[0]); + slang_operation_literal_bool(slang_oper_child(select, 1), GL_TRUE); + slang_operation_copy(slang_oper_child(select, 2), &oper->children[1]); n = _slang_gen_select(A, select); return n; @@ -3288,70 +4074,8 @@ _slang_gen_logical_or(slang_assemble_ctx *A, slang_operation *oper) static slang_ir_node * _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper) { - const GLboolean haveReturnValue - = (oper->num_children == 1 && oper->children[0].type != SLANG_OPER_VOID); - - /* error checking */ - assert(A->CurFunction); - if (haveReturnValue && - A->CurFunction->header.type.specifier.type == SLANG_SPEC_VOID) { - slang_info_log_error(A->log, "illegal return expression"); - return NULL; - } - else if (!haveReturnValue && - A->CurFunction->header.type.specifier.type != SLANG_SPEC_VOID) { - slang_info_log_error(A->log, "return statement requires an expression"); - return NULL; - } - - if (!haveReturnValue) { - return new_return(A->curFuncEndLabel); - } - else { - /* - * Convert from: - * return expr; - * To: - * __retVal = expr; - * return; // goto __endOfFunction - */ - slang_operation *assign; - slang_atom a_retVal; - slang_ir_node *n; - - a_retVal = slang_atom_pool_atom(A->atoms, "__retVal"); - assert(a_retVal); - -#if 1 /* DEBUG */ - { - slang_variable *v = - _slang_variable_locate(oper->locals, a_retVal, GL_TRUE); - if (!v) { - /* trying to return a value in a void-valued function */ - return NULL; - } - } -#endif - - assign = slang_operation_new(1); - assign->type = SLANG_OPER_ASSIGN; - assign->num_children = 2; - assign->children = slang_operation_new(2); - /* lhs (__retVal) */ - assign->children[0].type = SLANG_OPER_IDENTIFIER; - assign->children[0].a_id = a_retVal; - assign->children[0].locals->outer_scope = assign->locals; - /* rhs (expr) */ - /* XXX we might be able to avoid this copy someday */ - slang_operation_copy(&assign->children[1], &oper->children[0]); - - /* assemble the new code */ - n = new_seq(_slang_gen_operation(A, assign), - new_return(A->curFuncEndLabel)); - - slang_operation_delete(assign); - return n; - } + assert(oper->type == SLANG_OPER_RETURN); + return new_return(A->curFuncEndLabel); } @@ -3457,6 +4181,7 @@ _slang_gen_declaration(slang_assemble_ctx *A, slang_operation *oper) assert(oper->type == SLANG_OPER_VARIABLE_DECL); assert(oper->num_children <= 1); + /* lookup the variable by name */ var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); if (!var) @@ -3612,6 +4337,9 @@ root_swizzle(const slang_ir_storage *st) static slang_ir_node * _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper) { + slang_operation *pred = NULL; + slang_ir_node *n = NULL; + if (oper->children[0].type == SLANG_OPER_IDENTIFIER) { /* Check that var is writeable */ slang_variable *var @@ -3632,6 +4360,17 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper) (char *) oper->children[0].a_id); return NULL; } + + /* check if we need to predicate this assignment based on __notRetFlag */ + if ((var->is_global || + var->type.qualifier == SLANG_QUAL_OUT || + var->type.qualifier == SLANG_QUAL_INOUT) && A->UseReturnFlag) { + /* create predicate, used below */ + pred = slang_operation_new(1); + pred->type = SLANG_OPER_IDENTIFIER; + pred->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); + pred->locals->outer_scope = oper->locals->outer_scope; + } } if (oper->children[0].type == SLANG_OPER_IDENTIFIER && @@ -3643,14 +4382,12 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper) * cases such as "v.x = f();" - would help with typical vertex * transformation. */ - slang_ir_node *n; n = _slang_gen_function_call_name(A, (const char *) oper->children[1].a_id, &oper->children[1], &oper->children[0]); - return n; } else { - slang_ir_node *n, *lhs, *rhs; + slang_ir_node *lhs, *rhs; /* lhs and rhs type checking */ if (!_slang_assignment_compatible(A, @@ -3690,12 +4427,21 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper) rhs = _slang_gen_swizzle(rhs, newSwizzle); } n = new_node2(IR_COPY, lhs, rhs); - return n; } else { return NULL; } } + + if (n && pred) { + /* predicate the assignment code on __notRetFlag */ + slang_ir_node *top, *cond; + + cond = _slang_gen_operation(A, pred); + top = new_if(cond, n, NULL); + return top; + } + return n; } @@ -4048,16 +4794,14 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper) case SLANG_OPER_WHILE: return _slang_gen_while(A, oper); case SLANG_OPER_BREAK: - if (!A->CurLoop) { - if (!A->UnrollLoop) - slang_info_log_error(A->log, "'break' not in loop"); + if (!current_loop_oper(A)) { + slang_info_log_error(A->log, "'break' not in loop"); return NULL; } - return new_break(A->CurLoop); + return new_break(current_loop_ir(A)); case SLANG_OPER_CONTINUE: - if (!A->CurLoop) { - if (!A->UnrollLoop) - slang_info_log_error(A->log, "'continue' not in loop"); + if (!current_loop_oper(A)) { + slang_info_log_error(A->log, "'continue' not in loop"); return NULL; } return _slang_gen_continue(A, oper); @@ -4182,6 +4926,8 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper) return _slang_gen_method_call(A, oper); case SLANG_OPER_RETURN: return _slang_gen_return(A, oper); + case SLANG_OPER_RETURN_INLINED: + return _slang_gen_return(A, oper); case SLANG_OPER_LABEL: return new_label(oper->label); case SLANG_OPER_IDENTIFIER: @@ -4303,6 +5049,8 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, const GLint totalSize = _slang_array_size(size, arrayLen); GLint texIndex = sampler_to_texture_index(var->type.specifier.type); + var->is_global = GL_TRUE; + /* check for sampler2D arrays */ if (texIndex == -1 && var->type.specifier._array) texIndex = sampler_to_texture_index(var->type.specifier._array->type); @@ -4601,7 +5349,9 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun) assert(A->program->Parameters ); assert(A->program->Varying); assert(A->vartable); - A->CurLoop = NULL; + + A->LoopDepth = 0; + A->UseReturnFlag = GL_FALSE; A->CurFunction = fun; /* fold constant expressions, etc. */ diff --git a/src/mesa/shader/slang/slang_codegen.h b/src/mesa/shader/slang/slang_codegen.h index d80013ad341..ee3be55a459 100644 --- a/src/mesa/shader/slang/slang_codegen.h +++ b/src/mesa/shader/slang/slang_codegen.h @@ -31,6 +31,9 @@ #include "slang_compile.h" +#define MAX_LOOP_DEPTH 30 + + typedef struct slang_assemble_ctx_ { slang_atom_pool *atoms; @@ -39,11 +42,19 @@ typedef struct slang_assemble_ctx_ struct gl_sl_pragmas *pragmas; slang_var_table *vartable; slang_info_log *log; - struct slang_label_ *curFuncEndLabel; - struct slang_ir_node_ *CurLoop; + + /* current loop stack */ + const slang_operation *LoopOperStack[MAX_LOOP_DEPTH]; + struct slang_ir_node_ *LoopIRStack[MAX_LOOP_DEPTH]; + GLuint LoopDepth; + + /* current function */ struct slang_function_ *CurFunction; - GLuint UnrollLoop; + struct slang_label_ *curFuncEndLabel; + GLboolean UseReturnFlag; + GLboolean UnresolvedRefs; + GLboolean EmitContReturn; } slang_assemble_ctx; diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index d7ad879e97a..c1b97c7cb70 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1953,6 +1953,7 @@ static int parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, const slang_fully_specified_type * type) { + GET_CURRENT_CONTEXT(ctx); /* a hack */ slang_variable *var; slang_atom a_name; @@ -2066,6 +2067,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, A.vartable = O->vartable; A.log = C->L; A.curFuncEndLabel = NULL; + A.EmitContReturn = ctx->Shader.EmitContReturn; if (!_slang_codegen_global_variable(&A, var, C->type)) RETURN0; } @@ -2430,6 +2432,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, A.program = o.program; A.pragmas = &shader->Pragmas; A.vartable = o.vartable; + A.EmitContReturn = ctx->Shader.EmitContReturn; A.log = C->L; /* main() takes no parameters */ diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c index e6506168808..3e2bdbc91ff 100644 --- a/src/mesa/shader/slang/slang_compile_operation.c +++ b/src/mesa/shader/slang/slang_compile_operation.c @@ -119,11 +119,13 @@ slang_operation_copy(slang_operation * x, const slang_operation * y) if (!slang_operation_construct(&z)) return GL_FALSE; z.type = y->type; - z.children = (slang_operation *) - _slang_alloc(y->num_children * sizeof(slang_operation)); - if (z.children == NULL) { - slang_operation_destruct(&z); - return GL_FALSE; + if (y->num_children > 0) { + z.children = (slang_operation *) + _slang_alloc(y->num_children * sizeof(slang_operation)); + if (z.children == NULL) { + slang_operation_destruct(&z); + return GL_FALSE; + } } for (z.num_children = 0; z.num_children < y->num_children; z.num_children++) { @@ -152,6 +154,15 @@ slang_operation_copy(slang_operation * x, const slang_operation * y) return GL_FALSE; } } + + /* update scoping for children */ + for (i = 0; i < y->num_children; i++) { + if (y->children[i].locals && + y->children[i].locals->outer_scope == y->locals) { + z.children[i].locals->outer_scope = z.locals; + } + } + #if 0 z.var = y->var; z.fun = y->fun; @@ -198,6 +209,20 @@ slang_operation_delete(slang_operation *oper) } +void +slang_operation_free_children(slang_operation *oper) +{ + GLuint i; + for (i = 0; i < slang_oper_num_children(oper); i++) { + slang_operation *child = slang_oper_child(oper, i); + slang_operation_destruct(child); + } + _slang_free(oper->children); + oper->children = NULL; + oper->num_children = 0; +} + + slang_operation * slang_operation_grow(GLuint *numChildren, slang_operation **children) { @@ -263,6 +288,26 @@ slang_operation_insert(GLuint *numElements, slang_operation **array, } +/** + * Add/insert new child into given node at given position. + * \return pointer to the new child node + */ +slang_operation * +slang_operation_insert_child(slang_operation *oper, GLuint pos) +{ + slang_operation *newOp; + + newOp = slang_operation_insert(&oper->num_children, + &oper->children, + pos); + if (newOp) { + newOp->locals->outer_scope = oper->locals; + } + + return newOp; +} + + void _slang_operation_swap(slang_operation *oper0, slang_operation *oper1) { @@ -272,3 +317,16 @@ _slang_operation_swap(slang_operation *oper0, slang_operation *oper1) } +void +slang_operation_add_children(slang_operation *oper, GLuint num_children) +{ + GLuint i; + assert(oper->num_children == 0); + assert(oper->children == NULL); + oper->num_children = num_children; + oper->children = slang_operation_new(num_children); + for (i = 0; i < num_children; i++) { + oper->children[i].locals = _slang_variable_scope_new(oper->locals); + } +} + diff --git a/src/mesa/shader/slang/slang_compile_operation.h b/src/mesa/shader/slang/slang_compile_operation.h index 37af5d617c9..58f1edeed85 100644 --- a/src/mesa/shader/slang/slang_compile_operation.h +++ b/src/mesa/shader/slang/slang_compile_operation.h @@ -42,6 +42,7 @@ typedef enum slang_operation_type_ SLANG_OPER_CONTINUE, /* "continue" statement */ SLANG_OPER_DISCARD, /* "discard" (kill fragment) statement */ SLANG_OPER_RETURN, /* "return" [expr] */ + SLANG_OPER_RETURN_INLINED, /* "return" [expr] from inlined function */ SLANG_OPER_LABEL, /* a jump target */ SLANG_OPER_EXPRESSION, /* [expr] */ SLANG_OPER_IF, /* "if" [0] then [1] else [2] */ @@ -150,6 +151,9 @@ slang_operation_new(GLuint count); extern void slang_operation_delete(slang_operation *oper); +extern void +slang_operation_free_children(slang_operation *oper); + extern slang_operation * slang_operation_grow(GLuint *numChildren, slang_operation **children); @@ -157,8 +161,66 @@ extern slang_operation * slang_operation_insert(GLuint *numChildren, slang_operation **children, GLuint pos); +extern slang_operation * +slang_operation_insert_child(slang_operation *oper, GLuint pos); + extern void _slang_operation_swap(slang_operation *oper0, slang_operation *oper1); +extern void +slang_operation_add_children(slang_operation *oper, GLuint num_children); + + +/** Return number of children of given node */ +static INLINE GLuint +slang_oper_num_children(const slang_operation *oper) +{ + return oper->num_children; +} + +/** Return child of given operation node */ +static INLINE slang_operation * +slang_oper_child(slang_operation *oper, GLuint child) +{ + assert(child < oper->num_children); + return &oper->children[child]; +} + + +/** Return child of given operation node, const version */ +static INLINE const slang_operation * +slang_oper_child_const(const slang_operation *oper, GLuint child) +{ + assert(child < oper->num_children); + return &oper->children[child]; +} + + +/** Init oper to a boolean literal. */ +static INLINE void +slang_operation_literal_bool(slang_operation *oper, GLboolean value) +{ + oper->type = SLANG_OPER_LITERAL_BOOL; + oper->literal[0] = + oper->literal[1] = + oper->literal[2] = + oper->literal[3] = (float) value; + oper->literal_size = 1; +} + + +/** Init oper to an int literal. */ +static INLINE void +slang_operation_literal_int(slang_operation *oper, GLint value) +{ + oper->type = SLANG_OPER_LITERAL_INT; + oper->literal[0] = + oper->literal[1] = + oper->literal[2] = + oper->literal[3] = (float) value; + oper->literal_size = 1; +} + + #endif /* SLANG_COMPILE_OPERATION_H */ diff --git a/src/mesa/shader/slang/slang_compile_variable.h b/src/mesa/shader/slang/slang_compile_variable.h index a667d91b471..b4585599f24 100644 --- a/src/mesa/shader/slang/slang_compile_variable.h +++ b/src/mesa/shader/slang/slang_compile_variable.h @@ -39,6 +39,7 @@ typedef struct slang_variable_ GLuint array_len; /**< only if type == SLANG_SPEC_ARRAy */ struct slang_operation_ *initializer; /**< Optional initializer code */ GLuint size; /**< Variable's size in bytes */ + GLboolean is_global; GLboolean isTemp; /**< a named temporary (__resultTmp) */ GLboolean declared; /**< for debug */ struct slang_ir_storage_ *store; /**< Storage for this var */ diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 5ea89d2ff3e..f6032d1e9ad 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -843,6 +843,14 @@ _slang_link(GLcontext *ctx, } } + /* Debug: */ + if (0) { + if (shProg->VertexProgram) + _mesa_postprocess_program(ctx, &shProg->VertexProgram->Base); + if (shProg->FragmentProgram) + _mesa_postprocess_program(ctx, &shProg->FragmentProgram->Base); + } + if (ctx->Shader.Flags & GLSL_DUMP) { _mesa_printf("Varying vars:\n"); _mesa_print_parameter_list(shProg->Varying); diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c index bf1475f91d9..98c7877534f 100644 --- a/src/mesa/shader/slang/slang_print.c +++ b/src/mesa/shader/slang/slang_print.c @@ -261,6 +261,7 @@ slang_print_tree(const slang_operation *op, int indent) break; case SLANG_OPER_BLOCK_NEW_SCOPE: + case SLANG_OPER_NON_INLINED_CALL: spaces(indent); printf("{{ // new scope locals=%p outer=%p: ", (void *) op->locals, @@ -348,6 +349,13 @@ slang_print_tree(const slang_operation *op, int indent) slang_print_tree(&op->children[0], indent + 3); break; + case SLANG_OPER_RETURN_INLINED: + spaces(indent); + printf("RETURN_INLINED\n"); + if (op->num_children > 0) + slang_print_tree(&op->children[0], indent + 3); + break; + case SLANG_OPER_LABEL: spaces(indent); printf("LABEL %s\n", (char *) op->a_id); @@ -478,7 +486,7 @@ slang_print_tree(const slang_operation *op, int indent) (void *) scope, (void *) op->locals, (void *) op->locals->outer_scope); - assert(scope); + /*assert(scope);*/ } } break; diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S index bbc6f6e0caf..12d74fa4fb3 100644 --- a/src/mesa/sparc/glapi_sparc.S +++ b/src/mesa/sparc/glapi_sparc.S @@ -759,24 +759,28 @@ gl_dispatch_functions_start: GL_STUB(glGetAttribLocationARB, _gloffset_GetAttribLocationARB) GL_STUB(glDrawBuffersARB, _gloffset_DrawBuffersARB) GL_STUB(glRenderbufferStorageMultisample, _gloffset_RenderbufferStorageMultisample) + GL_STUB(glFlushMappedBufferRange, _gloffset_FlushMappedBufferRange) + GL_STUB(glMapBufferRange, _gloffset_MapBufferRange) + GL_STUB(glBindVertexArray, _gloffset_BindVertexArray) + GL_STUB(glGenVertexArrays, _gloffset_GenVertexArrays) GL_STUB(glCopyBufferSubData, _gloffset_CopyBufferSubData) GL_STUB(glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT) - GL_STUB(gl_dispatch_stub_564, _gloffset_GetPixelTexGenParameterfvSGIS) - HIDDEN(gl_dispatch_stub_564) - GL_STUB(gl_dispatch_stub_565, _gloffset_GetPixelTexGenParameterivSGIS) - HIDDEN(gl_dispatch_stub_565) - GL_STUB(gl_dispatch_stub_566, _gloffset_PixelTexGenParameterfSGIS) - HIDDEN(gl_dispatch_stub_566) - GL_STUB(gl_dispatch_stub_567, _gloffset_PixelTexGenParameterfvSGIS) - HIDDEN(gl_dispatch_stub_567) - GL_STUB(gl_dispatch_stub_568, _gloffset_PixelTexGenParameteriSGIS) + GL_STUB(gl_dispatch_stub_568, _gloffset_GetPixelTexGenParameterfvSGIS) HIDDEN(gl_dispatch_stub_568) - GL_STUB(gl_dispatch_stub_569, _gloffset_PixelTexGenParameterivSGIS) + GL_STUB(gl_dispatch_stub_569, _gloffset_GetPixelTexGenParameterivSGIS) HIDDEN(gl_dispatch_stub_569) - GL_STUB(gl_dispatch_stub_570, _gloffset_SampleMaskSGIS) + GL_STUB(gl_dispatch_stub_570, _gloffset_PixelTexGenParameterfSGIS) HIDDEN(gl_dispatch_stub_570) - GL_STUB(gl_dispatch_stub_571, _gloffset_SamplePatternSGIS) + GL_STUB(gl_dispatch_stub_571, _gloffset_PixelTexGenParameterfvSGIS) HIDDEN(gl_dispatch_stub_571) + GL_STUB(gl_dispatch_stub_572, _gloffset_PixelTexGenParameteriSGIS) + HIDDEN(gl_dispatch_stub_572) + GL_STUB(gl_dispatch_stub_573, _gloffset_PixelTexGenParameterivSGIS) + HIDDEN(gl_dispatch_stub_573) + GL_STUB(gl_dispatch_stub_574, _gloffset_SampleMaskSGIS) + HIDDEN(gl_dispatch_stub_574) + GL_STUB(gl_dispatch_stub_575, _gloffset_SamplePatternSGIS) + HIDDEN(gl_dispatch_stub_575) GL_STUB(glColorPointerEXT, _gloffset_ColorPointerEXT) GL_STUB(glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT) GL_STUB(glIndexPointerEXT, _gloffset_IndexPointerEXT) @@ -787,10 +791,10 @@ gl_dispatch_functions_start: GL_STUB(glPointParameterfvEXT, _gloffset_PointParameterfvEXT) GL_STUB(glLockArraysEXT, _gloffset_LockArraysEXT) GL_STUB(glUnlockArraysEXT, _gloffset_UnlockArraysEXT) - GL_STUB(gl_dispatch_stub_582, _gloffset_CullParameterdvEXT) - HIDDEN(gl_dispatch_stub_582) - GL_STUB(gl_dispatch_stub_583, _gloffset_CullParameterfvEXT) - HIDDEN(gl_dispatch_stub_583) + GL_STUB(gl_dispatch_stub_586, _gloffset_CullParameterdvEXT) + HIDDEN(gl_dispatch_stub_586) + GL_STUB(gl_dispatch_stub_587, _gloffset_CullParameterfvEXT) + HIDDEN(gl_dispatch_stub_587) GL_STUB(glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT) GL_STUB(glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT) GL_STUB(glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT) @@ -815,8 +819,8 @@ gl_dispatch_functions_start: GL_STUB(glFogCoorddvEXT, _gloffset_FogCoorddvEXT) GL_STUB(glFogCoordfEXT, _gloffset_FogCoordfEXT) GL_STUB(glFogCoordfvEXT, _gloffset_FogCoordfvEXT) - GL_STUB(gl_dispatch_stub_608, _gloffset_PixelTexGenSGIX) - HIDDEN(gl_dispatch_stub_608) + GL_STUB(gl_dispatch_stub_612, _gloffset_PixelTexGenSGIX) + HIDDEN(gl_dispatch_stub_612) GL_STUB(glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT) GL_STUB(glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV) GL_STUB(glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV) @@ -858,24 +862,24 @@ gl_dispatch_functions_start: GL_STUB(glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA) GL_STUB(glWindowPos4sMESA, _gloffset_WindowPos4sMESA) GL_STUB(glWindowPos4svMESA, _gloffset_WindowPos4svMESA) - GL_STUB(gl_dispatch_stub_650, _gloffset_MultiModeDrawArraysIBM) - HIDDEN(gl_dispatch_stub_650) - GL_STUB(gl_dispatch_stub_651, _gloffset_MultiModeDrawElementsIBM) - HIDDEN(gl_dispatch_stub_651) - GL_STUB(gl_dispatch_stub_652, _gloffset_DeleteFencesNV) - HIDDEN(gl_dispatch_stub_652) - GL_STUB(gl_dispatch_stub_653, _gloffset_FinishFenceNV) - HIDDEN(gl_dispatch_stub_653) - GL_STUB(gl_dispatch_stub_654, _gloffset_GenFencesNV) + GL_STUB(gl_dispatch_stub_654, _gloffset_MultiModeDrawArraysIBM) HIDDEN(gl_dispatch_stub_654) - GL_STUB(gl_dispatch_stub_655, _gloffset_GetFenceivNV) + GL_STUB(gl_dispatch_stub_655, _gloffset_MultiModeDrawElementsIBM) HIDDEN(gl_dispatch_stub_655) - GL_STUB(gl_dispatch_stub_656, _gloffset_IsFenceNV) + GL_STUB(gl_dispatch_stub_656, _gloffset_DeleteFencesNV) HIDDEN(gl_dispatch_stub_656) - GL_STUB(gl_dispatch_stub_657, _gloffset_SetFenceNV) + GL_STUB(gl_dispatch_stub_657, _gloffset_FinishFenceNV) HIDDEN(gl_dispatch_stub_657) - GL_STUB(gl_dispatch_stub_658, _gloffset_TestFenceNV) + GL_STUB(gl_dispatch_stub_658, _gloffset_GenFencesNV) HIDDEN(gl_dispatch_stub_658) + GL_STUB(gl_dispatch_stub_659, _gloffset_GetFenceivNV) + HIDDEN(gl_dispatch_stub_659) + GL_STUB(gl_dispatch_stub_660, _gloffset_IsFenceNV) + HIDDEN(gl_dispatch_stub_660) + GL_STUB(gl_dispatch_stub_661, _gloffset_SetFenceNV) + HIDDEN(gl_dispatch_stub_661) + GL_STUB(gl_dispatch_stub_662, _gloffset_TestFenceNV) + HIDDEN(gl_dispatch_stub_662) GL_STUB(glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV) GL_STUB(glBindProgramNV, _gloffset_BindProgramNV) GL_STUB(glDeleteProgramsNV, _gloffset_DeleteProgramsNV) @@ -956,26 +960,26 @@ gl_dispatch_functions_start: GL_STUB(glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI) GL_STUB(glPointParameteriNV, _gloffset_PointParameteriNV) GL_STUB(glPointParameterivNV, _gloffset_PointParameterivNV) - GL_STUB(gl_dispatch_stub_739, _gloffset_ActiveStencilFaceEXT) - HIDDEN(gl_dispatch_stub_739) - GL_STUB(gl_dispatch_stub_740, _gloffset_BindVertexArrayAPPLE) - HIDDEN(gl_dispatch_stub_740) - GL_STUB(gl_dispatch_stub_741, _gloffset_DeleteVertexArraysAPPLE) - HIDDEN(gl_dispatch_stub_741) - GL_STUB(gl_dispatch_stub_742, _gloffset_GenVertexArraysAPPLE) - HIDDEN(gl_dispatch_stub_742) - GL_STUB(gl_dispatch_stub_743, _gloffset_IsVertexArrayAPPLE) + GL_STUB(gl_dispatch_stub_743, _gloffset_ActiveStencilFaceEXT) HIDDEN(gl_dispatch_stub_743) + GL_STUB(gl_dispatch_stub_744, _gloffset_BindVertexArrayAPPLE) + HIDDEN(gl_dispatch_stub_744) + GL_STUB(gl_dispatch_stub_745, _gloffset_DeleteVertexArraysAPPLE) + HIDDEN(gl_dispatch_stub_745) + GL_STUB(gl_dispatch_stub_746, _gloffset_GenVertexArraysAPPLE) + HIDDEN(gl_dispatch_stub_746) + GL_STUB(gl_dispatch_stub_747, _gloffset_IsVertexArrayAPPLE) + HIDDEN(gl_dispatch_stub_747) GL_STUB(glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV) GL_STUB(glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV) GL_STUB(glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV) GL_STUB(glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV) GL_STUB(glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV) GL_STUB(glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV) - GL_STUB(gl_dispatch_stub_750, _gloffset_DepthBoundsEXT) - HIDDEN(gl_dispatch_stub_750) - GL_STUB(gl_dispatch_stub_751, _gloffset_BlendEquationSeparateEXT) - HIDDEN(gl_dispatch_stub_751) + GL_STUB(gl_dispatch_stub_754, _gloffset_DepthBoundsEXT) + HIDDEN(gl_dispatch_stub_754) + GL_STUB(gl_dispatch_stub_755, _gloffset_BlendEquationSeparateEXT) + HIDDEN(gl_dispatch_stub_755) GL_STUB(glBindFramebufferEXT, _gloffset_BindFramebufferEXT) GL_STUB(glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT) GL_STUB(glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT) @@ -993,19 +997,20 @@ gl_dispatch_functions_start: GL_STUB(glIsFramebufferEXT, _gloffset_IsFramebufferEXT) GL_STUB(glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT) GL_STUB(glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT) - GL_STUB(gl_dispatch_stub_769, _gloffset_BlitFramebufferEXT) - HIDDEN(gl_dispatch_stub_769) - GL_STUB(glFramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT) - GL_STUB(gl_dispatch_stub_771, _gloffset_StencilFuncSeparateATI) - HIDDEN(gl_dispatch_stub_771) - GL_STUB(gl_dispatch_stub_772, _gloffset_ProgramEnvParameters4fvEXT) - HIDDEN(gl_dispatch_stub_772) - GL_STUB(gl_dispatch_stub_773, _gloffset_ProgramLocalParameters4fvEXT) + GL_STUB(gl_dispatch_stub_773, _gloffset_BlitFramebufferEXT) HIDDEN(gl_dispatch_stub_773) - GL_STUB(gl_dispatch_stub_774, _gloffset_GetQueryObjecti64vEXT) - HIDDEN(gl_dispatch_stub_774) - GL_STUB(gl_dispatch_stub_775, _gloffset_GetQueryObjectui64vEXT) - HIDDEN(gl_dispatch_stub_775) + GL_STUB(glFramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT) + GL_STUB(glProvokingVertexEXT, _gloffset_ProvokingVertexEXT) + GL_STUB(gl_dispatch_stub_776, _gloffset_StencilFuncSeparateATI) + HIDDEN(gl_dispatch_stub_776) + GL_STUB(gl_dispatch_stub_777, _gloffset_ProgramEnvParameters4fvEXT) + HIDDEN(gl_dispatch_stub_777) + GL_STUB(gl_dispatch_stub_778, _gloffset_ProgramLocalParameters4fvEXT) + HIDDEN(gl_dispatch_stub_778) + GL_STUB(gl_dispatch_stub_779, _gloffset_GetQueryObjecti64vEXT) + HIDDEN(gl_dispatch_stub_779) + GL_STUB(gl_dispatch_stub_780, _gloffset_GetQueryObjectui64vEXT) + HIDDEN(gl_dispatch_stub_780) GL_STUB_ALIAS(glArrayElementEXT, glArrayElement) GL_STUB_ALIAS(glBindTextureEXT, glBindTexture) GL_STUB_ALIAS(glDrawArraysEXT, glDrawArrays) diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index 4d897b677e0..5209a6a0c9c 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -148,6 +148,8 @@ update_framebuffer_state( struct st_context *st ) assert(strb->surface); pipe_surface_reference(&framebuffer->zsbuf, strb->surface); } + else + pipe_surface_reference(&framebuffer->zsbuf, NULL); } cso_set_framebuffer(st->cso_context, framebuffer); diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 5c7206409cf..36b28cb4df9 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -102,6 +102,9 @@ static void update_raster_state( struct st_context *st ) if (ctx->Light.ShadeModel == GL_FLAT) raster->flatshade = 1; + if (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION_EXT) + raster->flatshade_first = 1; + /* _NEW_LIGHT | _NEW_PROGRAM * * Back-face colors can come from traditional lighting (when diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index ee649be885e..8b3bb5cc033 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -139,6 +139,23 @@ find_translated_vp(struct st_context *st, if (fragInputsRead & (1 << inAttr)) { stfp->input_to_slot[inAttr] = numIn; numIn++; + if (((1 << inAttr) & FRAG_BIT_FOGC)) { + /* leave placeholders for the + * extra registers we extract from fog */ + if (stfp->Base.UsesFrontFacing) { + if (!stfp->Base.UsesFogFragCoord) + --stfp->input_to_slot[inAttr]; + else + ++numIn; + } + if (stfp->Base.UsesPointCoord) { + if (!stfp->Base.UsesFrontFacing && + !stfp->Base.UsesFogFragCoord) + stfp->input_to_slot[inAttr] -= 2; + else + ++numIn; + } + } } else { stfp->input_to_slot[inAttr] = UNUSED; diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 7021d732089..8c1fd5ce025 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -98,8 +98,10 @@ st_bufferobj_subdata(GLcontext *ctx, { struct st_buffer_object *st_obj = st_buffer_object(obj); - if (offset >= st_obj->size || size > (st_obj->size - offset)) - return; + /* we may be called from VBO code, so double-check params here */ + ASSERT(offset >= 0); + ASSERT(size >= 0); + ASSERT(offset + size <= obj->Size); st_cond_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, offset, size, data); @@ -118,8 +120,10 @@ st_bufferobj_get_subdata(GLcontext *ctx, { struct st_buffer_object *st_obj = st_buffer_object(obj); - if (offset >= st_obj->size || size > (st_obj->size - offset)) - return; + /* we may be called from VBO code, so double-check params here */ + ASSERT(offset >= 0); + ASSERT(size >= 0); + ASSERT(offset + size <= obj->Size); st_cond_flush_pipe_buffer_read(st_context(ctx), st_obj->buffer, offset, size, data); @@ -172,8 +176,6 @@ st_bufferobj_data(GLcontext *ctx, return; } - st_obj->size = size; - if (data) st_no_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, 0, size, data); @@ -234,6 +236,9 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, if (access & GL_MAP_READ_BIT) flags |= PIPE_BUFFER_USAGE_CPU_READ; + if (access & GL_MAP_FLUSH_EXPLICIT_BIT) + flags |= PIPE_BUFFER_USAGE_FLUSH_EXPLICIT; + /* ... other flags ... */ diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.h b/src/mesa/state_tracker/st_cb_bufferobjects.h index dcbb5a52336..fda6d05dd34 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.h +++ b/src/mesa/state_tracker/st_cb_bufferobjects.h @@ -40,22 +40,14 @@ struct st_buffer_object { struct gl_buffer_object Base; struct pipe_buffer *buffer; - GLsizeiptrARB size; }; -/* Are the obj->Name tests necessary? Unfortunately yes, mesa - * allocates a couple of gl_buffer_object structs statically, and the - * Name == 0 test is the only way to identify them and avoid casting - * them erroneously to our structs. - */ +/** cast wrapper */ static INLINE struct st_buffer_object * st_buffer_object(struct gl_buffer_object *obj) { - if (obj->Name) - return (struct st_buffer_object *) obj; - else - return NULL; + return (struct st_buffer_object *) obj; } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 2027b713ce0..8b5094a04f3 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -1037,10 +1037,16 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, st_cond_flush_get_tex_transfer(st, rbRead->texture, 0, 0, 0, PIPE_TRANSFER_READ, srcx, srcy, width, height); + struct pipe_transfer *ptTex; + enum pipe_transfer_usage transfer_usage; - struct pipe_transfer *ptTex = - st_cond_flush_get_tex_transfer(st, pt, 0, 0, 0, PIPE_TRANSFER_WRITE, - 0, 0, width, height); + if (type == GL_DEPTH && pf_is_depth_and_stencil(pt->format)) + transfer_usage = PIPE_TRANSFER_READ_WRITE; + else + transfer_usage = PIPE_TRANSFER_WRITE; + + ptTex = st_cond_flush_get_tex_transfer(st, pt, 0, 0, 0, transfer_usage, + 0, 0, width, height); if (type == GL_COLOR) { /* alternate path using get/put_tile() */ diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 14b78d12539..909189f9d39 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -335,7 +335,9 @@ guess_and_alloc_texture(struct st_context *st, * pagetable arrangements. */ if ((stObj->base.MinFilter == GL_NEAREST || - stObj->base.MinFilter == GL_LINEAR) && + stObj->base.MinFilter == GL_LINEAR || + stImage->base._BaseFormat == GL_DEPTH_COMPONENT || + stImage->base._BaseFormat == GL_DEPTH_STENCIL_EXT) && stImage->level == firstLevel) { lastLevel = firstLevel; } @@ -527,6 +529,7 @@ st_TexImage(GLcontext * ctx, GLint texelBytes, sizeInBytes; GLuint dstRowStride; struct gl_pixelstore_attrib unpackNB; + enum pipe_transfer_usage transfer_usage; DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), level, width, height, depth, border); @@ -678,8 +681,14 @@ st_TexImage(GLcontext * ctx, } if (stImage->pt) { + if (format == GL_DEPTH_COMPONENT && + pf_is_depth_and_stencil(stImage->pt->format)) + transfer_usage = PIPE_TRANSFER_READ_WRITE; + else + transfer_usage = PIPE_TRANSFER_WRITE; + texImage->Data = st_texture_image_map(ctx->st, stImage, 0, - PIPE_TRANSFER_WRITE, 0, 0, + transfer_usage, 0, 0, stImage->base.Width, stImage->base.Height); if(stImage->transfer) @@ -740,7 +749,7 @@ st_TexImage(GLcontext * ctx, st_texture_image_unmap(ctx->st, stImage); /* map next slice of 3D texture */ texImage->Data = st_texture_image_map(ctx->st, stImage, i + 1, - PIPE_TRANSFER_WRITE, 0, 0, + transfer_usage, 0, 0, stImage->base.Width, stImage->base.Height); src += srcImageStride; @@ -1039,6 +1048,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, _mesa_image_image_stride(packing, width, height, format, type); GLint i; const GLubyte *src; + enum pipe_transfer_usage transfer_usage; DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), @@ -1070,10 +1080,16 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, * from uploading the buffer under us. */ if (stImage->pt) { + if (format == GL_DEPTH_COMPONENT && + pf_is_depth_and_stencil(stImage->pt->format)) + transfer_usage = PIPE_TRANSFER_READ_WRITE; + else + transfer_usage = PIPE_TRANSFER_WRITE; + st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level, - PIPE_TRANSFER_WRITE); + transfer_usage); texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset, - PIPE_TRANSFER_WRITE, + transfer_usage, xoffset, yoffset, width, height); } @@ -1104,7 +1120,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, /* map next slice of 3D texture */ texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset + i + 1, - PIPE_TRANSFER_WRITE, + transfer_usage, xoffset, yoffset, width, height); src += srcImageStride; @@ -1169,6 +1185,88 @@ st_TexSubImage1D(GLcontext *ctx, GLenum target, GLint level, } +static void +st_CompressedTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + assert(0); +} + + +static void +st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLint height, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + struct st_texture_image *stImage = st_texture_image(texImage); + struct pipe_format_block block; + int srcBlockStride; + int dstBlockStride; + int y; + + if (stImage->pt) { + st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level, + PIPE_TRANSFER_WRITE); + texImage->Data = st_texture_image_map(ctx->st, stImage, 0, + PIPE_TRANSFER_WRITE, + xoffset, yoffset, + width, height); + + block = stImage->pt->block; + srcBlockStride = pf_get_stride(&block, width); + dstBlockStride = stImage->transfer->stride; + } else { + assert(stImage->pt); + /* TODO find good values for block and strides */ + /* TODO also adjust texImage->data for yoffset/xoffset */ + return; + } + + if (!texImage->Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage"); + return; + } + + assert(xoffset % block.width == 0); + assert(yoffset % block.height == 0); + assert(width % block.width == 0); + assert(height % block.height == 0); + + for (y = 0; y < height; y += block.height) { + /* don't need to adjust for xoffset and yoffset as st_texture_image_map does that */ + const char *src = (const char*)data + srcBlockStride * pf_get_nblocksy(&block, y); + char *dst = (char*)texImage->Data + dstBlockStride * pf_get_nblocksy(&block, y); + memcpy(dst, src, pf_get_stride(&block, width)); + } + + if (stImage->pt) { + st_texture_image_unmap(ctx->st, stImage); + texImage->Data = NULL; + } +} + + +static void +st_CompressedTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLint height, GLint depth, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + assert(0); +} + + /** * Do a CopyTexSubImage operation using a read transfer from the source, @@ -1190,6 +1288,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, struct pipe_screen *screen = pipe->screen; struct pipe_transfer *src_trans; GLvoid *texDest; + enum pipe_transfer_usage transfer_usage; assert(width <= MAX_WIDTH); @@ -1204,10 +1303,16 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, srcX, srcY, width, height); + if (baseFormat == GL_DEPTH_COMPONENT && + pf_is_depth_and_stencil(stImage->pt->format)) + transfer_usage = PIPE_TRANSFER_READ_WRITE; + else + transfer_usage = PIPE_TRANSFER_WRITE; + st_teximage_flush_before_map(ctx->st, stImage->pt, 0, 0, - PIPE_TRANSFER_WRITE); + transfer_usage); - texDest = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE, + texDest = st_texture_image_map(ctx->st, stImage, 0, transfer_usage, destX, destY, width, height); if (baseFormat == GL_DEPTH_COMPONENT || @@ -1818,6 +1923,9 @@ st_init_texture_functions(struct dd_function_table *functions) functions->TexSubImage1D = st_TexSubImage1D; functions->TexSubImage2D = st_TexSubImage2D; functions->TexSubImage3D = st_TexSubImage3D; + functions->CompressedTexSubImage1D = st_CompressedTexSubImage1D; + functions->CompressedTexSubImage2D = st_CompressedTexSubImage2D; + functions->CompressedTexSubImage3D = st_CompressedTexSubImage3D; functions->CopyTexImage1D = st_CopyTexImage1D; functions->CopyTexImage2D = st_CopyTexImage2D; functions->CopyTexSubImage1D = st_CopyTexSubImage1D; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 92ddffc0148..8514b6b3756 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -274,20 +274,11 @@ st_make_current(struct st_context *st, _glapi_check_multithread(); if (st) { - GLboolean firstTime = st->ctx->FirstTimeCurrent; - if(!_mesa_make_current(st->ctx, &draw->Base, &read->Base)) + if (!_mesa_make_current(st->ctx, &draw->Base, &read->Base)) return GL_FALSE; - /* Need to initialize viewport here since draw->Base->Width/Height - * will still be zero at this point. - * This could be improved, but would require rather extensive work - * elsewhere (allocate rb surface storage sooner) - */ - if (firstTime) { - GLuint w = draw->InitWidth, h = draw->InitHeight; - _mesa_set_viewport(st->ctx, 0, 0, w, h); - _mesa_set_scissor(st->ctx, 0, 0, w, h); - } + _mesa_check_init_viewport(st->ctx, draw->InitWidth, draw->InitHeight); + return GL_TRUE; } else { diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 8e036223c65..914a507bef6 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -229,8 +229,10 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count, struct st_buffer_object *stobj = st_buffer_object(array->BufferObj); ubyte *map; - if (!stobj) + if (!stobj || stobj->Base.Name == 0) { + /* edge flags are not in a VBO */ return NULL; + } vec = (unsigned *) _mesa_calloc(sizeof(unsigned) * ((count + 31) / 32)); if (!vec) diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 8ed1211db60..8a958e8bd88 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -120,6 +120,11 @@ void st_init_limits(struct st_context *st) c->MaxDrawBuffers = CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), 1, MAX_DRAW_BUFFERS); + + /* Is TGSI_OPCODE_CONT supported? */ + /* XXX separate query for early function return? */ + st->ctx->Shader.EmitContReturn = + screen->get_param(screen, PIPE_CAP_TGSI_CONT_SUPPORTED); } @@ -139,19 +144,20 @@ void st_init_extensions(struct st_context *st) * Extensions that are supported by all Gallium drivers: */ ctx->Extensions.ARB_copy_buffer = GL_TRUE; - ctx->Extensions.ARB_multisample = GL_TRUE; ctx->Extensions.ARB_fragment_program = GL_TRUE; + ctx->Extensions.ARB_map_buffer_range = GL_TRUE; + ctx->Extensions.ARB_multisample = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */ ctx->Extensions.ARB_texture_compression = GL_TRUE; ctx->Extensions.ARB_texture_cube_map = GL_TRUE; 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_vertex_program = GL_TRUE; + ctx->Extensions.ARB_vertex_array_object = GL_TRUE; ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; + ctx->Extensions.ARB_vertex_program = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; - ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; ctx->Extensions.EXT_blend_func_separate = GL_TRUE; ctx->Extensions.EXT_blend_logic_op = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; @@ -162,6 +168,7 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE; ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; ctx->Extensions.EXT_point_parameters = GL_TRUE; + ctx->Extensions.EXT_provoking_vertex = GL_TRUE; ctx->Extensions.EXT_secondary_color = GL_TRUE; ctx->Extensions.EXT_stencil_wrap = GL_TRUE; ctx->Extensions.EXT_texture_env_add = GL_TRUE; @@ -174,6 +181,7 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.NV_blend_square = GL_TRUE; ctx->Extensions.NV_texgen_reflection = GL_TRUE; + ctx->Extensions.NV_texture_env_combine4 = GL_TRUE; ctx->Extensions.SGI_color_matrix = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; @@ -197,6 +205,10 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; } + if (screen->get_param(screen, PIPE_CAP_BLEND_EQUATION_SEPARATE)) { + ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; + } + if (screen->get_param(screen, PIPE_CAP_TEXTURE_MIRROR_CLAMP) > 0) { ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE; } @@ -281,4 +293,10 @@ void st_init_extensions(struct st_context *st) PIPE_TEXTURE_USAGE_SAMPLER, 0)) { ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; } + + /* GL_ARB_framebuffer_object */ + if (ctx->Extensions.EXT_packed_depth_stencil) { + /* we support always support GL_EXT_framebuffer_blit */ + ctx->Extensions.ARB_framebuffer_object = GL_TRUE; + } } diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 7072cbe62c7..ca32b2e573c 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -134,16 +134,7 @@ void st_resize_framebuffer( struct st_framebuffer *stfb, if (stfb->Base.Width != width || stfb->Base.Height != height) { GET_CURRENT_CONTEXT(ctx); if (ctx) { - if (stfb->InitWidth == 0 && stfb->InitHeight == 0) { - /* didn't have a valid size until now */ - stfb->InitWidth = width; - stfb->InitHeight = height; - if (ctx->Viewport.Width <= 1) { - /* set context's initial viewport/scissor size */ - _mesa_set_viewport(ctx, 0, 0, width, height); - _mesa_set_scissor(ctx, 0, 0, width, height); - } - } + _mesa_check_init_viewport(ctx, width, height); _mesa_resize_framebuffer(ctx, &stfb->Base, width, height); @@ -289,7 +280,8 @@ st_notify_swapbuffers(struct st_framebuffer *stfb) PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_FRAME, NULL ); - ctx->st->frontbuffer_status = FRONT_STATUS_COPY_OF_BACK; + if (st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer)) + ctx->st->frontbuffer_status = FRONT_STATUS_COPY_OF_BACK; } } diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index dc6d77825f5..58f69336523 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -198,9 +198,6 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, return; } - if (dstImage->ImageOffsets) - _mesa_free(dstImage->ImageOffsets); - /* Free old image data */ if (dstImage->Data) ctx->Driver.FreeTexImageData(ctx, dstImage); diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 43c9afccc3b..e150dff9bbc 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -101,8 +101,10 @@ map_register_file( */ static GLuint map_register_file_index( + GLuint procType, GLuint file, GLuint index, + GLuint *swizzle, const GLuint inputMapping[], const GLuint outputMapping[], const GLuint immediateMapping[], @@ -110,6 +112,27 @@ map_register_file_index( { switch( file ) { case TGSI_FILE_INPUT: + if (procType == TGSI_PROCESSOR_FRAGMENT && + index == FRAG_ATTRIB_FOGC) { + if (GET_SWZ(*swizzle, 0) == SWIZZLE_X) { + /* do nothing we're, ok */ + } else if (GET_SWZ(*swizzle, 0) == SWIZZLE_Y) { + /* replace the swizzle with xxxx */ + *swizzle = MAKE_SWIZZLE4(SWIZZLE_X, + SWIZZLE_X, + SWIZZLE_X, + SWIZZLE_X); + /* register after fog */ + return inputMapping[index] + 1; + } else { + *swizzle = MAKE_SWIZZLE4(SWIZZLE_Z, + SWIZZLE_W, + SWIZZLE_Z, + SWIZZLE_W); + /* register after frontface */ + return inputMapping[index] + 2; + } + } /* inputs are mapped according to the user-defined map */ return inputMapping[index]; @@ -236,16 +259,24 @@ compile_instruction( fulldst = &fullinst->FullDstRegisters[0]; fulldst->DstRegister.File = map_register_file( inst->DstReg.File, 0, NULL, GL_FALSE ); fulldst->DstRegister.Index = map_register_file_index( + procType, fulldst->DstRegister.File, inst->DstReg.Index, + NULL, inputMapping, outputMapping, NULL, GL_FALSE ); fulldst->DstRegister.WriteMask = convert_writemask( inst->DstReg.WriteMask ); + if (inst->DstReg.RelAddr) { + fulldst->DstRegister.Indirect = 1; + fulldst->DstRegisterInd.File = TGSI_FILE_ADDRESS; + fulldst->DstRegisterInd.Index = 0; + } for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) { GLuint j; + GLuint swizzle = inst->SrcReg[i].Swizzle; fullsrc = &fullinst->FullSrcRegisters[i]; @@ -264,8 +295,10 @@ compile_instruction( immediateMapping, indirectAccess ); fullsrc->SrcRegister.Index = map_register_file_index( + procType, fullsrc->SrcRegister.File, inst->SrcReg[i].Index, + &swizzle, inputMapping, outputMapping, immediateMapping, @@ -278,7 +311,7 @@ compile_instruction( GLboolean extended = (inst->SrcReg[i].Negate != NEGATE_NONE && inst->SrcReg[i].Negate != NEGATE_XYZW); for( j = 0; j < 4; j++ ) { - swz[j] = GET_SWZ( inst->SrcReg[i].Swizzle, j ); + swz[j] = GET_SWZ( swizzle, j ); if (swz[j] > SWIZZLE_W) extended = GL_TRUE; } diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 72ca8524582..e4d3bb33c71 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -303,6 +303,26 @@ st_translate_vertex_program(struct st_context *st, outputMapping = defaultOutputMapping; } +#if 0 /* debug */ + { + GLuint i; + printf("outputMapping? %d\n", outputMapping ? 1 : 0); + if (outputMapping) { + printf("attr -> slot\n"); + for (i = 0; i < 16; i++) { + printf(" %2d %3d\n", i, outputMapping[i]); + } + } + printf("slot sem_name sem_index\n"); + for (i = 0; i < vs_num_outputs; i++) { + printf(" %2d %d %d\n", + i, + vs_output_semantic_name[i], + vs_output_semantic_index[i]); + } + } +#endif + /* free old shader state, if any */ if (stvp->state.tokens) { _mesa_free((void *) stvp->state.tokens); @@ -433,15 +453,34 @@ st_translate_fragment_program(struct st_context *st, stfp->input_semantic_index[slot] = 1; interpMode[slot] = TGSI_INTERPOLATE_LINEAR; break; - case FRAG_ATTRIB_FOGC: - if (stfp->Base.UsesPointCoord) { - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stfp->input_semantic_index[slot] = num_generic++; - } else { + case FRAG_ATTRIB_FOGC: { + int extra_decls = 0; + if (stfp->Base.UsesFogFragCoord) { stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG; stfp->input_semantic_index[slot] = 0; + interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; + input_flags[slot] = stfp->Base.Base.InputFlags[attr]; + ++extra_decls; } - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; + if (stfp->Base.UsesFrontFacing) { + GLint idx = slot + extra_decls; + stfp->input_semantic_name[idx] = TGSI_SEMANTIC_FACE; + stfp->input_semantic_index[idx] = 0; + interpMode[idx] = TGSI_INTERPOLATE_CONSTANT; + input_flags[idx] = stfp->Base.Base.InputFlags[attr]; + ++extra_decls; + } + if (stfp->Base.UsesPointCoord) { + GLint idx = slot + extra_decls; + stfp->input_semantic_name[idx] = TGSI_SEMANTIC_GENERIC; + stfp->input_semantic_index[idx] = num_generic++; + interpMode[idx] = TGSI_INTERPOLATE_PERSPECTIVE; + input_flags[idx] = stfp->Base.Base.InputFlags[attr]; + ++extra_decls; + } + fs_num_inputs += extra_decls - 1; + continue; + } break; case FRAG_ATTRIB_TEX0: case FRAG_ATTRIB_TEX1: diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 0067d3eeb73..6b1f9346475 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -138,7 +138,7 @@ lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c, * If A is a signed integer, A % B doesn't give the right value for A < 0 * (in terms of texture repeat). Just casting to unsigned fixes that. */ -#define REMAINDER(A, B) ((unsigned) (A) % (unsigned) (B)) +#define REMAINDER(A, B) (((A) + (B) * 1024) % (B)) /** diff --git a/src/mesa/tnl/t_vb_rendertmp.h b/src/mesa/tnl/t_vb_rendertmp.h index 2b5f4e93b22..75f6f55bdce 100644 --- a/src/mesa/tnl/t_vb_rendertmp.h +++ b/src/mesa/tnl/t_vb_rendertmp.h @@ -82,7 +82,10 @@ static void TAG(render_lines)( GLcontext *ctx, INIT(GL_LINES); for (j=start+1; j<count; j+=2 ) { RESET_STIPPLE; - RENDER_LINE( ELT(j-1), ELT(j) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(j-1), ELT(j) ); + else + RENDER_LINE( ELT(j), ELT(j-1) ); } POSTFIX; } @@ -103,9 +106,12 @@ static void TAG(render_line_strip)( GLcontext *ctx, RESET_STIPPLE; } - for (j=start+1; j<count; j++ ) - RENDER_LINE( ELT(j-1), ELT(j) ); - + for (j=start+1; j<count; j++ ) { + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(j-1), ELT(j) ); + else + RENDER_LINE( ELT(j), ELT(j-1) ); + } POSTFIX; } @@ -125,15 +131,24 @@ static void TAG(render_line_loop)( GLcontext *ctx, if (start+1 < count) { if (TEST_PRIM_BEGIN(flags)) { RESET_STIPPLE; - RENDER_LINE( ELT(start), ELT(start+1) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(start), ELT(start+1) ); + else + RENDER_LINE( ELT(start+1), ELT(start) ); } for ( i = start+2 ; i < count ; i++) { - RENDER_LINE( ELT(i-1), ELT(i) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(i-1), ELT(i) ); + else + RENDER_LINE( ELT(i), ELT(i-1) ); } if ( TEST_PRIM_END(flags)) { - RENDER_LINE( ELT(count-1), ELT(start) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(count-1), ELT(start) ); + else + RENDER_LINE( ELT(start), ELT(count-1) ); } } @@ -156,11 +171,17 @@ static void TAG(render_triangles)( GLcontext *ctx, /* Leave the edgeflags as supplied by the user. */ RESET_STIPPLE; - RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); + else + RENDER_TRI( ELT(j-1), ELT(j), ELT(j-2) ); } } else { for (j=start+2; j<count; j+=3) { - RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); + else + RENDER_TRI( ELT(j-1), ELT(j), ELT(j-2) ); } } POSTFIX; @@ -180,26 +201,38 @@ static void TAG(render_tri_strip)( GLcontext *ctx, INIT(GL_TRIANGLE_STRIP); if (NEED_EDGEFLAG_SETUP) { for (j=start+2;j<count;j++,parity^=1) { - GLuint ej2 = ELT(j-2+parity); - GLuint ej1 = ELT(j-1-parity); - GLuint ej = ELT(j); - GLboolean ef2 = EDGEFLAG_GET( ej2 ); - GLboolean ef1 = EDGEFLAG_GET( ej1 ); - GLboolean ef = EDGEFLAG_GET( ej ); + GLuint ej2, ej1, ej; + GLboolean ef2, ef1, ef; + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) { + ej2 = ELT(j-2+parity); + ej1 = ELT(j-1-parity); + ej = ELT(j); + } + else { + ej2 = ELT(j-1+parity); + ej1 = ELT(j-parity); + ej = ELT(j-2); + } + ef2 = EDGEFLAG_GET( ej2 ); + ef1 = EDGEFLAG_GET( ej1 ); + ef = EDGEFLAG_GET( ej ); if (TEST_PRIM_BEGIN(flags)) { RESET_STIPPLE; } EDGEFLAG_SET( ej2, GL_TRUE ); EDGEFLAG_SET( ej1, GL_TRUE ); EDGEFLAG_SET( ej, GL_TRUE ); - RENDER_TRI( ej2, ej1, ej ); + RENDER_TRI( ej2, ej1, ej ); EDGEFLAG_SET( ej2, ef2 ); EDGEFLAG_SET( ej1, ef1 ); EDGEFLAG_SET( ej, ef ); } } else { for (j=start+2; j<count ; j++, parity^=1) { - RENDER_TRI( ELT(j-2+parity), ELT(j-1-parity), ELT(j) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ELT(j-2+parity), ELT(j-1-parity), ELT(j) ); + else + RENDER_TRI( ELT(j-1+parity), ELT(j-parity), ELT(j-2) ); } } POSTFIX; @@ -232,14 +265,20 @@ static void TAG(render_tri_fan)( GLcontext *ctx, EDGEFLAG_SET( ejs, GL_TRUE ); EDGEFLAG_SET( ej1, GL_TRUE ); EDGEFLAG_SET( ej, GL_TRUE ); - RENDER_TRI( ejs, ej1, ej); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ejs, ej1, ej); + else + RENDER_TRI( ej, ejs, ej1); EDGEFLAG_SET( ejs, efs ); EDGEFLAG_SET( ej1, ef1 ); EDGEFLAG_SET( ej, ef ); } } else { for (j=start+2;j<count;j++) { - RENDER_TRI( ELT(start), ELT(j-1), ELT(j) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ELT(start), ELT(j-1), ELT(j) ); + else + RENDER_TRI( ELT(j), ELT(start), ELT(j-1) ); } } @@ -331,11 +370,19 @@ static void TAG(render_quads)( GLcontext *ctx, /* Use user-specified edgeflags for quads. */ RESET_STIPPLE; - RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || + !ctx->Const.QuadsFollowProvokingVertexConvention) + RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); + else + RENDER_QUAD( ELT(j-2), ELT(j-1), ELT(j), ELT(j-3) ); } } else { for (j=start+3; j<count; j+=4) { - RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || + !ctx->Const.QuadsFollowProvokingVertexConvention) + RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); + else + RENDER_QUAD( ELT(j-2), ELT(j-1), ELT(j), ELT(j-3) ); } } POSTFIX; @@ -367,7 +414,11 @@ static void TAG(render_quad_strip)( GLcontext *ctx, EDGEFLAG_SET( ELT(j-2), GL_TRUE ); EDGEFLAG_SET( ELT(j-1), GL_TRUE ); EDGEFLAG_SET( ELT(j), GL_TRUE ); - RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || + !ctx->Const.QuadsFollowProvokingVertexConvention) + RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); + else + RENDER_QUAD( ELT(j-2), ELT(j), ELT(j-1), ELT(j-3) ); EDGEFLAG_SET( ELT(j-3), ef3 ); EDGEFLAG_SET( ELT(j-2), ef2 ); EDGEFLAG_SET( ELT(j-1), ef1 ); @@ -375,7 +426,11 @@ static void TAG(render_quad_strip)( GLcontext *ctx, } } else { for (j=start+3;j<count;j+=2) { - RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || + !ctx->Const.QuadsFollowProvokingVertexConvention) + RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); + else + RENDER_QUAD( ELT(j-2), ELT(j), ELT(j-1), ELT(j-3) ); } } POSTFIX; diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 90025f62fc9..75c32e0b9be 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -153,7 +153,8 @@ static void init_mat_currval(GLcontext *ctx) cl->Stride = 0; cl->StrideB = 0; cl->Enabled = 1; - cl->BufferObj = ctx->Shared->NullBufferObj; + _mesa_reference_buffer_object(ctx, &cl->BufferObj, + ctx->Shared->NullBufferObj); } } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index c939b7b6335..18419928b26 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -51,7 +51,7 @@ vbo_exec_debug_verts( struct vbo_exec_context *exec ) struct _mesa_prim *prim = &exec->vtx.prim[i]; _mesa_printf(" prim %d: %s%s %d..%d %s %s\n", i, - _mesa_lookup_enum_by_nr(prim->mode), + _mesa_lookup_prim_by_nr(prim->mode), prim->weak ? " (weak)" : "", prim->start, prim->start + prim->count, @@ -282,9 +282,14 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec ) { GLcontext *ctx = exec->ctx; - GLenum target = GL_ARRAY_BUFFER_ARB; - GLenum access = GL_READ_WRITE_ARB; - GLenum usage = GL_STREAM_DRAW_ARB; + const GLenum target = GL_ARRAY_BUFFER_ARB; + const GLenum access = GL_READ_WRITE_ARB; /* for MapBuffer */ + const GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */ + GL_MAP_INVALIDATE_RANGE_BIT | + GL_MAP_UNSYNCHRONIZED_BIT | + GL_MAP_FLUSH_EXPLICIT_BIT | + MESA_MAP_NOWAIT_BIT; + const GLenum usage = GL_STREAM_DRAW_ARB; if (exec->vtx.bufferobj->Name == 0) return; @@ -303,10 +308,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec ) exec->vtx.buffer_used, (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used), - (GL_MAP_WRITE_BIT | - GL_MAP_INVALIDATE_RANGE_BIT | - GL_MAP_UNSYNCHRONIZED_BIT | - MESA_MAP_NOWAIT_BIT), + accessRange, exec->vtx.bufferobj); exec->vtx.buffer_ptr = exec->vtx.buffer_map; } @@ -318,8 +320,17 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec ) VBO_VERT_BUFFER_SIZE, NULL, usage, exec->vtx.bufferobj); - exec->vtx.buffer_map = (GLfloat *) - ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); + + if (ctx->Driver.MapBufferRange) + exec->vtx.buffer_map = + (GLfloat *)ctx->Driver.MapBufferRange(ctx, target, + 0, VBO_VERT_BUFFER_SIZE, + accessRange, + exec->vtx.bufferobj); + if (!exec->vtx.buffer_map) + exec->vtx.buffer_map = + (GLfloat *)ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); + assert(exec->vtx.buffer_map); exec->vtx.buffer_ptr = exec->vtx.buffer_map; } diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 868226075ac..d00d304d2ef 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -667,19 +667,33 @@ do { \ * -- Flush current buffer * -- Fallback to opcodes for the rest of the begin/end object. */ -#define DO_FALLBACK(ctx) \ -do { \ - struct vbo_save_context *save = &vbo_context(ctx)->save; \ - \ - if (save->vert_count || save->prim_count) \ - _save_compile_vertex_list( ctx ); \ - \ - _save_copy_to_current( ctx ); \ - _save_reset_vertex( ctx ); \ - _save_reset_counters( ctx ); \ - _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); \ - ctx->Driver.SaveNeedFlush = 0; \ -} while (0) +static void DO_FALLBACK( GLcontext *ctx ) +{ + struct vbo_save_context *save = &vbo_context(ctx)->save; + + if (save->vert_count || save->prim_count) { + GLint i = save->prim_count - 1; + + /* Close off in-progress primitive. + */ + save->prim[i].count = (save->vert_count - + save->prim[i].start); + + /* Need to replay this display list with loopback, + * unfortunately, otherwise this primitive won't be handled + * properly: + */ + save->dangling_attr_ref = 1; + + _save_compile_vertex_list( ctx ); + } + + _save_copy_to_current( ctx ); + _save_reset_vertex( ctx ); + _save_reset_counters( ctx ); + _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); + ctx->Driver.SaveNeedFlush = 0; +} static void GLAPIENTRY _save_EvalCoord1f( GLfloat u ) { @@ -1130,6 +1144,11 @@ static void vbo_destroy_vertex_list( GLcontext *ctx, void *data ) if ( --node->prim_store->refcount == 0 ) FREE( node->prim_store ); + + if (node->current_data) { + FREE(node->current_data); + node->current_data = NULL; + } } @@ -1139,16 +1158,16 @@ static void vbo_print_vertex_list( GLcontext *ctx, void *data ) GLuint i; (void) ctx; - _mesa_debug(NULL, "VBO-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n", - node->count, - node->prim_count, - node->vertex_size); + _mesa_printf("VBO-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n", + node->count, + node->prim_count, + node->vertex_size); for (i = 0 ; i < node->prim_count ; i++) { struct _mesa_prim *prim = &node->prim[i]; _mesa_debug(NULL, " prim %d: %s%s %d..%d %s %s\n", i, - _mesa_lookup_enum_by_nr(prim->mode), + _mesa_lookup_prim_by_nr(prim->mode), prim->weak ? " (weak)" : "", prim->start, prim->start + prim->count, diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c index 92ca4ea95d3..b7a74e4535a 100644 --- a/src/mesa/vbo/vbo_save_loopback.c +++ b/src/mesa/vbo/vbo_save_loopback.c @@ -97,7 +97,7 @@ static void loopback_prim( GLcontext *ctx, if (0) _mesa_printf("loopback prim %s(%s,%s) verts %d..%d\n", - _mesa_lookup_enum_by_nr(prim->mode), + _mesa_lookup_prim_by_nr(prim->mode), prim->begin ? "begin" : "..", prim->end ? "end" : "..", start, diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index dcb14c868b8..d7ffebf6076 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -219,7 +219,7 @@ begin( struct copy_context *copy, GLenum mode, GLboolean begin_flag ) { struct _mesa_prim *prim = ©->dstprim[copy->dstprim_nr]; -/* _mesa_printf("begin %s (%d)\n", _mesa_lookup_enum_by_nr(mode), begin_flag); */ +/* _mesa_printf("begin %s (%d)\n", _mesa_lookup_prim_by_nr(mode), begin_flag); */ prim->mode = mode; prim->begin = begin_flag; diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c index 3ed6b34fbf0..266bc56c826 100644 --- a/src/mesa/vbo/vbo_split_inplace.c +++ b/src/mesa/vbo/vbo_split_inplace.c @@ -63,35 +63,19 @@ static void flush_vertex( struct split_context *split ) if (!split->dstprim_nr) return; - if (split->ib) { - /* This should basically be multipass rendering over the same - * unchanging set of VBO's. Would like the driver not to - * re-upload the data, or swtnl not to re-transform the - * vertices. - */ - assert(split->max_index - split->min_index < split->limits->max_verts); - min_index = split->min_index; - max_index = split->max_index; - } - else { - /* Non-indexed rendering. Cannot assume that the primitives are - * ordered by increasing vertex, because of entrypoints like - * MultiDrawArrays. - */ - GLuint i; - min_index = split->dstprim[0].start; - max_index = min_index + split->dstprim[0].count - 1; + GLuint i; + min_index = split->dstprim[0].start; + max_index = min_index + split->dstprim[0].count - 1; - for (i = 1; i < split->dstprim_nr; i++) { - GLuint tmp_min = split->dstprim[i].start; - GLuint tmp_max = tmp_min + split->dstprim[i].count - 1; + for (i = 1; i < split->dstprim_nr; i++) { + GLuint tmp_min = split->dstprim[i].start; + GLuint tmp_max = tmp_min + split->dstprim[i].count - 1; - if (tmp_min < min_index) - min_index = tmp_min; + if (tmp_min < min_index) + min_index = tmp_min; - if (tmp_max > max_index) - max_index = tmp_max; - } + if (tmp_max > max_index) + max_index = tmp_max; } assert(max_index >= min_index); diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S index 8f66ef96e64..90ad36a8f36 100644 --- a/src/mesa/x86-64/glapi_x86-64.S +++ b/src/mesa/x86-64/glapi_x86-64.S @@ -21157,12 +21157,160 @@ GL_PREFIX(RenderbufferStorageMultisample): .size GL_PREFIX(RenderbufferStorageMultisample), .-GL_PREFIX(RenderbufferStorageMultisample) .p2align 4,,15 + .globl GL_PREFIX(FlushMappedBufferRange) + .type GL_PREFIX(FlushMappedBufferRange), @function +GL_PREFIX(FlushMappedBufferRange): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FlushMappedBufferRange), .-GL_PREFIX(FlushMappedBufferRange) + + .p2align 4,,15 + .globl GL_PREFIX(MapBufferRange) + .type GL_PREFIX(MapBufferRange), @function +GL_PREFIX(MapBufferRange): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MapBufferRange), .-GL_PREFIX(MapBufferRange) + + .p2align 4,,15 + .globl GL_PREFIX(BindVertexArray) + .type GL_PREFIX(BindVertexArray), @function +GL_PREFIX(BindVertexArray): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindVertexArray), .-GL_PREFIX(BindVertexArray) + + .p2align 4,,15 + .globl GL_PREFIX(GenVertexArrays) + .type GL_PREFIX(GenVertexArrays), @function +GL_PREFIX(GenVertexArrays): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenVertexArrays), .-GL_PREFIX(GenVertexArrays) + + .p2align 4,,15 .globl GL_PREFIX(CopyBufferSubData) .type GL_PREFIX(CopyBufferSubData), @function GL_PREFIX(CopyBufferSubData): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4496(%rax), %r11 + movq 4528(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21176,13 +21324,13 @@ GL_PREFIX(CopyBufferSubData): popq %rdx popq %rsi popq %rdi - movq 4496(%rax), %r11 + movq 4528(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4496(%rax), %r11 + movq 4528(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21196,7 +21344,7 @@ GL_PREFIX(CopyBufferSubData): popq %rdx popq %rsi popq %rdi - movq 4496(%rax), %r11 + movq 4528(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CopyBufferSubData), .-GL_PREFIX(CopyBufferSubData) @@ -21207,7 +21355,7 @@ GL_PREFIX(CopyBufferSubData): GL_PREFIX(PolygonOffsetEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4504(%rax), %r11 + movq 4536(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -21217,13 +21365,13 @@ GL_PREFIX(PolygonOffsetEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4504(%rax), %r11 + movq 4536(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4504(%rax), %r11 + movq 4536(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -21233,19 +21381,19 @@ GL_PREFIX(PolygonOffsetEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4504(%rax), %r11 + movq 4536(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PolygonOffsetEXT), .-GL_PREFIX(PolygonOffsetEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_564) - .type GL_PREFIX(_dispatch_stub_564), @function - HIDDEN(GL_PREFIX(_dispatch_stub_564)) -GL_PREFIX(_dispatch_stub_564): + .globl GL_PREFIX(_dispatch_stub_568) + .type GL_PREFIX(_dispatch_stub_568), @function + HIDDEN(GL_PREFIX(_dispatch_stub_568)) +GL_PREFIX(_dispatch_stub_568): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4512(%rax), %r11 + movq 4544(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21255,13 +21403,13 @@ GL_PREFIX(_dispatch_stub_564): popq %rbp popq %rsi popq %rdi - movq 4512(%rax), %r11 + movq 4544(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4512(%rax), %r11 + movq 4544(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21271,19 +21419,19 @@ GL_PREFIX(_dispatch_stub_564): popq %rbp popq %rsi popq %rdi - movq 4512(%rax), %r11 + movq 4544(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_564), .-GL_PREFIX(_dispatch_stub_564) + .size GL_PREFIX(_dispatch_stub_568), .-GL_PREFIX(_dispatch_stub_568) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_565) - .type GL_PREFIX(_dispatch_stub_565), @function - HIDDEN(GL_PREFIX(_dispatch_stub_565)) -GL_PREFIX(_dispatch_stub_565): + .globl GL_PREFIX(_dispatch_stub_569) + .type GL_PREFIX(_dispatch_stub_569), @function + HIDDEN(GL_PREFIX(_dispatch_stub_569)) +GL_PREFIX(_dispatch_stub_569): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4520(%rax), %r11 + movq 4552(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21293,13 +21441,13 @@ GL_PREFIX(_dispatch_stub_565): popq %rbp popq %rsi popq %rdi - movq 4520(%rax), %r11 + movq 4552(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4520(%rax), %r11 + movq 4552(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21309,19 +21457,19 @@ GL_PREFIX(_dispatch_stub_565): popq %rbp popq %rsi popq %rdi - movq 4520(%rax), %r11 + movq 4552(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_565), .-GL_PREFIX(_dispatch_stub_565) + .size GL_PREFIX(_dispatch_stub_569), .-GL_PREFIX(_dispatch_stub_569) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_566) - .type GL_PREFIX(_dispatch_stub_566), @function - HIDDEN(GL_PREFIX(_dispatch_stub_566)) -GL_PREFIX(_dispatch_stub_566): + .globl GL_PREFIX(_dispatch_stub_570) + .type GL_PREFIX(_dispatch_stub_570), @function + HIDDEN(GL_PREFIX(_dispatch_stub_570)) +GL_PREFIX(_dispatch_stub_570): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4528(%rax), %r11 + movq 4560(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -21331,13 +21479,13 @@ GL_PREFIX(_dispatch_stub_566): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4528(%rax), %r11 + movq 4560(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4528(%rax), %r11 + movq 4560(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -21347,19 +21495,19 @@ GL_PREFIX(_dispatch_stub_566): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4528(%rax), %r11 + movq 4560(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_566), .-GL_PREFIX(_dispatch_stub_566) + .size GL_PREFIX(_dispatch_stub_570), .-GL_PREFIX(_dispatch_stub_570) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_567) - .type GL_PREFIX(_dispatch_stub_567), @function - HIDDEN(GL_PREFIX(_dispatch_stub_567)) -GL_PREFIX(_dispatch_stub_567): + .globl GL_PREFIX(_dispatch_stub_571) + .type GL_PREFIX(_dispatch_stub_571), @function + HIDDEN(GL_PREFIX(_dispatch_stub_571)) +GL_PREFIX(_dispatch_stub_571): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4536(%rax), %r11 + movq 4568(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21369,13 +21517,13 @@ GL_PREFIX(_dispatch_stub_567): popq %rbp popq %rsi popq %rdi - movq 4536(%rax), %r11 + movq 4568(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4536(%rax), %r11 + movq 4568(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21385,19 +21533,19 @@ GL_PREFIX(_dispatch_stub_567): popq %rbp popq %rsi popq %rdi - movq 4536(%rax), %r11 + movq 4568(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_567), .-GL_PREFIX(_dispatch_stub_567) + .size GL_PREFIX(_dispatch_stub_571), .-GL_PREFIX(_dispatch_stub_571) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_568) - .type GL_PREFIX(_dispatch_stub_568), @function - HIDDEN(GL_PREFIX(_dispatch_stub_568)) -GL_PREFIX(_dispatch_stub_568): + .globl GL_PREFIX(_dispatch_stub_572) + .type GL_PREFIX(_dispatch_stub_572), @function + HIDDEN(GL_PREFIX(_dispatch_stub_572)) +GL_PREFIX(_dispatch_stub_572): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4544(%rax), %r11 + movq 4576(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21407,13 +21555,13 @@ GL_PREFIX(_dispatch_stub_568): popq %rbp popq %rsi popq %rdi - movq 4544(%rax), %r11 + movq 4576(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4544(%rax), %r11 + movq 4576(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21423,19 +21571,19 @@ GL_PREFIX(_dispatch_stub_568): popq %rbp popq %rsi popq %rdi - movq 4544(%rax), %r11 + movq 4576(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_568), .-GL_PREFIX(_dispatch_stub_568) + .size GL_PREFIX(_dispatch_stub_572), .-GL_PREFIX(_dispatch_stub_572) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_569) - .type GL_PREFIX(_dispatch_stub_569), @function - HIDDEN(GL_PREFIX(_dispatch_stub_569)) -GL_PREFIX(_dispatch_stub_569): + .globl GL_PREFIX(_dispatch_stub_573) + .type GL_PREFIX(_dispatch_stub_573), @function + HIDDEN(GL_PREFIX(_dispatch_stub_573)) +GL_PREFIX(_dispatch_stub_573): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4552(%rax), %r11 + movq 4584(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21445,13 +21593,13 @@ GL_PREFIX(_dispatch_stub_569): popq %rbp popq %rsi popq %rdi - movq 4552(%rax), %r11 + movq 4584(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4552(%rax), %r11 + movq 4584(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21461,19 +21609,19 @@ GL_PREFIX(_dispatch_stub_569): popq %rbp popq %rsi popq %rdi - movq 4552(%rax), %r11 + movq 4584(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_569), .-GL_PREFIX(_dispatch_stub_569) + .size GL_PREFIX(_dispatch_stub_573), .-GL_PREFIX(_dispatch_stub_573) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_570) - .type GL_PREFIX(_dispatch_stub_570), @function - HIDDEN(GL_PREFIX(_dispatch_stub_570)) -GL_PREFIX(_dispatch_stub_570): + .globl GL_PREFIX(_dispatch_stub_574) + .type GL_PREFIX(_dispatch_stub_574), @function + HIDDEN(GL_PREFIX(_dispatch_stub_574)) +GL_PREFIX(_dispatch_stub_574): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4560(%rax), %r11 + movq 4592(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21483,13 +21631,13 @@ GL_PREFIX(_dispatch_stub_570): popq %rbp popq %rsi popq %rdi - movq 4560(%rax), %r11 + movq 4592(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4560(%rax), %r11 + movq 4592(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21499,40 +21647,40 @@ GL_PREFIX(_dispatch_stub_570): popq %rbp popq %rsi popq %rdi - movq 4560(%rax), %r11 + movq 4592(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_570), .-GL_PREFIX(_dispatch_stub_570) + .size GL_PREFIX(_dispatch_stub_574), .-GL_PREFIX(_dispatch_stub_574) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_571) - .type GL_PREFIX(_dispatch_stub_571), @function - HIDDEN(GL_PREFIX(_dispatch_stub_571)) -GL_PREFIX(_dispatch_stub_571): + .globl GL_PREFIX(_dispatch_stub_575) + .type GL_PREFIX(_dispatch_stub_575), @function + HIDDEN(GL_PREFIX(_dispatch_stub_575)) +GL_PREFIX(_dispatch_stub_575): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4568(%rax), %r11 + movq 4600(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4568(%rax), %r11 + movq 4600(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4568(%rax), %r11 + movq 4600(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4568(%rax), %r11 + movq 4600(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_571), .-GL_PREFIX(_dispatch_stub_571) + .size GL_PREFIX(_dispatch_stub_575), .-GL_PREFIX(_dispatch_stub_575) .p2align 4,,15 .globl GL_PREFIX(ColorPointerEXT) @@ -21540,7 +21688,7 @@ GL_PREFIX(_dispatch_stub_571): GL_PREFIX(ColorPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4576(%rax), %r11 + movq 4608(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21554,13 +21702,13 @@ GL_PREFIX(ColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4576(%rax), %r11 + movq 4608(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4576(%rax), %r11 + movq 4608(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21574,7 +21722,7 @@ GL_PREFIX(ColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4576(%rax), %r11 + movq 4608(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorPointerEXT), .-GL_PREFIX(ColorPointerEXT) @@ -21585,7 +21733,7 @@ GL_PREFIX(ColorPointerEXT): GL_PREFIX(EdgeFlagPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4584(%rax), %r11 + movq 4616(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21595,13 +21743,13 @@ GL_PREFIX(EdgeFlagPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4584(%rax), %r11 + movq 4616(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4584(%rax), %r11 + movq 4616(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21611,7 +21759,7 @@ GL_PREFIX(EdgeFlagPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4584(%rax), %r11 + movq 4616(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EdgeFlagPointerEXT), .-GL_PREFIX(EdgeFlagPointerEXT) @@ -21622,7 +21770,7 @@ GL_PREFIX(EdgeFlagPointerEXT): GL_PREFIX(IndexPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4592(%rax), %r11 + movq 4624(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21636,13 +21784,13 @@ GL_PREFIX(IndexPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4592(%rax), %r11 + movq 4624(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4592(%rax), %r11 + movq 4624(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21656,7 +21804,7 @@ GL_PREFIX(IndexPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4592(%rax), %r11 + movq 4624(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IndexPointerEXT), .-GL_PREFIX(IndexPointerEXT) @@ -21667,7 +21815,7 @@ GL_PREFIX(IndexPointerEXT): GL_PREFIX(NormalPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4600(%rax), %r11 + movq 4632(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21681,13 +21829,13 @@ GL_PREFIX(NormalPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4600(%rax), %r11 + movq 4632(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4600(%rax), %r11 + movq 4632(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21701,7 +21849,7 @@ GL_PREFIX(NormalPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4600(%rax), %r11 + movq 4632(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(NormalPointerEXT), .-GL_PREFIX(NormalPointerEXT) @@ -21712,7 +21860,7 @@ GL_PREFIX(NormalPointerEXT): GL_PREFIX(TexCoordPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4608(%rax), %r11 + movq 4640(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21726,13 +21874,13 @@ GL_PREFIX(TexCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4608(%rax), %r11 + movq 4640(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4608(%rax), %r11 + movq 4640(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21746,7 +21894,7 @@ GL_PREFIX(TexCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4608(%rax), %r11 + movq 4640(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TexCoordPointerEXT), .-GL_PREFIX(TexCoordPointerEXT) @@ -21757,7 +21905,7 @@ GL_PREFIX(TexCoordPointerEXT): GL_PREFIX(VertexPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4616(%rax), %r11 + movq 4648(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21771,13 +21919,13 @@ GL_PREFIX(VertexPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4616(%rax), %r11 + movq 4648(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4616(%rax), %r11 + movq 4648(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21791,7 +21939,7 @@ GL_PREFIX(VertexPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4616(%rax), %r11 + movq 4648(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexPointerEXT), .-GL_PREFIX(VertexPointerEXT) @@ -21802,7 +21950,7 @@ GL_PREFIX(VertexPointerEXT): GL_PREFIX(PointParameterfEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4624(%rax), %r11 + movq 4656(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -21812,13 +21960,13 @@ GL_PREFIX(PointParameterfEXT): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4624(%rax), %r11 + movq 4656(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4624(%rax), %r11 + movq 4656(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -21828,7 +21976,7 @@ GL_PREFIX(PointParameterfEXT): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4624(%rax), %r11 + movq 4656(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PointParameterfEXT), .-GL_PREFIX(PointParameterfEXT) @@ -21839,7 +21987,7 @@ GL_PREFIX(PointParameterfEXT): GL_PREFIX(PointParameterfvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4632(%rax), %r11 + movq 4664(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21849,13 +21997,13 @@ GL_PREFIX(PointParameterfvEXT): popq %rbp popq %rsi popq %rdi - movq 4632(%rax), %r11 + movq 4664(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4632(%rax), %r11 + movq 4664(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21865,7 +22013,7 @@ GL_PREFIX(PointParameterfvEXT): popq %rbp popq %rsi popq %rdi - movq 4632(%rax), %r11 + movq 4664(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PointParameterfvEXT), .-GL_PREFIX(PointParameterfvEXT) @@ -21876,7 +22024,7 @@ GL_PREFIX(PointParameterfvEXT): GL_PREFIX(LockArraysEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4640(%rax), %r11 + movq 4672(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21886,13 +22034,13 @@ GL_PREFIX(LockArraysEXT): popq %rbp popq %rsi popq %rdi - movq 4640(%rax), %r11 + movq 4672(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4640(%rax), %r11 + movq 4672(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21902,7 +22050,7 @@ GL_PREFIX(LockArraysEXT): popq %rbp popq %rsi popq %rdi - movq 4640(%rax), %r11 + movq 4672(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(LockArraysEXT), .-GL_PREFIX(LockArraysEXT) @@ -21913,37 +22061,37 @@ GL_PREFIX(LockArraysEXT): GL_PREFIX(UnlockArraysEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4648(%rax), %r11 + movq 4680(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 4648(%rax), %r11 + movq 4680(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4648(%rax), %r11 + movq 4680(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 4648(%rax), %r11 + movq 4680(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(UnlockArraysEXT), .-GL_PREFIX(UnlockArraysEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_582) - .type GL_PREFIX(_dispatch_stub_582), @function - HIDDEN(GL_PREFIX(_dispatch_stub_582)) -GL_PREFIX(_dispatch_stub_582): + .globl GL_PREFIX(_dispatch_stub_586) + .type GL_PREFIX(_dispatch_stub_586), @function + HIDDEN(GL_PREFIX(_dispatch_stub_586)) +GL_PREFIX(_dispatch_stub_586): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4656(%rax), %r11 + movq 4688(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21953,13 +22101,13 @@ GL_PREFIX(_dispatch_stub_582): popq %rbp popq %rsi popq %rdi - movq 4656(%rax), %r11 + movq 4688(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4656(%rax), %r11 + movq 4688(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21969,19 +22117,19 @@ GL_PREFIX(_dispatch_stub_582): popq %rbp popq %rsi popq %rdi - movq 4656(%rax), %r11 + movq 4688(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_582), .-GL_PREFIX(_dispatch_stub_582) + .size GL_PREFIX(_dispatch_stub_586), .-GL_PREFIX(_dispatch_stub_586) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_583) - .type GL_PREFIX(_dispatch_stub_583), @function - HIDDEN(GL_PREFIX(_dispatch_stub_583)) -GL_PREFIX(_dispatch_stub_583): + .globl GL_PREFIX(_dispatch_stub_587) + .type GL_PREFIX(_dispatch_stub_587), @function + HIDDEN(GL_PREFIX(_dispatch_stub_587)) +GL_PREFIX(_dispatch_stub_587): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4664(%rax), %r11 + movq 4696(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21991,13 +22139,13 @@ GL_PREFIX(_dispatch_stub_583): popq %rbp popq %rsi popq %rdi - movq 4664(%rax), %r11 + movq 4696(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4664(%rax), %r11 + movq 4696(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22007,10 +22155,10 @@ GL_PREFIX(_dispatch_stub_583): popq %rbp popq %rsi popq %rdi - movq 4664(%rax), %r11 + movq 4696(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_583), .-GL_PREFIX(_dispatch_stub_583) + .size GL_PREFIX(_dispatch_stub_587), .-GL_PREFIX(_dispatch_stub_587) .p2align 4,,15 .globl GL_PREFIX(SecondaryColor3bEXT) @@ -22018,7 +22166,7 @@ GL_PREFIX(_dispatch_stub_583): GL_PREFIX(SecondaryColor3bEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4672(%rax), %r11 + movq 4704(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22028,13 +22176,13 @@ GL_PREFIX(SecondaryColor3bEXT): popq %rdx popq %rsi popq %rdi - movq 4672(%rax), %r11 + movq 4704(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4672(%rax), %r11 + movq 4704(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22044,7 +22192,7 @@ GL_PREFIX(SecondaryColor3bEXT): popq %rdx popq %rsi popq %rdi - movq 4672(%rax), %r11 + movq 4704(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3bEXT), .-GL_PREFIX(SecondaryColor3bEXT) @@ -22055,25 +22203,25 @@ GL_PREFIX(SecondaryColor3bEXT): GL_PREFIX(SecondaryColor3bvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4680(%rax), %r11 + movq 4712(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4680(%rax), %r11 + movq 4712(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4680(%rax), %r11 + movq 4712(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4680(%rax), %r11 + movq 4712(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3bvEXT), .-GL_PREFIX(SecondaryColor3bvEXT) @@ -22084,7 +22232,7 @@ GL_PREFIX(SecondaryColor3bvEXT): GL_PREFIX(SecondaryColor3dEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4688(%rax), %r11 + movq 4720(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -22096,13 +22244,13 @@ GL_PREFIX(SecondaryColor3dEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4688(%rax), %r11 + movq 4720(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4688(%rax), %r11 + movq 4720(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -22114,7 +22262,7 @@ GL_PREFIX(SecondaryColor3dEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4688(%rax), %r11 + movq 4720(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3dEXT), .-GL_PREFIX(SecondaryColor3dEXT) @@ -22125,25 +22273,25 @@ GL_PREFIX(SecondaryColor3dEXT): GL_PREFIX(SecondaryColor3dvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4696(%rax), %r11 + movq 4728(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4696(%rax), %r11 + movq 4728(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4696(%rax), %r11 + movq 4728(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4696(%rax), %r11 + movq 4728(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3dvEXT), .-GL_PREFIX(SecondaryColor3dvEXT) @@ -22154,7 +22302,7 @@ GL_PREFIX(SecondaryColor3dvEXT): GL_PREFIX(SecondaryColor3fEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4704(%rax), %r11 + movq 4736(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -22166,13 +22314,13 @@ GL_PREFIX(SecondaryColor3fEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4704(%rax), %r11 + movq 4736(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4704(%rax), %r11 + movq 4736(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -22184,7 +22332,7 @@ GL_PREFIX(SecondaryColor3fEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4704(%rax), %r11 + movq 4736(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3fEXT), .-GL_PREFIX(SecondaryColor3fEXT) @@ -22195,25 +22343,25 @@ GL_PREFIX(SecondaryColor3fEXT): GL_PREFIX(SecondaryColor3fvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4712(%rax), %r11 + movq 4744(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4712(%rax), %r11 + movq 4744(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4712(%rax), %r11 + movq 4744(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4712(%rax), %r11 + movq 4744(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3fvEXT), .-GL_PREFIX(SecondaryColor3fvEXT) @@ -22224,7 +22372,7 @@ GL_PREFIX(SecondaryColor3fvEXT): GL_PREFIX(SecondaryColor3iEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4720(%rax), %r11 + movq 4752(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22234,13 +22382,13 @@ GL_PREFIX(SecondaryColor3iEXT): popq %rdx popq %rsi popq %rdi - movq 4720(%rax), %r11 + movq 4752(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4720(%rax), %r11 + movq 4752(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22250,7 +22398,7 @@ GL_PREFIX(SecondaryColor3iEXT): popq %rdx popq %rsi popq %rdi - movq 4720(%rax), %r11 + movq 4752(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3iEXT), .-GL_PREFIX(SecondaryColor3iEXT) @@ -22261,25 +22409,25 @@ GL_PREFIX(SecondaryColor3iEXT): GL_PREFIX(SecondaryColor3ivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4728(%rax), %r11 + movq 4760(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4728(%rax), %r11 + movq 4760(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4728(%rax), %r11 + movq 4760(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4728(%rax), %r11 + movq 4760(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3ivEXT), .-GL_PREFIX(SecondaryColor3ivEXT) @@ -22290,7 +22438,7 @@ GL_PREFIX(SecondaryColor3ivEXT): GL_PREFIX(SecondaryColor3sEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4736(%rax), %r11 + movq 4768(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22300,13 +22448,13 @@ GL_PREFIX(SecondaryColor3sEXT): popq %rdx popq %rsi popq %rdi - movq 4736(%rax), %r11 + movq 4768(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4736(%rax), %r11 + movq 4768(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22316,7 +22464,7 @@ GL_PREFIX(SecondaryColor3sEXT): popq %rdx popq %rsi popq %rdi - movq 4736(%rax), %r11 + movq 4768(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3sEXT), .-GL_PREFIX(SecondaryColor3sEXT) @@ -22327,25 +22475,25 @@ GL_PREFIX(SecondaryColor3sEXT): GL_PREFIX(SecondaryColor3svEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4744(%rax), %r11 + movq 4776(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4744(%rax), %r11 + movq 4776(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4744(%rax), %r11 + movq 4776(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4744(%rax), %r11 + movq 4776(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3svEXT), .-GL_PREFIX(SecondaryColor3svEXT) @@ -22356,7 +22504,7 @@ GL_PREFIX(SecondaryColor3svEXT): GL_PREFIX(SecondaryColor3ubEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4752(%rax), %r11 + movq 4784(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22366,13 +22514,13 @@ GL_PREFIX(SecondaryColor3ubEXT): popq %rdx popq %rsi popq %rdi - movq 4752(%rax), %r11 + movq 4784(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4752(%rax), %r11 + movq 4784(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22382,7 +22530,7 @@ GL_PREFIX(SecondaryColor3ubEXT): popq %rdx popq %rsi popq %rdi - movq 4752(%rax), %r11 + movq 4784(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3ubEXT), .-GL_PREFIX(SecondaryColor3ubEXT) @@ -22393,25 +22541,25 @@ GL_PREFIX(SecondaryColor3ubEXT): GL_PREFIX(SecondaryColor3ubvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4760(%rax), %r11 + movq 4792(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4760(%rax), %r11 + movq 4792(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4760(%rax), %r11 + movq 4792(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4760(%rax), %r11 + movq 4792(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3ubvEXT), .-GL_PREFIX(SecondaryColor3ubvEXT) @@ -22422,7 +22570,7 @@ GL_PREFIX(SecondaryColor3ubvEXT): GL_PREFIX(SecondaryColor3uiEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4768(%rax), %r11 + movq 4800(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22432,13 +22580,13 @@ GL_PREFIX(SecondaryColor3uiEXT): popq %rdx popq %rsi popq %rdi - movq 4768(%rax), %r11 + movq 4800(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4768(%rax), %r11 + movq 4800(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22448,7 +22596,7 @@ GL_PREFIX(SecondaryColor3uiEXT): popq %rdx popq %rsi popq %rdi - movq 4768(%rax), %r11 + movq 4800(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3uiEXT), .-GL_PREFIX(SecondaryColor3uiEXT) @@ -22459,25 +22607,25 @@ GL_PREFIX(SecondaryColor3uiEXT): GL_PREFIX(SecondaryColor3uivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4776(%rax), %r11 + movq 4808(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4776(%rax), %r11 + movq 4808(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4776(%rax), %r11 + movq 4808(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4776(%rax), %r11 + movq 4808(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3uivEXT), .-GL_PREFIX(SecondaryColor3uivEXT) @@ -22488,7 +22636,7 @@ GL_PREFIX(SecondaryColor3uivEXT): GL_PREFIX(SecondaryColor3usEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4784(%rax), %r11 + movq 4816(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22498,13 +22646,13 @@ GL_PREFIX(SecondaryColor3usEXT): popq %rdx popq %rsi popq %rdi - movq 4784(%rax), %r11 + movq 4816(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4784(%rax), %r11 + movq 4816(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22514,7 +22662,7 @@ GL_PREFIX(SecondaryColor3usEXT): popq %rdx popq %rsi popq %rdi - movq 4784(%rax), %r11 + movq 4816(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3usEXT), .-GL_PREFIX(SecondaryColor3usEXT) @@ -22525,25 +22673,25 @@ GL_PREFIX(SecondaryColor3usEXT): GL_PREFIX(SecondaryColor3usvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4792(%rax), %r11 + movq 4824(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4792(%rax), %r11 + movq 4824(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4792(%rax), %r11 + movq 4824(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4792(%rax), %r11 + movq 4824(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3usvEXT), .-GL_PREFIX(SecondaryColor3usvEXT) @@ -22554,7 +22702,7 @@ GL_PREFIX(SecondaryColor3usvEXT): GL_PREFIX(SecondaryColorPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4800(%rax), %r11 + movq 4832(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22568,13 +22716,13 @@ GL_PREFIX(SecondaryColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4800(%rax), %r11 + movq 4832(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4800(%rax), %r11 + movq 4832(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22588,7 +22736,7 @@ GL_PREFIX(SecondaryColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4800(%rax), %r11 + movq 4832(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColorPointerEXT), .-GL_PREFIX(SecondaryColorPointerEXT) @@ -22599,7 +22747,7 @@ GL_PREFIX(SecondaryColorPointerEXT): GL_PREFIX(MultiDrawArraysEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4808(%rax), %r11 + movq 4840(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22613,13 +22761,13 @@ GL_PREFIX(MultiDrawArraysEXT): popq %rdx popq %rsi popq %rdi - movq 4808(%rax), %r11 + movq 4840(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4808(%rax), %r11 + movq 4840(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22633,7 +22781,7 @@ GL_PREFIX(MultiDrawArraysEXT): popq %rdx popq %rsi popq %rdi - movq 4808(%rax), %r11 + movq 4840(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(MultiDrawArraysEXT), .-GL_PREFIX(MultiDrawArraysEXT) @@ -22644,7 +22792,7 @@ GL_PREFIX(MultiDrawArraysEXT): GL_PREFIX(MultiDrawElementsEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4816(%rax), %r11 + movq 4848(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22658,13 +22806,13 @@ GL_PREFIX(MultiDrawElementsEXT): popq %rdx popq %rsi popq %rdi - movq 4816(%rax), %r11 + movq 4848(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4816(%rax), %r11 + movq 4848(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22678,7 +22826,7 @@ GL_PREFIX(MultiDrawElementsEXT): popq %rdx popq %rsi popq %rdi - movq 4816(%rax), %r11 + movq 4848(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(MultiDrawElementsEXT), .-GL_PREFIX(MultiDrawElementsEXT) @@ -22689,7 +22837,7 @@ GL_PREFIX(MultiDrawElementsEXT): GL_PREFIX(FogCoordPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4824(%rax), %r11 + movq 4856(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22699,13 +22847,13 @@ GL_PREFIX(FogCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4824(%rax), %r11 + movq 4856(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4824(%rax), %r11 + movq 4856(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22715,7 +22863,7 @@ GL_PREFIX(FogCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4824(%rax), %r11 + movq 4856(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoordPointerEXT), .-GL_PREFIX(FogCoordPointerEXT) @@ -22726,7 +22874,7 @@ GL_PREFIX(FogCoordPointerEXT): GL_PREFIX(FogCoorddEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4832(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $8, %rsp @@ -22734,13 +22882,13 @@ GL_PREFIX(FogCoorddEXT): call _x86_64_get_dispatch@PLT movq (%rsp), %xmm0 addq $8, %rsp - movq 4832(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4832(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 1: subq $8, %rsp @@ -22748,7 +22896,7 @@ GL_PREFIX(FogCoorddEXT): call _glapi_get_dispatch movq (%rsp), %xmm0 addq $8, %rsp - movq 4832(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoorddEXT), .-GL_PREFIX(FogCoorddEXT) @@ -22759,25 +22907,25 @@ GL_PREFIX(FogCoorddEXT): GL_PREFIX(FogCoorddvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4840(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4840(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4840(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4840(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoorddvEXT), .-GL_PREFIX(FogCoorddvEXT) @@ -22788,7 +22936,7 @@ GL_PREFIX(FogCoorddvEXT): GL_PREFIX(FogCoordfEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4848(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $8, %rsp @@ -22796,13 +22944,13 @@ GL_PREFIX(FogCoordfEXT): call _x86_64_get_dispatch@PLT movq (%rsp), %xmm0 addq $8, %rsp - movq 4848(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4848(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 1: subq $8, %rsp @@ -22810,7 +22958,7 @@ GL_PREFIX(FogCoordfEXT): call _glapi_get_dispatch movq (%rsp), %xmm0 addq $8, %rsp - movq 4848(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoordfEXT), .-GL_PREFIX(FogCoordfEXT) @@ -22821,58 +22969,58 @@ GL_PREFIX(FogCoordfEXT): GL_PREFIX(FogCoordfvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4856(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4856(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4856(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4856(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoordfvEXT), .-GL_PREFIX(FogCoordfvEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_608) - .type GL_PREFIX(_dispatch_stub_608), @function - HIDDEN(GL_PREFIX(_dispatch_stub_608)) -GL_PREFIX(_dispatch_stub_608): + .globl GL_PREFIX(_dispatch_stub_612) + .type GL_PREFIX(_dispatch_stub_612), @function + HIDDEN(GL_PREFIX(_dispatch_stub_612)) +GL_PREFIX(_dispatch_stub_612): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4864(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4864(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4864(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4864(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_608), .-GL_PREFIX(_dispatch_stub_608) + .size GL_PREFIX(_dispatch_stub_612), .-GL_PREFIX(_dispatch_stub_612) .p2align 4,,15 .globl GL_PREFIX(BlendFuncSeparateEXT) @@ -22880,7 +23028,7 @@ GL_PREFIX(_dispatch_stub_608): GL_PREFIX(BlendFuncSeparateEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4872(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22894,13 +23042,13 @@ GL_PREFIX(BlendFuncSeparateEXT): popq %rdx popq %rsi popq %rdi - movq 4872(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4872(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22914,7 +23062,7 @@ GL_PREFIX(BlendFuncSeparateEXT): popq %rdx popq %rsi popq %rdi - movq 4872(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BlendFuncSeparateEXT), .-GL_PREFIX(BlendFuncSeparateEXT) @@ -22925,25 +23073,25 @@ GL_PREFIX(BlendFuncSeparateEXT): GL_PREFIX(FlushVertexArrayRangeNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4880(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 4880(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4880(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 4880(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FlushVertexArrayRangeNV), .-GL_PREFIX(FlushVertexArrayRangeNV) @@ -22954,7 +23102,7 @@ GL_PREFIX(FlushVertexArrayRangeNV): GL_PREFIX(VertexArrayRangeNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4888(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22964,13 +23112,13 @@ GL_PREFIX(VertexArrayRangeNV): popq %rbp popq %rsi popq %rdi - movq 4888(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4888(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22980,7 +23128,7 @@ GL_PREFIX(VertexArrayRangeNV): popq %rbp popq %rsi popq %rdi - movq 4888(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexArrayRangeNV), .-GL_PREFIX(VertexArrayRangeNV) @@ -22991,7 +23139,7 @@ GL_PREFIX(VertexArrayRangeNV): GL_PREFIX(CombinerInputNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4896(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23009,13 +23157,13 @@ GL_PREFIX(CombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 4896(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4896(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23033,7 +23181,7 @@ GL_PREFIX(CombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 4896(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerInputNV), .-GL_PREFIX(CombinerInputNV) @@ -23044,7 +23192,7 @@ GL_PREFIX(CombinerInputNV): GL_PREFIX(CombinerOutputNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4904(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23062,13 +23210,13 @@ GL_PREFIX(CombinerOutputNV): popq %rdx popq %rsi popq %rdi - movq 4904(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4904(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23086,7 +23234,7 @@ GL_PREFIX(CombinerOutputNV): popq %rdx popq %rsi popq %rdi - movq 4904(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerOutputNV), .-GL_PREFIX(CombinerOutputNV) @@ -23097,7 +23245,7 @@ GL_PREFIX(CombinerOutputNV): GL_PREFIX(CombinerParameterfNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4912(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23107,13 +23255,13 @@ GL_PREFIX(CombinerParameterfNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4912(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4912(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23123,7 +23271,7 @@ GL_PREFIX(CombinerParameterfNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4912(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameterfNV), .-GL_PREFIX(CombinerParameterfNV) @@ -23134,7 +23282,7 @@ GL_PREFIX(CombinerParameterfNV): GL_PREFIX(CombinerParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4920(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23144,13 +23292,13 @@ GL_PREFIX(CombinerParameterfvNV): popq %rbp popq %rsi popq %rdi - movq 4920(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4920(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23160,7 +23308,7 @@ GL_PREFIX(CombinerParameterfvNV): popq %rbp popq %rsi popq %rdi - movq 4920(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameterfvNV), .-GL_PREFIX(CombinerParameterfvNV) @@ -23171,7 +23319,7 @@ GL_PREFIX(CombinerParameterfvNV): GL_PREFIX(CombinerParameteriNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4928(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23181,13 +23329,13 @@ GL_PREFIX(CombinerParameteriNV): popq %rbp popq %rsi popq %rdi - movq 4928(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4928(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23197,7 +23345,7 @@ GL_PREFIX(CombinerParameteriNV): popq %rbp popq %rsi popq %rdi - movq 4928(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameteriNV), .-GL_PREFIX(CombinerParameteriNV) @@ -23208,7 +23356,7 @@ GL_PREFIX(CombinerParameteriNV): GL_PREFIX(CombinerParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4936(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23218,13 +23366,13 @@ GL_PREFIX(CombinerParameterivNV): popq %rbp popq %rsi popq %rdi - movq 4936(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4936(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23234,7 +23382,7 @@ GL_PREFIX(CombinerParameterivNV): popq %rbp popq %rsi popq %rdi - movq 4936(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameterivNV), .-GL_PREFIX(CombinerParameterivNV) @@ -23245,7 +23393,7 @@ GL_PREFIX(CombinerParameterivNV): GL_PREFIX(FinalCombinerInputNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4944(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23259,13 +23407,13 @@ GL_PREFIX(FinalCombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 4944(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4944(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23279,7 +23427,7 @@ GL_PREFIX(FinalCombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 4944(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FinalCombinerInputNV), .-GL_PREFIX(FinalCombinerInputNV) @@ -23290,7 +23438,7 @@ GL_PREFIX(FinalCombinerInputNV): GL_PREFIX(GetCombinerInputParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4952(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23304,13 +23452,13 @@ GL_PREFIX(GetCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4952(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4952(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23324,7 +23472,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4952(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerInputParameterfvNV), .-GL_PREFIX(GetCombinerInputParameterfvNV) @@ -23335,7 +23483,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV): GL_PREFIX(GetCombinerInputParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4960(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23349,13 +23497,13 @@ GL_PREFIX(GetCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4960(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4960(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23369,7 +23517,7 @@ GL_PREFIX(GetCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4960(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerInputParameterivNV), .-GL_PREFIX(GetCombinerInputParameterivNV) @@ -23380,7 +23528,7 @@ GL_PREFIX(GetCombinerInputParameterivNV): GL_PREFIX(GetCombinerOutputParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4968(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23394,13 +23542,13 @@ GL_PREFIX(GetCombinerOutputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4968(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4968(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23414,7 +23562,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4968(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerOutputParameterfvNV), .-GL_PREFIX(GetCombinerOutputParameterfvNV) @@ -23425,7 +23573,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV): GL_PREFIX(GetCombinerOutputParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4976(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23439,13 +23587,13 @@ GL_PREFIX(GetCombinerOutputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4976(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4976(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23459,7 +23607,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4976(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerOutputParameterivNV), .-GL_PREFIX(GetCombinerOutputParameterivNV) @@ -23470,7 +23618,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV): GL_PREFIX(GetFinalCombinerInputParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4984(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23480,13 +23628,13 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4984(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4984(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23496,7 +23644,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4984(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetFinalCombinerInputParameterfvNV), .-GL_PREFIX(GetFinalCombinerInputParameterfvNV) @@ -23507,7 +23655,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV): GL_PREFIX(GetFinalCombinerInputParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4992(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23517,13 +23665,13 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4992(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4992(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23533,7 +23681,7 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4992(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetFinalCombinerInputParameterivNV), .-GL_PREFIX(GetFinalCombinerInputParameterivNV) @@ -23544,25 +23692,25 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): GL_PREFIX(ResizeBuffersMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5000(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 5000(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5000(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 5000(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ResizeBuffersMESA), .-GL_PREFIX(ResizeBuffersMESA) @@ -23573,7 +23721,7 @@ GL_PREFIX(ResizeBuffersMESA): GL_PREFIX(WindowPos2dMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5008(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23583,13 +23731,13 @@ GL_PREFIX(WindowPos2dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5008(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5008(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23599,7 +23747,7 @@ GL_PREFIX(WindowPos2dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5008(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2dMESA), .-GL_PREFIX(WindowPos2dMESA) @@ -23610,25 +23758,25 @@ GL_PREFIX(WindowPos2dMESA): GL_PREFIX(WindowPos2dvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5016(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5016(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5016(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5016(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2dvMESA), .-GL_PREFIX(WindowPos2dvMESA) @@ -23639,7 +23787,7 @@ GL_PREFIX(WindowPos2dvMESA): GL_PREFIX(WindowPos2fMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5024(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23649,13 +23797,13 @@ GL_PREFIX(WindowPos2fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5024(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5024(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23665,7 +23813,7 @@ GL_PREFIX(WindowPos2fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5024(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2fMESA), .-GL_PREFIX(WindowPos2fMESA) @@ -23676,25 +23824,25 @@ GL_PREFIX(WindowPos2fMESA): GL_PREFIX(WindowPos2fvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5032(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5032(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5032(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5032(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2fvMESA), .-GL_PREFIX(WindowPos2fvMESA) @@ -23705,7 +23853,7 @@ GL_PREFIX(WindowPos2fvMESA): GL_PREFIX(WindowPos2iMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5040(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23715,13 +23863,13 @@ GL_PREFIX(WindowPos2iMESA): popq %rbp popq %rsi popq %rdi - movq 5040(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5040(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23731,7 +23879,7 @@ GL_PREFIX(WindowPos2iMESA): popq %rbp popq %rsi popq %rdi - movq 5040(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2iMESA), .-GL_PREFIX(WindowPos2iMESA) @@ -23742,25 +23890,25 @@ GL_PREFIX(WindowPos2iMESA): GL_PREFIX(WindowPos2ivMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5048(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5048(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5048(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5048(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2ivMESA), .-GL_PREFIX(WindowPos2ivMESA) @@ -23771,7 +23919,7 @@ GL_PREFIX(WindowPos2ivMESA): GL_PREFIX(WindowPos2sMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5056(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23781,13 +23929,13 @@ GL_PREFIX(WindowPos2sMESA): popq %rbp popq %rsi popq %rdi - movq 5056(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5056(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23797,7 +23945,7 @@ GL_PREFIX(WindowPos2sMESA): popq %rbp popq %rsi popq %rdi - movq 5056(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2sMESA), .-GL_PREFIX(WindowPos2sMESA) @@ -23808,25 +23956,25 @@ GL_PREFIX(WindowPos2sMESA): GL_PREFIX(WindowPos2svMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5064(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5064(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5064(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5064(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2svMESA), .-GL_PREFIX(WindowPos2svMESA) @@ -23837,7 +23985,7 @@ GL_PREFIX(WindowPos2svMESA): GL_PREFIX(WindowPos3dMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5072(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23849,13 +23997,13 @@ GL_PREFIX(WindowPos3dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5072(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5072(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23867,7 +24015,7 @@ GL_PREFIX(WindowPos3dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5072(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3dMESA), .-GL_PREFIX(WindowPos3dMESA) @@ -23878,25 +24026,25 @@ GL_PREFIX(WindowPos3dMESA): GL_PREFIX(WindowPos3dvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5080(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5080(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5080(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5080(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3dvMESA), .-GL_PREFIX(WindowPos3dvMESA) @@ -23907,7 +24055,7 @@ GL_PREFIX(WindowPos3dvMESA): GL_PREFIX(WindowPos3fMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5088(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23919,13 +24067,13 @@ GL_PREFIX(WindowPos3fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5088(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5088(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23937,7 +24085,7 @@ GL_PREFIX(WindowPos3fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5088(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3fMESA), .-GL_PREFIX(WindowPos3fMESA) @@ -23948,25 +24096,25 @@ GL_PREFIX(WindowPos3fMESA): GL_PREFIX(WindowPos3fvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5096(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5096(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5096(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5096(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3fvMESA), .-GL_PREFIX(WindowPos3fvMESA) @@ -23977,7 +24125,7 @@ GL_PREFIX(WindowPos3fvMESA): GL_PREFIX(WindowPos3iMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5104(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23987,13 +24135,13 @@ GL_PREFIX(WindowPos3iMESA): popq %rdx popq %rsi popq %rdi - movq 5104(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5104(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24003,7 +24151,7 @@ GL_PREFIX(WindowPos3iMESA): popq %rdx popq %rsi popq %rdi - movq 5104(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3iMESA), .-GL_PREFIX(WindowPos3iMESA) @@ -24014,25 +24162,25 @@ GL_PREFIX(WindowPos3iMESA): GL_PREFIX(WindowPos3ivMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5112(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5112(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5112(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5112(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3ivMESA), .-GL_PREFIX(WindowPos3ivMESA) @@ -24043,7 +24191,7 @@ GL_PREFIX(WindowPos3ivMESA): GL_PREFIX(WindowPos3sMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5120(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24053,13 +24201,13 @@ GL_PREFIX(WindowPos3sMESA): popq %rdx popq %rsi popq %rdi - movq 5120(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5120(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24069,7 +24217,7 @@ GL_PREFIX(WindowPos3sMESA): popq %rdx popq %rsi popq %rdi - movq 5120(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3sMESA), .-GL_PREFIX(WindowPos3sMESA) @@ -24080,25 +24228,25 @@ GL_PREFIX(WindowPos3sMESA): GL_PREFIX(WindowPos3svMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5128(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5128(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5128(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5128(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3svMESA), .-GL_PREFIX(WindowPos3svMESA) @@ -24109,7 +24257,7 @@ GL_PREFIX(WindowPos3svMESA): GL_PREFIX(WindowPos4dMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5136(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -24123,13 +24271,13 @@ GL_PREFIX(WindowPos4dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5136(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5136(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -24143,7 +24291,7 @@ GL_PREFIX(WindowPos4dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5136(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4dMESA), .-GL_PREFIX(WindowPos4dMESA) @@ -24154,25 +24302,25 @@ GL_PREFIX(WindowPos4dMESA): GL_PREFIX(WindowPos4dvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5144(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5144(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5144(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5144(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4dvMESA), .-GL_PREFIX(WindowPos4dvMESA) @@ -24183,7 +24331,7 @@ GL_PREFIX(WindowPos4dvMESA): GL_PREFIX(WindowPos4fMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5152(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -24197,13 +24345,13 @@ GL_PREFIX(WindowPos4fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5152(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5152(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -24217,7 +24365,7 @@ GL_PREFIX(WindowPos4fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5152(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4fMESA), .-GL_PREFIX(WindowPos4fMESA) @@ -24228,25 +24376,25 @@ GL_PREFIX(WindowPos4fMESA): GL_PREFIX(WindowPos4fvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5160(%rax), %r11 + movq 5192(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5160(%rax), %r11 + movq 5192(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5160(%rax), %r11 + movq 5192(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5160(%rax), %r11 + movq 5192(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4fvMESA), .-GL_PREFIX(WindowPos4fvMESA) @@ -24257,7 +24405,7 @@ GL_PREFIX(WindowPos4fvMESA): GL_PREFIX(WindowPos4iMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5168(%rax), %r11 + movq 5200(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24271,13 +24419,13 @@ GL_PREFIX(WindowPos4iMESA): popq %rdx popq %rsi popq %rdi - movq 5168(%rax), %r11 + movq 5200(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5168(%rax), %r11 + movq 5200(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24291,7 +24439,7 @@ GL_PREFIX(WindowPos4iMESA): popq %rdx popq %rsi popq %rdi - movq 5168(%rax), %r11 + movq 5200(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4iMESA), .-GL_PREFIX(WindowPos4iMESA) @@ -24302,25 +24450,25 @@ GL_PREFIX(WindowPos4iMESA): GL_PREFIX(WindowPos4ivMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5176(%rax), %r11 + movq 5208(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5176(%rax), %r11 + movq 5208(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5176(%rax), %r11 + movq 5208(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5176(%rax), %r11 + movq 5208(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4ivMESA), .-GL_PREFIX(WindowPos4ivMESA) @@ -24331,7 +24479,7 @@ GL_PREFIX(WindowPos4ivMESA): GL_PREFIX(WindowPos4sMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5184(%rax), %r11 + movq 5216(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24345,13 +24493,13 @@ GL_PREFIX(WindowPos4sMESA): popq %rdx popq %rsi popq %rdi - movq 5184(%rax), %r11 + movq 5216(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5184(%rax), %r11 + movq 5216(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24365,7 +24513,7 @@ GL_PREFIX(WindowPos4sMESA): popq %rdx popq %rsi popq %rdi - movq 5184(%rax), %r11 + movq 5216(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4sMESA), .-GL_PREFIX(WindowPos4sMESA) @@ -24376,37 +24524,37 @@ GL_PREFIX(WindowPos4sMESA): GL_PREFIX(WindowPos4svMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5192(%rax), %r11 + movq 5224(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5192(%rax), %r11 + movq 5224(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5192(%rax), %r11 + movq 5224(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5192(%rax), %r11 + movq 5224(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4svMESA), .-GL_PREFIX(WindowPos4svMESA) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_650) - .type GL_PREFIX(_dispatch_stub_650), @function - HIDDEN(GL_PREFIX(_dispatch_stub_650)) -GL_PREFIX(_dispatch_stub_650): + .globl GL_PREFIX(_dispatch_stub_654) + .type GL_PREFIX(_dispatch_stub_654), @function + HIDDEN(GL_PREFIX(_dispatch_stub_654)) +GL_PREFIX(_dispatch_stub_654): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5200(%rax), %r11 + movq 5232(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24420,13 +24568,13 @@ GL_PREFIX(_dispatch_stub_650): popq %rdx popq %rsi popq %rdi - movq 5200(%rax), %r11 + movq 5232(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5200(%rax), %r11 + movq 5232(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24440,19 +24588,19 @@ GL_PREFIX(_dispatch_stub_650): popq %rdx popq %rsi popq %rdi - movq 5200(%rax), %r11 + movq 5232(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_650), .-GL_PREFIX(_dispatch_stub_650) + .size GL_PREFIX(_dispatch_stub_654), .-GL_PREFIX(_dispatch_stub_654) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_651) - .type GL_PREFIX(_dispatch_stub_651), @function - HIDDEN(GL_PREFIX(_dispatch_stub_651)) -GL_PREFIX(_dispatch_stub_651): + .globl GL_PREFIX(_dispatch_stub_655) + .type GL_PREFIX(_dispatch_stub_655), @function + HIDDEN(GL_PREFIX(_dispatch_stub_655)) +GL_PREFIX(_dispatch_stub_655): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5208(%rax), %r11 + movq 5240(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24470,13 +24618,13 @@ GL_PREFIX(_dispatch_stub_651): popq %rdx popq %rsi popq %rdi - movq 5208(%rax), %r11 + movq 5240(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5208(%rax), %r11 + movq 5240(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24494,19 +24642,19 @@ GL_PREFIX(_dispatch_stub_651): popq %rdx popq %rsi popq %rdi - movq 5208(%rax), %r11 + movq 5240(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_651), .-GL_PREFIX(_dispatch_stub_651) + .size GL_PREFIX(_dispatch_stub_655), .-GL_PREFIX(_dispatch_stub_655) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_652) - .type GL_PREFIX(_dispatch_stub_652), @function - HIDDEN(GL_PREFIX(_dispatch_stub_652)) -GL_PREFIX(_dispatch_stub_652): + .globl GL_PREFIX(_dispatch_stub_656) + .type GL_PREFIX(_dispatch_stub_656), @function + HIDDEN(GL_PREFIX(_dispatch_stub_656)) +GL_PREFIX(_dispatch_stub_656): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5216(%rax), %r11 + movq 5248(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24516,13 +24664,13 @@ GL_PREFIX(_dispatch_stub_652): popq %rbp popq %rsi popq %rdi - movq 5216(%rax), %r11 + movq 5248(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5216(%rax), %r11 + movq 5248(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24532,49 +24680,49 @@ GL_PREFIX(_dispatch_stub_652): popq %rbp popq %rsi popq %rdi - movq 5216(%rax), %r11 + movq 5248(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_652), .-GL_PREFIX(_dispatch_stub_652) + .size GL_PREFIX(_dispatch_stub_656), .-GL_PREFIX(_dispatch_stub_656) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_653) - .type GL_PREFIX(_dispatch_stub_653), @function - HIDDEN(GL_PREFIX(_dispatch_stub_653)) -GL_PREFIX(_dispatch_stub_653): + .globl GL_PREFIX(_dispatch_stub_657) + .type GL_PREFIX(_dispatch_stub_657), @function + HIDDEN(GL_PREFIX(_dispatch_stub_657)) +GL_PREFIX(_dispatch_stub_657): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5224(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5224(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5224(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5224(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_653), .-GL_PREFIX(_dispatch_stub_653) + .size GL_PREFIX(_dispatch_stub_657), .-GL_PREFIX(_dispatch_stub_657) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_654) - .type GL_PREFIX(_dispatch_stub_654), @function - HIDDEN(GL_PREFIX(_dispatch_stub_654)) -GL_PREFIX(_dispatch_stub_654): + .globl GL_PREFIX(_dispatch_stub_658) + .type GL_PREFIX(_dispatch_stub_658), @function + HIDDEN(GL_PREFIX(_dispatch_stub_658)) +GL_PREFIX(_dispatch_stub_658): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5232(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24584,13 +24732,13 @@ GL_PREFIX(_dispatch_stub_654): popq %rbp popq %rsi popq %rdi - movq 5232(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5232(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24600,19 +24748,19 @@ GL_PREFIX(_dispatch_stub_654): popq %rbp popq %rsi popq %rdi - movq 5232(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_654), .-GL_PREFIX(_dispatch_stub_654) + .size GL_PREFIX(_dispatch_stub_658), .-GL_PREFIX(_dispatch_stub_658) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_655) - .type GL_PREFIX(_dispatch_stub_655), @function - HIDDEN(GL_PREFIX(_dispatch_stub_655)) -GL_PREFIX(_dispatch_stub_655): + .globl GL_PREFIX(_dispatch_stub_659) + .type GL_PREFIX(_dispatch_stub_659), @function + HIDDEN(GL_PREFIX(_dispatch_stub_659)) +GL_PREFIX(_dispatch_stub_659): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5240(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24622,13 +24770,13 @@ GL_PREFIX(_dispatch_stub_655): popq %rdx popq %rsi popq %rdi - movq 5240(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5240(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24638,49 +24786,49 @@ GL_PREFIX(_dispatch_stub_655): popq %rdx popq %rsi popq %rdi - movq 5240(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_655), .-GL_PREFIX(_dispatch_stub_655) + .size GL_PREFIX(_dispatch_stub_659), .-GL_PREFIX(_dispatch_stub_659) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_656) - .type GL_PREFIX(_dispatch_stub_656), @function - HIDDEN(GL_PREFIX(_dispatch_stub_656)) -GL_PREFIX(_dispatch_stub_656): + .globl GL_PREFIX(_dispatch_stub_660) + .type GL_PREFIX(_dispatch_stub_660), @function + HIDDEN(GL_PREFIX(_dispatch_stub_660)) +GL_PREFIX(_dispatch_stub_660): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5248(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5248(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5248(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5248(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_656), .-GL_PREFIX(_dispatch_stub_656) + .size GL_PREFIX(_dispatch_stub_660), .-GL_PREFIX(_dispatch_stub_660) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_657) - .type GL_PREFIX(_dispatch_stub_657), @function - HIDDEN(GL_PREFIX(_dispatch_stub_657)) -GL_PREFIX(_dispatch_stub_657): + .globl GL_PREFIX(_dispatch_stub_661) + .type GL_PREFIX(_dispatch_stub_661), @function + HIDDEN(GL_PREFIX(_dispatch_stub_661)) +GL_PREFIX(_dispatch_stub_661): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5256(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24690,13 +24838,13 @@ GL_PREFIX(_dispatch_stub_657): popq %rbp popq %rsi popq %rdi - movq 5256(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5256(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24706,40 +24854,40 @@ GL_PREFIX(_dispatch_stub_657): popq %rbp popq %rsi popq %rdi - movq 5256(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_657), .-GL_PREFIX(_dispatch_stub_657) + .size GL_PREFIX(_dispatch_stub_661), .-GL_PREFIX(_dispatch_stub_661) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_658) - .type GL_PREFIX(_dispatch_stub_658), @function - HIDDEN(GL_PREFIX(_dispatch_stub_658)) -GL_PREFIX(_dispatch_stub_658): + .globl GL_PREFIX(_dispatch_stub_662) + .type GL_PREFIX(_dispatch_stub_662), @function + HIDDEN(GL_PREFIX(_dispatch_stub_662)) +GL_PREFIX(_dispatch_stub_662): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5264(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5264(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5264(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5264(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_658), .-GL_PREFIX(_dispatch_stub_658) + .size GL_PREFIX(_dispatch_stub_662), .-GL_PREFIX(_dispatch_stub_662) .p2align 4,,15 .globl GL_PREFIX(AreProgramsResidentNV) @@ -24747,7 +24895,7 @@ GL_PREFIX(_dispatch_stub_658): GL_PREFIX(AreProgramsResidentNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5272(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24757,13 +24905,13 @@ GL_PREFIX(AreProgramsResidentNV): popq %rdx popq %rsi popq %rdi - movq 5272(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5272(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24773,7 +24921,7 @@ GL_PREFIX(AreProgramsResidentNV): popq %rdx popq %rsi popq %rdi - movq 5272(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AreProgramsResidentNV), .-GL_PREFIX(AreProgramsResidentNV) @@ -24784,7 +24932,7 @@ GL_PREFIX(AreProgramsResidentNV): GL_PREFIX(BindProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5280(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24794,13 +24942,13 @@ GL_PREFIX(BindProgramNV): popq %rbp popq %rsi popq %rdi - movq 5280(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5280(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24810,7 +24958,7 @@ GL_PREFIX(BindProgramNV): popq %rbp popq %rsi popq %rdi - movq 5280(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindProgramNV), .-GL_PREFIX(BindProgramNV) @@ -24821,7 +24969,7 @@ GL_PREFIX(BindProgramNV): GL_PREFIX(DeleteProgramsNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5288(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24831,13 +24979,13 @@ GL_PREFIX(DeleteProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5288(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5288(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24847,7 +24995,7 @@ GL_PREFIX(DeleteProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5288(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteProgramsNV), .-GL_PREFIX(DeleteProgramsNV) @@ -24858,7 +25006,7 @@ GL_PREFIX(DeleteProgramsNV): GL_PREFIX(ExecuteProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5296(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24868,13 +25016,13 @@ GL_PREFIX(ExecuteProgramNV): popq %rdx popq %rsi popq %rdi - movq 5296(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5296(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24884,7 +25032,7 @@ GL_PREFIX(ExecuteProgramNV): popq %rdx popq %rsi popq %rdi - movq 5296(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ExecuteProgramNV), .-GL_PREFIX(ExecuteProgramNV) @@ -24895,7 +25043,7 @@ GL_PREFIX(ExecuteProgramNV): GL_PREFIX(GenProgramsNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5304(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24905,13 +25053,13 @@ GL_PREFIX(GenProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5304(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5304(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24921,7 +25069,7 @@ GL_PREFIX(GenProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5304(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenProgramsNV), .-GL_PREFIX(GenProgramsNV) @@ -24932,7 +25080,7 @@ GL_PREFIX(GenProgramsNV): GL_PREFIX(GetProgramParameterdvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5312(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24946,13 +25094,13 @@ GL_PREFIX(GetProgramParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5312(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5312(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24966,7 +25114,7 @@ GL_PREFIX(GetProgramParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5312(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramParameterdvNV), .-GL_PREFIX(GetProgramParameterdvNV) @@ -24977,7 +25125,7 @@ GL_PREFIX(GetProgramParameterdvNV): GL_PREFIX(GetProgramParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5320(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24991,13 +25139,13 @@ GL_PREFIX(GetProgramParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5320(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5320(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25011,7 +25159,7 @@ GL_PREFIX(GetProgramParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5320(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramParameterfvNV), .-GL_PREFIX(GetProgramParameterfvNV) @@ -25022,7 +25170,7 @@ GL_PREFIX(GetProgramParameterfvNV): GL_PREFIX(GetProgramStringNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5328(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25032,13 +25180,13 @@ GL_PREFIX(GetProgramStringNV): popq %rdx popq %rsi popq %rdi - movq 5328(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5328(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25048,7 +25196,7 @@ GL_PREFIX(GetProgramStringNV): popq %rdx popq %rsi popq %rdi - movq 5328(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramStringNV), .-GL_PREFIX(GetProgramStringNV) @@ -25059,7 +25207,7 @@ GL_PREFIX(GetProgramStringNV): GL_PREFIX(GetProgramivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5336(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25069,13 +25217,13 @@ GL_PREFIX(GetProgramivNV): popq %rdx popq %rsi popq %rdi - movq 5336(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5336(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25085,7 +25233,7 @@ GL_PREFIX(GetProgramivNV): popq %rdx popq %rsi popq %rdi - movq 5336(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramivNV), .-GL_PREFIX(GetProgramivNV) @@ -25096,7 +25244,7 @@ GL_PREFIX(GetProgramivNV): GL_PREFIX(GetTrackMatrixivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5344(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25110,13 +25258,13 @@ GL_PREFIX(GetTrackMatrixivNV): popq %rdx popq %rsi popq %rdi - movq 5344(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5344(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25130,7 +25278,7 @@ GL_PREFIX(GetTrackMatrixivNV): popq %rdx popq %rsi popq %rdi - movq 5344(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTrackMatrixivNV), .-GL_PREFIX(GetTrackMatrixivNV) @@ -25141,7 +25289,7 @@ GL_PREFIX(GetTrackMatrixivNV): GL_PREFIX(GetVertexAttribPointervNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5352(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25151,13 +25299,13 @@ GL_PREFIX(GetVertexAttribPointervNV): popq %rdx popq %rsi popq %rdi - movq 5352(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5352(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25167,7 +25315,7 @@ GL_PREFIX(GetVertexAttribPointervNV): popq %rdx popq %rsi popq %rdi - movq 5352(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribPointervNV), .-GL_PREFIX(GetVertexAttribPointervNV) @@ -25178,7 +25326,7 @@ GL_PREFIX(GetVertexAttribPointervNV): GL_PREFIX(GetVertexAttribdvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5360(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25188,13 +25336,13 @@ GL_PREFIX(GetVertexAttribdvNV): popq %rdx popq %rsi popq %rdi - movq 5360(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5360(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25204,7 +25352,7 @@ GL_PREFIX(GetVertexAttribdvNV): popq %rdx popq %rsi popq %rdi - movq 5360(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribdvNV), .-GL_PREFIX(GetVertexAttribdvNV) @@ -25215,7 +25363,7 @@ GL_PREFIX(GetVertexAttribdvNV): GL_PREFIX(GetVertexAttribfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5368(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25225,13 +25373,13 @@ GL_PREFIX(GetVertexAttribfvNV): popq %rdx popq %rsi popq %rdi - movq 5368(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5368(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25241,7 +25389,7 @@ GL_PREFIX(GetVertexAttribfvNV): popq %rdx popq %rsi popq %rdi - movq 5368(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribfvNV), .-GL_PREFIX(GetVertexAttribfvNV) @@ -25252,7 +25400,7 @@ GL_PREFIX(GetVertexAttribfvNV): GL_PREFIX(GetVertexAttribivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5376(%rax), %r11 + movq 5408(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25262,13 +25410,13 @@ GL_PREFIX(GetVertexAttribivNV): popq %rdx popq %rsi popq %rdi - movq 5376(%rax), %r11 + movq 5408(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5376(%rax), %r11 + movq 5408(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25278,7 +25426,7 @@ GL_PREFIX(GetVertexAttribivNV): popq %rdx popq %rsi popq %rdi - movq 5376(%rax), %r11 + movq 5408(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribivNV), .-GL_PREFIX(GetVertexAttribivNV) @@ -25289,25 +25437,25 @@ GL_PREFIX(GetVertexAttribivNV): GL_PREFIX(IsProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5384(%rax), %r11 + movq 5416(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5384(%rax), %r11 + movq 5416(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5384(%rax), %r11 + movq 5416(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5384(%rax), %r11 + movq 5416(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsProgramNV), .-GL_PREFIX(IsProgramNV) @@ -25318,7 +25466,7 @@ GL_PREFIX(IsProgramNV): GL_PREFIX(LoadProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5392(%rax), %r11 + movq 5424(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25332,13 +25480,13 @@ GL_PREFIX(LoadProgramNV): popq %rdx popq %rsi popq %rdi - movq 5392(%rax), %r11 + movq 5424(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5392(%rax), %r11 + movq 5424(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25352,7 +25500,7 @@ GL_PREFIX(LoadProgramNV): popq %rdx popq %rsi popq %rdi - movq 5392(%rax), %r11 + movq 5424(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(LoadProgramNV), .-GL_PREFIX(LoadProgramNV) @@ -25363,7 +25511,7 @@ GL_PREFIX(LoadProgramNV): GL_PREFIX(ProgramParameters4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5400(%rax), %r11 + movq 5432(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25377,13 +25525,13 @@ GL_PREFIX(ProgramParameters4dvNV): popq %rdx popq %rsi popq %rdi - movq 5400(%rax), %r11 + movq 5432(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5400(%rax), %r11 + movq 5432(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25397,7 +25545,7 @@ GL_PREFIX(ProgramParameters4dvNV): popq %rdx popq %rsi popq %rdi - movq 5400(%rax), %r11 + movq 5432(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramParameters4dvNV), .-GL_PREFIX(ProgramParameters4dvNV) @@ -25408,7 +25556,7 @@ GL_PREFIX(ProgramParameters4dvNV): GL_PREFIX(ProgramParameters4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5408(%rax), %r11 + movq 5440(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25422,13 +25570,13 @@ GL_PREFIX(ProgramParameters4fvNV): popq %rdx popq %rsi popq %rdi - movq 5408(%rax), %r11 + movq 5440(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5408(%rax), %r11 + movq 5440(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25442,7 +25590,7 @@ GL_PREFIX(ProgramParameters4fvNV): popq %rdx popq %rsi popq %rdi - movq 5408(%rax), %r11 + movq 5440(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramParameters4fvNV), .-GL_PREFIX(ProgramParameters4fvNV) @@ -25453,7 +25601,7 @@ GL_PREFIX(ProgramParameters4fvNV): GL_PREFIX(RequestResidentProgramsNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5416(%rax), %r11 + movq 5448(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25463,13 +25611,13 @@ GL_PREFIX(RequestResidentProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5416(%rax), %r11 + movq 5448(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5416(%rax), %r11 + movq 5448(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25479,7 +25627,7 @@ GL_PREFIX(RequestResidentProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5416(%rax), %r11 + movq 5448(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(RequestResidentProgramsNV), .-GL_PREFIX(RequestResidentProgramsNV) @@ -25490,7 +25638,7 @@ GL_PREFIX(RequestResidentProgramsNV): GL_PREFIX(TrackMatrixNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5424(%rax), %r11 + movq 5456(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25504,13 +25652,13 @@ GL_PREFIX(TrackMatrixNV): popq %rdx popq %rsi popq %rdi - movq 5424(%rax), %r11 + movq 5456(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5424(%rax), %r11 + movq 5456(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25524,7 +25672,7 @@ GL_PREFIX(TrackMatrixNV): popq %rdx popq %rsi popq %rdi - movq 5424(%rax), %r11 + movq 5456(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TrackMatrixNV), .-GL_PREFIX(TrackMatrixNV) @@ -25535,7 +25683,7 @@ GL_PREFIX(TrackMatrixNV): GL_PREFIX(VertexAttrib1dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5432(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -25545,13 +25693,13 @@ GL_PREFIX(VertexAttrib1dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5432(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5432(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -25561,7 +25709,7 @@ GL_PREFIX(VertexAttrib1dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5432(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1dNV), .-GL_PREFIX(VertexAttrib1dNV) @@ -25572,7 +25720,7 @@ GL_PREFIX(VertexAttrib1dNV): GL_PREFIX(VertexAttrib1dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5440(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25582,13 +25730,13 @@ GL_PREFIX(VertexAttrib1dvNV): popq %rbp popq %rsi popq %rdi - movq 5440(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5440(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25598,7 +25746,7 @@ GL_PREFIX(VertexAttrib1dvNV): popq %rbp popq %rsi popq %rdi - movq 5440(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1dvNV), .-GL_PREFIX(VertexAttrib1dvNV) @@ -25609,7 +25757,7 @@ GL_PREFIX(VertexAttrib1dvNV): GL_PREFIX(VertexAttrib1fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5448(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -25619,13 +25767,13 @@ GL_PREFIX(VertexAttrib1fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5448(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5448(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -25635,7 +25783,7 @@ GL_PREFIX(VertexAttrib1fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5448(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1fNV), .-GL_PREFIX(VertexAttrib1fNV) @@ -25646,7 +25794,7 @@ GL_PREFIX(VertexAttrib1fNV): GL_PREFIX(VertexAttrib1fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5456(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25656,13 +25804,13 @@ GL_PREFIX(VertexAttrib1fvNV): popq %rbp popq %rsi popq %rdi - movq 5456(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5456(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25672,7 +25820,7 @@ GL_PREFIX(VertexAttrib1fvNV): popq %rbp popq %rsi popq %rdi - movq 5456(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1fvNV), .-GL_PREFIX(VertexAttrib1fvNV) @@ -25683,7 +25831,7 @@ GL_PREFIX(VertexAttrib1fvNV): GL_PREFIX(VertexAttrib1sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5464(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25693,13 +25841,13 @@ GL_PREFIX(VertexAttrib1sNV): popq %rbp popq %rsi popq %rdi - movq 5464(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5464(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25709,7 +25857,7 @@ GL_PREFIX(VertexAttrib1sNV): popq %rbp popq %rsi popq %rdi - movq 5464(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1sNV), .-GL_PREFIX(VertexAttrib1sNV) @@ -25720,7 +25868,7 @@ GL_PREFIX(VertexAttrib1sNV): GL_PREFIX(VertexAttrib1svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5472(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25730,13 +25878,13 @@ GL_PREFIX(VertexAttrib1svNV): popq %rbp popq %rsi popq %rdi - movq 5472(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5472(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25746,7 +25894,7 @@ GL_PREFIX(VertexAttrib1svNV): popq %rbp popq %rsi popq %rdi - movq 5472(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1svNV), .-GL_PREFIX(VertexAttrib1svNV) @@ -25757,7 +25905,7 @@ GL_PREFIX(VertexAttrib1svNV): GL_PREFIX(VertexAttrib2dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5480(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -25769,13 +25917,13 @@ GL_PREFIX(VertexAttrib2dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5480(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5480(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -25787,7 +25935,7 @@ GL_PREFIX(VertexAttrib2dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5480(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2dNV), .-GL_PREFIX(VertexAttrib2dNV) @@ -25798,7 +25946,7 @@ GL_PREFIX(VertexAttrib2dNV): GL_PREFIX(VertexAttrib2dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5488(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25808,13 +25956,13 @@ GL_PREFIX(VertexAttrib2dvNV): popq %rbp popq %rsi popq %rdi - movq 5488(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5488(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25824,7 +25972,7 @@ GL_PREFIX(VertexAttrib2dvNV): popq %rbp popq %rsi popq %rdi - movq 5488(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2dvNV), .-GL_PREFIX(VertexAttrib2dvNV) @@ -25835,7 +25983,7 @@ GL_PREFIX(VertexAttrib2dvNV): GL_PREFIX(VertexAttrib2fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5496(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -25847,13 +25995,13 @@ GL_PREFIX(VertexAttrib2fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5496(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5496(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -25865,7 +26013,7 @@ GL_PREFIX(VertexAttrib2fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5496(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2fNV), .-GL_PREFIX(VertexAttrib2fNV) @@ -25876,7 +26024,7 @@ GL_PREFIX(VertexAttrib2fNV): GL_PREFIX(VertexAttrib2fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5504(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25886,13 +26034,13 @@ GL_PREFIX(VertexAttrib2fvNV): popq %rbp popq %rsi popq %rdi - movq 5504(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5504(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25902,7 +26050,7 @@ GL_PREFIX(VertexAttrib2fvNV): popq %rbp popq %rsi popq %rdi - movq 5504(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2fvNV), .-GL_PREFIX(VertexAttrib2fvNV) @@ -25913,7 +26061,7 @@ GL_PREFIX(VertexAttrib2fvNV): GL_PREFIX(VertexAttrib2sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5512(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25923,13 +26071,13 @@ GL_PREFIX(VertexAttrib2sNV): popq %rdx popq %rsi popq %rdi - movq 5512(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5512(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25939,7 +26087,7 @@ GL_PREFIX(VertexAttrib2sNV): popq %rdx popq %rsi popq %rdi - movq 5512(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2sNV), .-GL_PREFIX(VertexAttrib2sNV) @@ -25950,7 +26098,7 @@ GL_PREFIX(VertexAttrib2sNV): GL_PREFIX(VertexAttrib2svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5520(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25960,13 +26108,13 @@ GL_PREFIX(VertexAttrib2svNV): popq %rbp popq %rsi popq %rdi - movq 5520(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5520(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25976,7 +26124,7 @@ GL_PREFIX(VertexAttrib2svNV): popq %rbp popq %rsi popq %rdi - movq 5520(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2svNV), .-GL_PREFIX(VertexAttrib2svNV) @@ -25987,7 +26135,7 @@ GL_PREFIX(VertexAttrib2svNV): GL_PREFIX(VertexAttrib3dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5528(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -26001,13 +26149,13 @@ GL_PREFIX(VertexAttrib3dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5528(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5528(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -26021,7 +26169,7 @@ GL_PREFIX(VertexAttrib3dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5528(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3dNV), .-GL_PREFIX(VertexAttrib3dNV) @@ -26032,7 +26180,7 @@ GL_PREFIX(VertexAttrib3dNV): GL_PREFIX(VertexAttrib3dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5536(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26042,13 +26190,13 @@ GL_PREFIX(VertexAttrib3dvNV): popq %rbp popq %rsi popq %rdi - movq 5536(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5536(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26058,7 +26206,7 @@ GL_PREFIX(VertexAttrib3dvNV): popq %rbp popq %rsi popq %rdi - movq 5536(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3dvNV), .-GL_PREFIX(VertexAttrib3dvNV) @@ -26069,7 +26217,7 @@ GL_PREFIX(VertexAttrib3dvNV): GL_PREFIX(VertexAttrib3fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5544(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -26083,13 +26231,13 @@ GL_PREFIX(VertexAttrib3fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5544(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5544(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -26103,7 +26251,7 @@ GL_PREFIX(VertexAttrib3fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5544(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3fNV), .-GL_PREFIX(VertexAttrib3fNV) @@ -26114,7 +26262,7 @@ GL_PREFIX(VertexAttrib3fNV): GL_PREFIX(VertexAttrib3fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5552(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26124,13 +26272,13 @@ GL_PREFIX(VertexAttrib3fvNV): popq %rbp popq %rsi popq %rdi - movq 5552(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5552(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26140,7 +26288,7 @@ GL_PREFIX(VertexAttrib3fvNV): popq %rbp popq %rsi popq %rdi - movq 5552(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3fvNV), .-GL_PREFIX(VertexAttrib3fvNV) @@ -26151,7 +26299,7 @@ GL_PREFIX(VertexAttrib3fvNV): GL_PREFIX(VertexAttrib3sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5560(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26165,13 +26313,13 @@ GL_PREFIX(VertexAttrib3sNV): popq %rdx popq %rsi popq %rdi - movq 5560(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5560(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26185,7 +26333,7 @@ GL_PREFIX(VertexAttrib3sNV): popq %rdx popq %rsi popq %rdi - movq 5560(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3sNV), .-GL_PREFIX(VertexAttrib3sNV) @@ -26196,7 +26344,7 @@ GL_PREFIX(VertexAttrib3sNV): GL_PREFIX(VertexAttrib3svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5568(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26206,13 +26354,13 @@ GL_PREFIX(VertexAttrib3svNV): popq %rbp popq %rsi popq %rdi - movq 5568(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5568(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26222,7 +26370,7 @@ GL_PREFIX(VertexAttrib3svNV): popq %rbp popq %rsi popq %rdi - movq 5568(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3svNV), .-GL_PREFIX(VertexAttrib3svNV) @@ -26233,7 +26381,7 @@ GL_PREFIX(VertexAttrib3svNV): GL_PREFIX(VertexAttrib4dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5576(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -26249,13 +26397,13 @@ GL_PREFIX(VertexAttrib4dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5576(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5576(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -26271,7 +26419,7 @@ GL_PREFIX(VertexAttrib4dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5576(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4dNV), .-GL_PREFIX(VertexAttrib4dNV) @@ -26282,7 +26430,7 @@ GL_PREFIX(VertexAttrib4dNV): GL_PREFIX(VertexAttrib4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5584(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26292,13 +26440,13 @@ GL_PREFIX(VertexAttrib4dvNV): popq %rbp popq %rsi popq %rdi - movq 5584(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5584(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26308,7 +26456,7 @@ GL_PREFIX(VertexAttrib4dvNV): popq %rbp popq %rsi popq %rdi - movq 5584(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4dvNV), .-GL_PREFIX(VertexAttrib4dvNV) @@ -26319,7 +26467,7 @@ GL_PREFIX(VertexAttrib4dvNV): GL_PREFIX(VertexAttrib4fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5592(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -26335,13 +26483,13 @@ GL_PREFIX(VertexAttrib4fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5592(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5592(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -26357,7 +26505,7 @@ GL_PREFIX(VertexAttrib4fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5592(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4fNV), .-GL_PREFIX(VertexAttrib4fNV) @@ -26368,7 +26516,7 @@ GL_PREFIX(VertexAttrib4fNV): GL_PREFIX(VertexAttrib4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5600(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26378,13 +26526,13 @@ GL_PREFIX(VertexAttrib4fvNV): popq %rbp popq %rsi popq %rdi - movq 5600(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5600(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26394,7 +26542,7 @@ GL_PREFIX(VertexAttrib4fvNV): popq %rbp popq %rsi popq %rdi - movq 5600(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4fvNV), .-GL_PREFIX(VertexAttrib4fvNV) @@ -26405,7 +26553,7 @@ GL_PREFIX(VertexAttrib4fvNV): GL_PREFIX(VertexAttrib4sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5608(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26419,13 +26567,13 @@ GL_PREFIX(VertexAttrib4sNV): popq %rdx popq %rsi popq %rdi - movq 5608(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5608(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26439,7 +26587,7 @@ GL_PREFIX(VertexAttrib4sNV): popq %rdx popq %rsi popq %rdi - movq 5608(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4sNV), .-GL_PREFIX(VertexAttrib4sNV) @@ -26450,7 +26598,7 @@ GL_PREFIX(VertexAttrib4sNV): GL_PREFIX(VertexAttrib4svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5616(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26460,13 +26608,13 @@ GL_PREFIX(VertexAttrib4svNV): popq %rbp popq %rsi popq %rdi - movq 5616(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5616(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26476,7 +26624,7 @@ GL_PREFIX(VertexAttrib4svNV): popq %rbp popq %rsi popq %rdi - movq 5616(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4svNV), .-GL_PREFIX(VertexAttrib4svNV) @@ -26487,7 +26635,7 @@ GL_PREFIX(VertexAttrib4svNV): GL_PREFIX(VertexAttrib4ubNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5624(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26501,13 +26649,13 @@ GL_PREFIX(VertexAttrib4ubNV): popq %rdx popq %rsi popq %rdi - movq 5624(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5624(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26521,7 +26669,7 @@ GL_PREFIX(VertexAttrib4ubNV): popq %rdx popq %rsi popq %rdi - movq 5624(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4ubNV), .-GL_PREFIX(VertexAttrib4ubNV) @@ -26532,7 +26680,7 @@ GL_PREFIX(VertexAttrib4ubNV): GL_PREFIX(VertexAttrib4ubvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5632(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26542,13 +26690,13 @@ GL_PREFIX(VertexAttrib4ubvNV): popq %rbp popq %rsi popq %rdi - movq 5632(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5632(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26558,7 +26706,7 @@ GL_PREFIX(VertexAttrib4ubvNV): popq %rbp popq %rsi popq %rdi - movq 5632(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4ubvNV), .-GL_PREFIX(VertexAttrib4ubvNV) @@ -26569,7 +26717,7 @@ GL_PREFIX(VertexAttrib4ubvNV): GL_PREFIX(VertexAttribPointerNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5640(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26583,13 +26731,13 @@ GL_PREFIX(VertexAttribPointerNV): popq %rdx popq %rsi popq %rdi - movq 5640(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5640(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26603,7 +26751,7 @@ GL_PREFIX(VertexAttribPointerNV): popq %rdx popq %rsi popq %rdi - movq 5640(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribPointerNV), .-GL_PREFIX(VertexAttribPointerNV) @@ -26614,7 +26762,7 @@ GL_PREFIX(VertexAttribPointerNV): GL_PREFIX(VertexAttribs1dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5648(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26624,13 +26772,13 @@ GL_PREFIX(VertexAttribs1dvNV): popq %rdx popq %rsi popq %rdi - movq 5648(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5648(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26640,7 +26788,7 @@ GL_PREFIX(VertexAttribs1dvNV): popq %rdx popq %rsi popq %rdi - movq 5648(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs1dvNV), .-GL_PREFIX(VertexAttribs1dvNV) @@ -26651,7 +26799,7 @@ GL_PREFIX(VertexAttribs1dvNV): GL_PREFIX(VertexAttribs1fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5656(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26661,13 +26809,13 @@ GL_PREFIX(VertexAttribs1fvNV): popq %rdx popq %rsi popq %rdi - movq 5656(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5656(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26677,7 +26825,7 @@ GL_PREFIX(VertexAttribs1fvNV): popq %rdx popq %rsi popq %rdi - movq 5656(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs1fvNV), .-GL_PREFIX(VertexAttribs1fvNV) @@ -26688,7 +26836,7 @@ GL_PREFIX(VertexAttribs1fvNV): GL_PREFIX(VertexAttribs1svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5664(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26698,13 +26846,13 @@ GL_PREFIX(VertexAttribs1svNV): popq %rdx popq %rsi popq %rdi - movq 5664(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5664(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26714,7 +26862,7 @@ GL_PREFIX(VertexAttribs1svNV): popq %rdx popq %rsi popq %rdi - movq 5664(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs1svNV), .-GL_PREFIX(VertexAttribs1svNV) @@ -26725,7 +26873,7 @@ GL_PREFIX(VertexAttribs1svNV): GL_PREFIX(VertexAttribs2dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5672(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26735,13 +26883,13 @@ GL_PREFIX(VertexAttribs2dvNV): popq %rdx popq %rsi popq %rdi - movq 5672(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5672(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26751,7 +26899,7 @@ GL_PREFIX(VertexAttribs2dvNV): popq %rdx popq %rsi popq %rdi - movq 5672(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs2dvNV), .-GL_PREFIX(VertexAttribs2dvNV) @@ -26762,7 +26910,7 @@ GL_PREFIX(VertexAttribs2dvNV): GL_PREFIX(VertexAttribs2fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5680(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26772,13 +26920,13 @@ GL_PREFIX(VertexAttribs2fvNV): popq %rdx popq %rsi popq %rdi - movq 5680(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5680(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26788,7 +26936,7 @@ GL_PREFIX(VertexAttribs2fvNV): popq %rdx popq %rsi popq %rdi - movq 5680(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs2fvNV), .-GL_PREFIX(VertexAttribs2fvNV) @@ -26799,7 +26947,7 @@ GL_PREFIX(VertexAttribs2fvNV): GL_PREFIX(VertexAttribs2svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5688(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26809,13 +26957,13 @@ GL_PREFIX(VertexAttribs2svNV): popq %rdx popq %rsi popq %rdi - movq 5688(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5688(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26825,7 +26973,7 @@ GL_PREFIX(VertexAttribs2svNV): popq %rdx popq %rsi popq %rdi - movq 5688(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs2svNV), .-GL_PREFIX(VertexAttribs2svNV) @@ -26836,7 +26984,7 @@ GL_PREFIX(VertexAttribs2svNV): GL_PREFIX(VertexAttribs3dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5696(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26846,13 +26994,13 @@ GL_PREFIX(VertexAttribs3dvNV): popq %rdx popq %rsi popq %rdi - movq 5696(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5696(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26862,7 +27010,7 @@ GL_PREFIX(VertexAttribs3dvNV): popq %rdx popq %rsi popq %rdi - movq 5696(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs3dvNV), .-GL_PREFIX(VertexAttribs3dvNV) @@ -26873,7 +27021,7 @@ GL_PREFIX(VertexAttribs3dvNV): GL_PREFIX(VertexAttribs3fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5704(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26883,13 +27031,13 @@ GL_PREFIX(VertexAttribs3fvNV): popq %rdx popq %rsi popq %rdi - movq 5704(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5704(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26899,7 +27047,7 @@ GL_PREFIX(VertexAttribs3fvNV): popq %rdx popq %rsi popq %rdi - movq 5704(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs3fvNV), .-GL_PREFIX(VertexAttribs3fvNV) @@ -26910,7 +27058,7 @@ GL_PREFIX(VertexAttribs3fvNV): GL_PREFIX(VertexAttribs3svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5712(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26920,13 +27068,13 @@ GL_PREFIX(VertexAttribs3svNV): popq %rdx popq %rsi popq %rdi - movq 5712(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5712(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26936,7 +27084,7 @@ GL_PREFIX(VertexAttribs3svNV): popq %rdx popq %rsi popq %rdi - movq 5712(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs3svNV), .-GL_PREFIX(VertexAttribs3svNV) @@ -26947,7 +27095,7 @@ GL_PREFIX(VertexAttribs3svNV): GL_PREFIX(VertexAttribs4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5720(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26957,13 +27105,13 @@ GL_PREFIX(VertexAttribs4dvNV): popq %rdx popq %rsi popq %rdi - movq 5720(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5720(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26973,7 +27121,7 @@ GL_PREFIX(VertexAttribs4dvNV): popq %rdx popq %rsi popq %rdi - movq 5720(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4dvNV), .-GL_PREFIX(VertexAttribs4dvNV) @@ -26984,7 +27132,7 @@ GL_PREFIX(VertexAttribs4dvNV): GL_PREFIX(VertexAttribs4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5728(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26994,13 +27142,13 @@ GL_PREFIX(VertexAttribs4fvNV): popq %rdx popq %rsi popq %rdi - movq 5728(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5728(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27010,7 +27158,7 @@ GL_PREFIX(VertexAttribs4fvNV): popq %rdx popq %rsi popq %rdi - movq 5728(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4fvNV), .-GL_PREFIX(VertexAttribs4fvNV) @@ -27021,7 +27169,7 @@ GL_PREFIX(VertexAttribs4fvNV): GL_PREFIX(VertexAttribs4svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5736(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27031,13 +27179,13 @@ GL_PREFIX(VertexAttribs4svNV): popq %rdx popq %rsi popq %rdi - movq 5736(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5736(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27047,7 +27195,7 @@ GL_PREFIX(VertexAttribs4svNV): popq %rdx popq %rsi popq %rdi - movq 5736(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4svNV), .-GL_PREFIX(VertexAttribs4svNV) @@ -27058,7 +27206,7 @@ GL_PREFIX(VertexAttribs4svNV): GL_PREFIX(VertexAttribs4ubvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5744(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27068,13 +27216,13 @@ GL_PREFIX(VertexAttribs4ubvNV): popq %rdx popq %rsi popq %rdi - movq 5744(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5744(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27084,7 +27232,7 @@ GL_PREFIX(VertexAttribs4ubvNV): popq %rdx popq %rsi popq %rdi - movq 5744(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4ubvNV), .-GL_PREFIX(VertexAttribs4ubvNV) @@ -27095,7 +27243,7 @@ GL_PREFIX(VertexAttribs4ubvNV): GL_PREFIX(GetTexBumpParameterfvATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5752(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27105,13 +27253,13 @@ GL_PREFIX(GetTexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5752(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5752(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27121,7 +27269,7 @@ GL_PREFIX(GetTexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5752(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTexBumpParameterfvATI), .-GL_PREFIX(GetTexBumpParameterfvATI) @@ -27132,7 +27280,7 @@ GL_PREFIX(GetTexBumpParameterfvATI): GL_PREFIX(GetTexBumpParameterivATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5760(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27142,13 +27290,13 @@ GL_PREFIX(GetTexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5760(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5760(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27158,7 +27306,7 @@ GL_PREFIX(GetTexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5760(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTexBumpParameterivATI), .-GL_PREFIX(GetTexBumpParameterivATI) @@ -27169,7 +27317,7 @@ GL_PREFIX(GetTexBumpParameterivATI): GL_PREFIX(TexBumpParameterfvATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5768(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27179,13 +27327,13 @@ GL_PREFIX(TexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5768(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5768(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27195,7 +27343,7 @@ GL_PREFIX(TexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5768(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TexBumpParameterfvATI), .-GL_PREFIX(TexBumpParameterfvATI) @@ -27206,7 +27354,7 @@ GL_PREFIX(TexBumpParameterfvATI): GL_PREFIX(TexBumpParameterivATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5776(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27216,13 +27364,13 @@ GL_PREFIX(TexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5776(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5776(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27232,7 +27380,7 @@ GL_PREFIX(TexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5776(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TexBumpParameterivATI), .-GL_PREFIX(TexBumpParameterivATI) @@ -27243,7 +27391,7 @@ GL_PREFIX(TexBumpParameterivATI): GL_PREFIX(AlphaFragmentOp1ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5784(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27261,13 +27409,13 @@ GL_PREFIX(AlphaFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5784(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5784(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27285,7 +27433,7 @@ GL_PREFIX(AlphaFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5784(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AlphaFragmentOp1ATI), .-GL_PREFIX(AlphaFragmentOp1ATI) @@ -27296,7 +27444,7 @@ GL_PREFIX(AlphaFragmentOp1ATI): GL_PREFIX(AlphaFragmentOp2ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5792(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27314,13 +27462,13 @@ GL_PREFIX(AlphaFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 5792(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5792(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27338,7 +27486,7 @@ GL_PREFIX(AlphaFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 5792(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AlphaFragmentOp2ATI), .-GL_PREFIX(AlphaFragmentOp2ATI) @@ -27349,7 +27497,7 @@ GL_PREFIX(AlphaFragmentOp2ATI): GL_PREFIX(AlphaFragmentOp3ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5800(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27367,13 +27515,13 @@ GL_PREFIX(AlphaFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 5800(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5800(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27391,7 +27539,7 @@ GL_PREFIX(AlphaFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 5800(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AlphaFragmentOp3ATI), .-GL_PREFIX(AlphaFragmentOp3ATI) @@ -27402,25 +27550,25 @@ GL_PREFIX(AlphaFragmentOp3ATI): GL_PREFIX(BeginFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5808(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 5808(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5808(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 5808(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BeginFragmentShaderATI), .-GL_PREFIX(BeginFragmentShaderATI) @@ -27431,25 +27579,25 @@ GL_PREFIX(BeginFragmentShaderATI): GL_PREFIX(BindFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5816(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5816(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5816(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5816(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindFragmentShaderATI), .-GL_PREFIX(BindFragmentShaderATI) @@ -27460,7 +27608,7 @@ GL_PREFIX(BindFragmentShaderATI): GL_PREFIX(ColorFragmentOp1ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5824(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27478,13 +27626,13 @@ GL_PREFIX(ColorFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5824(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5824(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27502,7 +27650,7 @@ GL_PREFIX(ColorFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5824(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorFragmentOp1ATI), .-GL_PREFIX(ColorFragmentOp1ATI) @@ -27513,7 +27661,7 @@ GL_PREFIX(ColorFragmentOp1ATI): GL_PREFIX(ColorFragmentOp2ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5832(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27531,13 +27679,13 @@ GL_PREFIX(ColorFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 5832(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5832(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27555,7 +27703,7 @@ GL_PREFIX(ColorFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 5832(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorFragmentOp2ATI), .-GL_PREFIX(ColorFragmentOp2ATI) @@ -27566,7 +27714,7 @@ GL_PREFIX(ColorFragmentOp2ATI): GL_PREFIX(ColorFragmentOp3ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5840(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27584,13 +27732,13 @@ GL_PREFIX(ColorFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 5840(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5840(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27608,7 +27756,7 @@ GL_PREFIX(ColorFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 5840(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorFragmentOp3ATI), .-GL_PREFIX(ColorFragmentOp3ATI) @@ -27619,25 +27767,25 @@ GL_PREFIX(ColorFragmentOp3ATI): GL_PREFIX(DeleteFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5848(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5848(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5848(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5848(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteFragmentShaderATI), .-GL_PREFIX(DeleteFragmentShaderATI) @@ -27648,25 +27796,25 @@ GL_PREFIX(DeleteFragmentShaderATI): GL_PREFIX(EndFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5856(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 5856(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5856(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 5856(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EndFragmentShaderATI), .-GL_PREFIX(EndFragmentShaderATI) @@ -27677,25 +27825,25 @@ GL_PREFIX(EndFragmentShaderATI): GL_PREFIX(GenFragmentShadersATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5864(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5864(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5864(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5864(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenFragmentShadersATI), .-GL_PREFIX(GenFragmentShadersATI) @@ -27706,7 +27854,7 @@ GL_PREFIX(GenFragmentShadersATI): GL_PREFIX(PassTexCoordATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5872(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27716,13 +27864,13 @@ GL_PREFIX(PassTexCoordATI): popq %rdx popq %rsi popq %rdi - movq 5872(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5872(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27732,7 +27880,7 @@ GL_PREFIX(PassTexCoordATI): popq %rdx popq %rsi popq %rdi - movq 5872(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PassTexCoordATI), .-GL_PREFIX(PassTexCoordATI) @@ -27743,7 +27891,7 @@ GL_PREFIX(PassTexCoordATI): GL_PREFIX(SampleMapATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5880(%rax), %r11 + movq 5912(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27753,13 +27901,13 @@ GL_PREFIX(SampleMapATI): popq %rdx popq %rsi popq %rdi - movq 5880(%rax), %r11 + movq 5912(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5880(%rax), %r11 + movq 5912(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27769,7 +27917,7 @@ GL_PREFIX(SampleMapATI): popq %rdx popq %rsi popq %rdi - movq 5880(%rax), %r11 + movq 5912(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SampleMapATI), .-GL_PREFIX(SampleMapATI) @@ -27780,7 +27928,7 @@ GL_PREFIX(SampleMapATI): GL_PREFIX(SetFragmentShaderConstantATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5888(%rax), %r11 + movq 5920(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27790,13 +27938,13 @@ GL_PREFIX(SetFragmentShaderConstantATI): popq %rbp popq %rsi popq %rdi - movq 5888(%rax), %r11 + movq 5920(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5888(%rax), %r11 + movq 5920(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27806,7 +27954,7 @@ GL_PREFIX(SetFragmentShaderConstantATI): popq %rbp popq %rsi popq %rdi - movq 5888(%rax), %r11 + movq 5920(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SetFragmentShaderConstantATI), .-GL_PREFIX(SetFragmentShaderConstantATI) @@ -27817,7 +27965,7 @@ GL_PREFIX(SetFragmentShaderConstantATI): GL_PREFIX(PointParameteriNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5896(%rax), %r11 + movq 5928(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27827,13 +27975,13 @@ GL_PREFIX(PointParameteriNV): popq %rbp popq %rsi popq %rdi - movq 5896(%rax), %r11 + movq 5928(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5896(%rax), %r11 + movq 5928(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27843,7 +27991,7 @@ GL_PREFIX(PointParameteriNV): popq %rbp popq %rsi popq %rdi - movq 5896(%rax), %r11 + movq 5928(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PointParameteriNV), .-GL_PREFIX(PointParameteriNV) @@ -27854,7 +28002,7 @@ GL_PREFIX(PointParameteriNV): GL_PREFIX(PointParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5904(%rax), %r11 + movq 5936(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27864,13 +28012,13 @@ GL_PREFIX(PointParameterivNV): popq %rbp popq %rsi popq %rdi - movq 5904(%rax), %r11 + movq 5936(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5904(%rax), %r11 + movq 5936(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27880,79 +28028,79 @@ GL_PREFIX(PointParameterivNV): popq %rbp popq %rsi popq %rdi - movq 5904(%rax), %r11 + movq 5936(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PointParameterivNV), .-GL_PREFIX(PointParameterivNV) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_739) - .type GL_PREFIX(_dispatch_stub_739), @function - HIDDEN(GL_PREFIX(_dispatch_stub_739)) -GL_PREFIX(_dispatch_stub_739): + .globl GL_PREFIX(_dispatch_stub_743) + .type GL_PREFIX(_dispatch_stub_743), @function + HIDDEN(GL_PREFIX(_dispatch_stub_743)) +GL_PREFIX(_dispatch_stub_743): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5912(%rax), %r11 + movq 5944(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5912(%rax), %r11 + movq 5944(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5912(%rax), %r11 + movq 5944(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5912(%rax), %r11 + movq 5944(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_739), .-GL_PREFIX(_dispatch_stub_739) + .size GL_PREFIX(_dispatch_stub_743), .-GL_PREFIX(_dispatch_stub_743) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_740) - .type GL_PREFIX(_dispatch_stub_740), @function - HIDDEN(GL_PREFIX(_dispatch_stub_740)) -GL_PREFIX(_dispatch_stub_740): + .globl GL_PREFIX(_dispatch_stub_744) + .type GL_PREFIX(_dispatch_stub_744), @function + HIDDEN(GL_PREFIX(_dispatch_stub_744)) +GL_PREFIX(_dispatch_stub_744): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5920(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5920(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5920(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5920(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_740), .-GL_PREFIX(_dispatch_stub_740) + .size GL_PREFIX(_dispatch_stub_744), .-GL_PREFIX(_dispatch_stub_744) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_741) - .type GL_PREFIX(_dispatch_stub_741), @function - HIDDEN(GL_PREFIX(_dispatch_stub_741)) -GL_PREFIX(_dispatch_stub_741): + .globl GL_PREFIX(_dispatch_stub_745) + .type GL_PREFIX(_dispatch_stub_745), @function + HIDDEN(GL_PREFIX(_dispatch_stub_745)) +GL_PREFIX(_dispatch_stub_745): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5928(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27962,13 +28110,13 @@ GL_PREFIX(_dispatch_stub_741): popq %rbp popq %rsi popq %rdi - movq 5928(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5928(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27978,19 +28126,19 @@ GL_PREFIX(_dispatch_stub_741): popq %rbp popq %rsi popq %rdi - movq 5928(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_741), .-GL_PREFIX(_dispatch_stub_741) + .size GL_PREFIX(_dispatch_stub_745), .-GL_PREFIX(_dispatch_stub_745) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_742) - .type GL_PREFIX(_dispatch_stub_742), @function - HIDDEN(GL_PREFIX(_dispatch_stub_742)) -GL_PREFIX(_dispatch_stub_742): + .globl GL_PREFIX(_dispatch_stub_746) + .type GL_PREFIX(_dispatch_stub_746), @function + HIDDEN(GL_PREFIX(_dispatch_stub_746)) +GL_PREFIX(_dispatch_stub_746): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5936(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28000,13 +28148,13 @@ GL_PREFIX(_dispatch_stub_742): popq %rbp popq %rsi popq %rdi - movq 5936(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5936(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28016,40 +28164,40 @@ GL_PREFIX(_dispatch_stub_742): popq %rbp popq %rsi popq %rdi - movq 5936(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_742), .-GL_PREFIX(_dispatch_stub_742) + .size GL_PREFIX(_dispatch_stub_746), .-GL_PREFIX(_dispatch_stub_746) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_743) - .type GL_PREFIX(_dispatch_stub_743), @function - HIDDEN(GL_PREFIX(_dispatch_stub_743)) -GL_PREFIX(_dispatch_stub_743): + .globl GL_PREFIX(_dispatch_stub_747) + .type GL_PREFIX(_dispatch_stub_747), @function + HIDDEN(GL_PREFIX(_dispatch_stub_747)) +GL_PREFIX(_dispatch_stub_747): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5944(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5944(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5944(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5944(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_743), .-GL_PREFIX(_dispatch_stub_743) + .size GL_PREFIX(_dispatch_stub_747), .-GL_PREFIX(_dispatch_stub_747) .p2align 4,,15 .globl GL_PREFIX(GetProgramNamedParameterdvNV) @@ -28057,7 +28205,7 @@ GL_PREFIX(_dispatch_stub_743): GL_PREFIX(GetProgramNamedParameterdvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5952(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28071,13 +28219,13 @@ GL_PREFIX(GetProgramNamedParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5952(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5952(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28091,7 +28239,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5952(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramNamedParameterdvNV), .-GL_PREFIX(GetProgramNamedParameterdvNV) @@ -28102,7 +28250,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV): GL_PREFIX(GetProgramNamedParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5960(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28116,13 +28264,13 @@ GL_PREFIX(GetProgramNamedParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5960(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5960(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28136,7 +28284,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5960(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramNamedParameterfvNV), .-GL_PREFIX(GetProgramNamedParameterfvNV) @@ -28147,7 +28295,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV): GL_PREFIX(ProgramNamedParameter4dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5968(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $56, %rsp @@ -28167,13 +28315,13 @@ GL_PREFIX(ProgramNamedParameter4dNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 5968(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5968(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 1: subq $56, %rsp @@ -28193,7 +28341,7 @@ GL_PREFIX(ProgramNamedParameter4dNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 5968(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4dNV), .-GL_PREFIX(ProgramNamedParameter4dNV) @@ -28204,7 +28352,7 @@ GL_PREFIX(ProgramNamedParameter4dNV): GL_PREFIX(ProgramNamedParameter4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5976(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28218,13 +28366,13 @@ GL_PREFIX(ProgramNamedParameter4dvNV): popq %rdx popq %rsi popq %rdi - movq 5976(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5976(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28238,7 +28386,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV): popq %rdx popq %rsi popq %rdi - movq 5976(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4dvNV), .-GL_PREFIX(ProgramNamedParameter4dvNV) @@ -28249,7 +28397,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV): GL_PREFIX(ProgramNamedParameter4fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5984(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $56, %rsp @@ -28269,13 +28417,13 @@ GL_PREFIX(ProgramNamedParameter4fNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 5984(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5984(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 1: subq $56, %rsp @@ -28295,7 +28443,7 @@ GL_PREFIX(ProgramNamedParameter4fNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 5984(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4fNV), .-GL_PREFIX(ProgramNamedParameter4fNV) @@ -28306,7 +28454,7 @@ GL_PREFIX(ProgramNamedParameter4fNV): GL_PREFIX(ProgramNamedParameter4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5992(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28320,13 +28468,13 @@ GL_PREFIX(ProgramNamedParameter4fvNV): popq %rdx popq %rsi popq %rdi - movq 5992(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5992(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28340,19 +28488,19 @@ GL_PREFIX(ProgramNamedParameter4fvNV): popq %rdx popq %rsi popq %rdi - movq 5992(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4fvNV), .-GL_PREFIX(ProgramNamedParameter4fvNV) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_750) - .type GL_PREFIX(_dispatch_stub_750), @function - HIDDEN(GL_PREFIX(_dispatch_stub_750)) -GL_PREFIX(_dispatch_stub_750): + .globl GL_PREFIX(_dispatch_stub_754) + .type GL_PREFIX(_dispatch_stub_754), @function + HIDDEN(GL_PREFIX(_dispatch_stub_754)) +GL_PREFIX(_dispatch_stub_754): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6000(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28362,13 +28510,13 @@ GL_PREFIX(_dispatch_stub_750): popq %rbp popq %rsi popq %rdi - movq 6000(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6000(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28378,19 +28526,19 @@ GL_PREFIX(_dispatch_stub_750): popq %rbp popq %rsi popq %rdi - movq 6000(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_750), .-GL_PREFIX(_dispatch_stub_750) + .size GL_PREFIX(_dispatch_stub_754), .-GL_PREFIX(_dispatch_stub_754) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_751) - .type GL_PREFIX(_dispatch_stub_751), @function - HIDDEN(GL_PREFIX(_dispatch_stub_751)) -GL_PREFIX(_dispatch_stub_751): + .globl GL_PREFIX(_dispatch_stub_755) + .type GL_PREFIX(_dispatch_stub_755), @function + HIDDEN(GL_PREFIX(_dispatch_stub_755)) +GL_PREFIX(_dispatch_stub_755): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6008(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28400,13 +28548,13 @@ GL_PREFIX(_dispatch_stub_751): popq %rbp popq %rsi popq %rdi - movq 6008(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6008(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28416,10 +28564,10 @@ GL_PREFIX(_dispatch_stub_751): popq %rbp popq %rsi popq %rdi - movq 6008(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_751), .-GL_PREFIX(_dispatch_stub_751) + .size GL_PREFIX(_dispatch_stub_755), .-GL_PREFIX(_dispatch_stub_755) .p2align 4,,15 .globl GL_PREFIX(BindFramebufferEXT) @@ -28427,7 +28575,7 @@ GL_PREFIX(_dispatch_stub_751): GL_PREFIX(BindFramebufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6016(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28437,13 +28585,13 @@ GL_PREFIX(BindFramebufferEXT): popq %rbp popq %rsi popq %rdi - movq 6016(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6016(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28453,7 +28601,7 @@ GL_PREFIX(BindFramebufferEXT): popq %rbp popq %rsi popq %rdi - movq 6016(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindFramebufferEXT), .-GL_PREFIX(BindFramebufferEXT) @@ -28464,7 +28612,7 @@ GL_PREFIX(BindFramebufferEXT): GL_PREFIX(BindRenderbufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6024(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28474,13 +28622,13 @@ GL_PREFIX(BindRenderbufferEXT): popq %rbp popq %rsi popq %rdi - movq 6024(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6024(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28490,7 +28638,7 @@ GL_PREFIX(BindRenderbufferEXT): popq %rbp popq %rsi popq %rdi - movq 6024(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindRenderbufferEXT), .-GL_PREFIX(BindRenderbufferEXT) @@ -28501,25 +28649,25 @@ GL_PREFIX(BindRenderbufferEXT): GL_PREFIX(CheckFramebufferStatusEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6032(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6032(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6032(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6032(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CheckFramebufferStatusEXT), .-GL_PREFIX(CheckFramebufferStatusEXT) @@ -28530,7 +28678,7 @@ GL_PREFIX(CheckFramebufferStatusEXT): GL_PREFIX(DeleteFramebuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6040(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28540,13 +28688,13 @@ GL_PREFIX(DeleteFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6040(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6040(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28556,7 +28704,7 @@ GL_PREFIX(DeleteFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6040(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteFramebuffersEXT), .-GL_PREFIX(DeleteFramebuffersEXT) @@ -28567,7 +28715,7 @@ GL_PREFIX(DeleteFramebuffersEXT): GL_PREFIX(DeleteRenderbuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6048(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28577,13 +28725,13 @@ GL_PREFIX(DeleteRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6048(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6048(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28593,7 +28741,7 @@ GL_PREFIX(DeleteRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6048(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteRenderbuffersEXT), .-GL_PREFIX(DeleteRenderbuffersEXT) @@ -28604,7 +28752,7 @@ GL_PREFIX(DeleteRenderbuffersEXT): GL_PREFIX(FramebufferRenderbufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6056(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28618,13 +28766,13 @@ GL_PREFIX(FramebufferRenderbufferEXT): popq %rdx popq %rsi popq %rdi - movq 6056(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6056(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28638,7 +28786,7 @@ GL_PREFIX(FramebufferRenderbufferEXT): popq %rdx popq %rsi popq %rdi - movq 6056(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferRenderbufferEXT), .-GL_PREFIX(FramebufferRenderbufferEXT) @@ -28649,7 +28797,7 @@ GL_PREFIX(FramebufferRenderbufferEXT): GL_PREFIX(FramebufferTexture1DEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6064(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28663,13 +28811,13 @@ GL_PREFIX(FramebufferTexture1DEXT): popq %rdx popq %rsi popq %rdi - movq 6064(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6064(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28683,7 +28831,7 @@ GL_PREFIX(FramebufferTexture1DEXT): popq %rdx popq %rsi popq %rdi - movq 6064(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTexture1DEXT), .-GL_PREFIX(FramebufferTexture1DEXT) @@ -28694,7 +28842,7 @@ GL_PREFIX(FramebufferTexture1DEXT): GL_PREFIX(FramebufferTexture2DEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6072(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28708,13 +28856,13 @@ GL_PREFIX(FramebufferTexture2DEXT): popq %rdx popq %rsi popq %rdi - movq 6072(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6072(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28728,7 +28876,7 @@ GL_PREFIX(FramebufferTexture2DEXT): popq %rdx popq %rsi popq %rdi - movq 6072(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTexture2DEXT), .-GL_PREFIX(FramebufferTexture2DEXT) @@ -28739,7 +28887,7 @@ GL_PREFIX(FramebufferTexture2DEXT): GL_PREFIX(FramebufferTexture3DEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6080(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28757,13 +28905,13 @@ GL_PREFIX(FramebufferTexture3DEXT): popq %rdx popq %rsi popq %rdi - movq 6080(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6080(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28781,7 +28929,7 @@ GL_PREFIX(FramebufferTexture3DEXT): popq %rdx popq %rsi popq %rdi - movq 6080(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTexture3DEXT), .-GL_PREFIX(FramebufferTexture3DEXT) @@ -28792,7 +28940,7 @@ GL_PREFIX(FramebufferTexture3DEXT): GL_PREFIX(GenFramebuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6088(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28802,13 +28950,13 @@ GL_PREFIX(GenFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6088(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6088(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28818,7 +28966,7 @@ GL_PREFIX(GenFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6088(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenFramebuffersEXT), .-GL_PREFIX(GenFramebuffersEXT) @@ -28829,7 +28977,7 @@ GL_PREFIX(GenFramebuffersEXT): GL_PREFIX(GenRenderbuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6096(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28839,13 +28987,13 @@ GL_PREFIX(GenRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6096(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6096(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28855,7 +29003,7 @@ GL_PREFIX(GenRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6096(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenRenderbuffersEXT), .-GL_PREFIX(GenRenderbuffersEXT) @@ -28866,25 +29014,25 @@ GL_PREFIX(GenRenderbuffersEXT): GL_PREFIX(GenerateMipmapEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6104(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6104(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6104(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6104(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenerateMipmapEXT), .-GL_PREFIX(GenerateMipmapEXT) @@ -28895,7 +29043,7 @@ GL_PREFIX(GenerateMipmapEXT): GL_PREFIX(GetFramebufferAttachmentParameterivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6112(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28909,13 +29057,13 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6112(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6112(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28929,7 +29077,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6112(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetFramebufferAttachmentParameterivEXT), .-GL_PREFIX(GetFramebufferAttachmentParameterivEXT) @@ -28940,7 +29088,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT): GL_PREFIX(GetRenderbufferParameterivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6120(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28950,13 +29098,13 @@ GL_PREFIX(GetRenderbufferParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6120(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6120(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28966,7 +29114,7 @@ GL_PREFIX(GetRenderbufferParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6120(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetRenderbufferParameterivEXT), .-GL_PREFIX(GetRenderbufferParameterivEXT) @@ -28977,25 +29125,25 @@ GL_PREFIX(GetRenderbufferParameterivEXT): GL_PREFIX(IsFramebufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6128(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6128(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6128(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6128(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsFramebufferEXT), .-GL_PREFIX(IsFramebufferEXT) @@ -29006,25 +29154,25 @@ GL_PREFIX(IsFramebufferEXT): GL_PREFIX(IsRenderbufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6136(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6136(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6136(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6136(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsRenderbufferEXT), .-GL_PREFIX(IsRenderbufferEXT) @@ -29035,7 +29183,7 @@ GL_PREFIX(IsRenderbufferEXT): GL_PREFIX(RenderbufferStorageEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6144(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29049,13 +29197,13 @@ GL_PREFIX(RenderbufferStorageEXT): popq %rdx popq %rsi popq %rdi - movq 6144(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6144(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29069,19 +29217,19 @@ GL_PREFIX(RenderbufferStorageEXT): popq %rdx popq %rsi popq %rdi - movq 6144(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(RenderbufferStorageEXT), .-GL_PREFIX(RenderbufferStorageEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_769) - .type GL_PREFIX(_dispatch_stub_769), @function - HIDDEN(GL_PREFIX(_dispatch_stub_769)) -GL_PREFIX(_dispatch_stub_769): + .globl GL_PREFIX(_dispatch_stub_773) + .type GL_PREFIX(_dispatch_stub_773), @function + HIDDEN(GL_PREFIX(_dispatch_stub_773)) +GL_PREFIX(_dispatch_stub_773): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6152(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29099,13 +29247,13 @@ GL_PREFIX(_dispatch_stub_769): popq %rdx popq %rsi popq %rdi - movq 6152(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6152(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29123,10 +29271,10 @@ GL_PREFIX(_dispatch_stub_769): popq %rdx popq %rsi popq %rdi - movq 6152(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_769), .-GL_PREFIX(_dispatch_stub_769) + .size GL_PREFIX(_dispatch_stub_773), .-GL_PREFIX(_dispatch_stub_773) .p2align 4,,15 .globl GL_PREFIX(FramebufferTextureLayerEXT) @@ -29134,7 +29282,7 @@ GL_PREFIX(_dispatch_stub_769): GL_PREFIX(FramebufferTextureLayerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6160(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29148,13 +29296,13 @@ GL_PREFIX(FramebufferTextureLayerEXT): popq %rdx popq %rsi popq %rdi - movq 6160(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6160(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29168,19 +29316,48 @@ GL_PREFIX(FramebufferTextureLayerEXT): popq %rdx popq %rsi popq %rdi - movq 6160(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTextureLayerEXT), .-GL_PREFIX(FramebufferTextureLayerEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_771) - .type GL_PREFIX(_dispatch_stub_771), @function - HIDDEN(GL_PREFIX(_dispatch_stub_771)) -GL_PREFIX(_dispatch_stub_771): + .globl GL_PREFIX(ProvokingVertexEXT) + .type GL_PREFIX(ProvokingVertexEXT), @function +GL_PREFIX(ProvokingVertexEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6168(%rax), %r11 + movq 6200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProvokingVertexEXT), .-GL_PREFIX(ProvokingVertexEXT) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_776) + .type GL_PREFIX(_dispatch_stub_776), @function + HIDDEN(GL_PREFIX(_dispatch_stub_776)) +GL_PREFIX(_dispatch_stub_776): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6208(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29194,13 +29371,13 @@ GL_PREFIX(_dispatch_stub_771): popq %rdx popq %rsi popq %rdi - movq 6168(%rax), %r11 + movq 6208(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6168(%rax), %r11 + movq 6208(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29214,19 +29391,19 @@ GL_PREFIX(_dispatch_stub_771): popq %rdx popq %rsi popq %rdi - movq 6168(%rax), %r11 + movq 6208(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_771), .-GL_PREFIX(_dispatch_stub_771) + .size GL_PREFIX(_dispatch_stub_776), .-GL_PREFIX(_dispatch_stub_776) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_772) - .type GL_PREFIX(_dispatch_stub_772), @function - HIDDEN(GL_PREFIX(_dispatch_stub_772)) -GL_PREFIX(_dispatch_stub_772): + .globl GL_PREFIX(_dispatch_stub_777) + .type GL_PREFIX(_dispatch_stub_777), @function + HIDDEN(GL_PREFIX(_dispatch_stub_777)) +GL_PREFIX(_dispatch_stub_777): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6176(%rax), %r11 + movq 6216(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29240,13 +29417,13 @@ GL_PREFIX(_dispatch_stub_772): popq %rdx popq %rsi popq %rdi - movq 6176(%rax), %r11 + movq 6216(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6176(%rax), %r11 + movq 6216(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29260,19 +29437,19 @@ GL_PREFIX(_dispatch_stub_772): popq %rdx popq %rsi popq %rdi - movq 6176(%rax), %r11 + movq 6216(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_772), .-GL_PREFIX(_dispatch_stub_772) + .size GL_PREFIX(_dispatch_stub_777), .-GL_PREFIX(_dispatch_stub_777) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_773) - .type GL_PREFIX(_dispatch_stub_773), @function - HIDDEN(GL_PREFIX(_dispatch_stub_773)) -GL_PREFIX(_dispatch_stub_773): + .globl GL_PREFIX(_dispatch_stub_778) + .type GL_PREFIX(_dispatch_stub_778), @function + HIDDEN(GL_PREFIX(_dispatch_stub_778)) +GL_PREFIX(_dispatch_stub_778): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6184(%rax), %r11 + movq 6224(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29286,13 +29463,13 @@ GL_PREFIX(_dispatch_stub_773): popq %rdx popq %rsi popq %rdi - movq 6184(%rax), %r11 + movq 6224(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6184(%rax), %r11 + movq 6224(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29306,19 +29483,19 @@ GL_PREFIX(_dispatch_stub_773): popq %rdx popq %rsi popq %rdi - movq 6184(%rax), %r11 + movq 6224(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_773), .-GL_PREFIX(_dispatch_stub_773) + .size GL_PREFIX(_dispatch_stub_778), .-GL_PREFIX(_dispatch_stub_778) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_774) - .type GL_PREFIX(_dispatch_stub_774), @function - HIDDEN(GL_PREFIX(_dispatch_stub_774)) -GL_PREFIX(_dispatch_stub_774): + .globl GL_PREFIX(_dispatch_stub_779) + .type GL_PREFIX(_dispatch_stub_779), @function + HIDDEN(GL_PREFIX(_dispatch_stub_779)) +GL_PREFIX(_dispatch_stub_779): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6192(%rax), %r11 + movq 6232(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29328,13 +29505,13 @@ GL_PREFIX(_dispatch_stub_774): popq %rdx popq %rsi popq %rdi - movq 6192(%rax), %r11 + movq 6232(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6192(%rax), %r11 + movq 6232(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29344,19 +29521,19 @@ GL_PREFIX(_dispatch_stub_774): popq %rdx popq %rsi popq %rdi - movq 6192(%rax), %r11 + movq 6232(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774) + .size GL_PREFIX(_dispatch_stub_779), .-GL_PREFIX(_dispatch_stub_779) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_775) - .type GL_PREFIX(_dispatch_stub_775), @function - HIDDEN(GL_PREFIX(_dispatch_stub_775)) -GL_PREFIX(_dispatch_stub_775): + .globl GL_PREFIX(_dispatch_stub_780) + .type GL_PREFIX(_dispatch_stub_780), @function + HIDDEN(GL_PREFIX(_dispatch_stub_780)) +GL_PREFIX(_dispatch_stub_780): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6200(%rax), %r11 + movq 6240(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29366,13 +29543,13 @@ GL_PREFIX(_dispatch_stub_775): popq %rdx popq %rsi popq %rdi - movq 6200(%rax), %r11 + movq 6240(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6200(%rax), %r11 + movq 6240(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29382,10 +29559,10 @@ GL_PREFIX(_dispatch_stub_775): popq %rdx popq %rsi popq %rdi - movq 6200(%rax), %r11 + movq 6240(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_775), .-GL_PREFIX(_dispatch_stub_775) + .size GL_PREFIX(_dispatch_stub_780), .-GL_PREFIX(_dispatch_stub_780) .globl GL_PREFIX(ArrayElementEXT) ; .set GL_PREFIX(ArrayElementEXT), GL_PREFIX(ArrayElement) .globl GL_PREFIX(BindTextureEXT) ; .set GL_PREFIX(BindTextureEXT), GL_PREFIX(BindTexture) @@ -29640,7 +29817,9 @@ GL_PREFIX(_dispatch_stub_775): .globl GL_PREFIX(IsProgramARB) ; .set GL_PREFIX(IsProgramARB), GL_PREFIX(IsProgramNV) .globl GL_PREFIX(PointParameteri) ; .set GL_PREFIX(PointParameteri), GL_PREFIX(PointParameteriNV) .globl GL_PREFIX(PointParameteriv) ; .set GL_PREFIX(PointParameteriv), GL_PREFIX(PointParameterivNV) - .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_751) + .globl GL_PREFIX(DeleteVertexArrays) ; .set GL_PREFIX(DeleteVertexArrays), GL_PREFIX(_dispatch_stub_745) + .globl GL_PREFIX(IsVertexArray) ; .set GL_PREFIX(IsVertexArray), GL_PREFIX(_dispatch_stub_747) + .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_755) .globl GL_PREFIX(BindFramebuffer) ; .set GL_PREFIX(BindFramebuffer), GL_PREFIX(BindFramebufferEXT) .globl GL_PREFIX(BindRenderbuffer) ; .set GL_PREFIX(BindRenderbuffer), GL_PREFIX(BindRenderbufferEXT) .globl GL_PREFIX(CheckFramebufferStatus) ; .set GL_PREFIX(CheckFramebufferStatus), GL_PREFIX(CheckFramebufferStatusEXT) @@ -29658,7 +29837,7 @@ GL_PREFIX(_dispatch_stub_775): .globl GL_PREFIX(IsFramebuffer) ; .set GL_PREFIX(IsFramebuffer), GL_PREFIX(IsFramebufferEXT) .globl GL_PREFIX(IsRenderbuffer) ; .set GL_PREFIX(IsRenderbuffer), GL_PREFIX(IsRenderbufferEXT) .globl GL_PREFIX(RenderbufferStorage) ; .set GL_PREFIX(RenderbufferStorage), GL_PREFIX(RenderbufferStorageEXT) - .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_769) + .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_773) .globl GL_PREFIX(FramebufferTextureLayer) ; .set GL_PREFIX(FramebufferTextureLayer), GL_PREFIX(FramebufferTextureLayerEXT) #if defined(GLX_USE_TLS) && defined(__linux__) diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 85eb9554139..40fc6f22297 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -713,24 +713,28 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(GetAttribLocationARB, _gloffset_GetAttribLocationARB, GetAttribLocationARB@8) GL_STUB(DrawBuffersARB, _gloffset_DrawBuffersARB, DrawBuffersARB@8) GL_STUB(RenderbufferStorageMultisample, _gloffset_RenderbufferStorageMultisample, RenderbufferStorageMultisample@20) + GL_STUB(FlushMappedBufferRange, _gloffset_FlushMappedBufferRange, FlushMappedBufferRange@12) + GL_STUB(MapBufferRange, _gloffset_MapBufferRange, MapBufferRange@16) + GL_STUB(BindVertexArray, _gloffset_BindVertexArray, BindVertexArray@4) + GL_STUB(GenVertexArrays, _gloffset_GenVertexArrays, GenVertexArrays@8) GL_STUB(CopyBufferSubData, _gloffset_CopyBufferSubData, CopyBufferSubData@20) GL_STUB(PolygonOffsetEXT, _gloffset_PolygonOffsetEXT, PolygonOffsetEXT@8) - GL_STUB(_dispatch_stub_564, _gloffset_GetPixelTexGenParameterfvSGIS, _dispatch_stub_564@8) - HIDDEN(GL_PREFIX(_dispatch_stub_564, _dispatch_stub_564@8)) - GL_STUB(_dispatch_stub_565, _gloffset_GetPixelTexGenParameterivSGIS, _dispatch_stub_565@8) - HIDDEN(GL_PREFIX(_dispatch_stub_565, _dispatch_stub_565@8)) - GL_STUB(_dispatch_stub_566, _gloffset_PixelTexGenParameterfSGIS, _dispatch_stub_566@8) - HIDDEN(GL_PREFIX(_dispatch_stub_566, _dispatch_stub_566@8)) - GL_STUB(_dispatch_stub_567, _gloffset_PixelTexGenParameterfvSGIS, _dispatch_stub_567@8) - HIDDEN(GL_PREFIX(_dispatch_stub_567, _dispatch_stub_567@8)) - GL_STUB(_dispatch_stub_568, _gloffset_PixelTexGenParameteriSGIS, _dispatch_stub_568@8) + GL_STUB(_dispatch_stub_568, _gloffset_GetPixelTexGenParameterfvSGIS, _dispatch_stub_568@8) HIDDEN(GL_PREFIX(_dispatch_stub_568, _dispatch_stub_568@8)) - GL_STUB(_dispatch_stub_569, _gloffset_PixelTexGenParameterivSGIS, _dispatch_stub_569@8) + GL_STUB(_dispatch_stub_569, _gloffset_GetPixelTexGenParameterivSGIS, _dispatch_stub_569@8) HIDDEN(GL_PREFIX(_dispatch_stub_569, _dispatch_stub_569@8)) - GL_STUB(_dispatch_stub_570, _gloffset_SampleMaskSGIS, _dispatch_stub_570@8) + GL_STUB(_dispatch_stub_570, _gloffset_PixelTexGenParameterfSGIS, _dispatch_stub_570@8) HIDDEN(GL_PREFIX(_dispatch_stub_570, _dispatch_stub_570@8)) - GL_STUB(_dispatch_stub_571, _gloffset_SamplePatternSGIS, _dispatch_stub_571@4) - HIDDEN(GL_PREFIX(_dispatch_stub_571, _dispatch_stub_571@4)) + GL_STUB(_dispatch_stub_571, _gloffset_PixelTexGenParameterfvSGIS, _dispatch_stub_571@8) + HIDDEN(GL_PREFIX(_dispatch_stub_571, _dispatch_stub_571@8)) + GL_STUB(_dispatch_stub_572, _gloffset_PixelTexGenParameteriSGIS, _dispatch_stub_572@8) + HIDDEN(GL_PREFIX(_dispatch_stub_572, _dispatch_stub_572@8)) + GL_STUB(_dispatch_stub_573, _gloffset_PixelTexGenParameterivSGIS, _dispatch_stub_573@8) + HIDDEN(GL_PREFIX(_dispatch_stub_573, _dispatch_stub_573@8)) + GL_STUB(_dispatch_stub_574, _gloffset_SampleMaskSGIS, _dispatch_stub_574@8) + HIDDEN(GL_PREFIX(_dispatch_stub_574, _dispatch_stub_574@8)) + GL_STUB(_dispatch_stub_575, _gloffset_SamplePatternSGIS, _dispatch_stub_575@4) + HIDDEN(GL_PREFIX(_dispatch_stub_575, _dispatch_stub_575@4)) GL_STUB(ColorPointerEXT, _gloffset_ColorPointerEXT, ColorPointerEXT@20) GL_STUB(EdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT, EdgeFlagPointerEXT@12) GL_STUB(IndexPointerEXT, _gloffset_IndexPointerEXT, IndexPointerEXT@16) @@ -741,10 +745,10 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(PointParameterfvEXT, _gloffset_PointParameterfvEXT, PointParameterfvEXT@8) GL_STUB(LockArraysEXT, _gloffset_LockArraysEXT, LockArraysEXT@8) GL_STUB(UnlockArraysEXT, _gloffset_UnlockArraysEXT, UnlockArraysEXT@0) - GL_STUB(_dispatch_stub_582, _gloffset_CullParameterdvEXT, _dispatch_stub_582@8) - HIDDEN(GL_PREFIX(_dispatch_stub_582, _dispatch_stub_582@8)) - GL_STUB(_dispatch_stub_583, _gloffset_CullParameterfvEXT, _dispatch_stub_583@8) - HIDDEN(GL_PREFIX(_dispatch_stub_583, _dispatch_stub_583@8)) + GL_STUB(_dispatch_stub_586, _gloffset_CullParameterdvEXT, _dispatch_stub_586@8) + HIDDEN(GL_PREFIX(_dispatch_stub_586, _dispatch_stub_586@8)) + GL_STUB(_dispatch_stub_587, _gloffset_CullParameterfvEXT, _dispatch_stub_587@8) + HIDDEN(GL_PREFIX(_dispatch_stub_587, _dispatch_stub_587@8)) GL_STUB(SecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT, SecondaryColor3bEXT@12) GL_STUB(SecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT, SecondaryColor3bvEXT@4) GL_STUB(SecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT, SecondaryColor3dEXT@24) @@ -769,8 +773,8 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(FogCoorddvEXT, _gloffset_FogCoorddvEXT, FogCoorddvEXT@4) GL_STUB(FogCoordfEXT, _gloffset_FogCoordfEXT, FogCoordfEXT@4) GL_STUB(FogCoordfvEXT, _gloffset_FogCoordfvEXT, FogCoordfvEXT@4) - GL_STUB(_dispatch_stub_608, _gloffset_PixelTexGenSGIX, _dispatch_stub_608@4) - HIDDEN(GL_PREFIX(_dispatch_stub_608, _dispatch_stub_608@4)) + GL_STUB(_dispatch_stub_612, _gloffset_PixelTexGenSGIX, _dispatch_stub_612@4) + HIDDEN(GL_PREFIX(_dispatch_stub_612, _dispatch_stub_612@4)) GL_STUB(BlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT, BlendFuncSeparateEXT@16) GL_STUB(FlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV, FlushVertexArrayRangeNV@0) GL_STUB(VertexArrayRangeNV, _gloffset_VertexArrayRangeNV, VertexArrayRangeNV@8) @@ -812,24 +816,24 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(WindowPos4ivMESA, _gloffset_WindowPos4ivMESA, WindowPos4ivMESA@4) GL_STUB(WindowPos4sMESA, _gloffset_WindowPos4sMESA, WindowPos4sMESA@16) GL_STUB(WindowPos4svMESA, _gloffset_WindowPos4svMESA, WindowPos4svMESA@4) - GL_STUB(_dispatch_stub_650, _gloffset_MultiModeDrawArraysIBM, _dispatch_stub_650@20) - HIDDEN(GL_PREFIX(_dispatch_stub_650, _dispatch_stub_650@20)) - GL_STUB(_dispatch_stub_651, _gloffset_MultiModeDrawElementsIBM, _dispatch_stub_651@24) - HIDDEN(GL_PREFIX(_dispatch_stub_651, _dispatch_stub_651@24)) - GL_STUB(_dispatch_stub_652, _gloffset_DeleteFencesNV, _dispatch_stub_652@8) - HIDDEN(GL_PREFIX(_dispatch_stub_652, _dispatch_stub_652@8)) - GL_STUB(_dispatch_stub_653, _gloffset_FinishFenceNV, _dispatch_stub_653@4) - HIDDEN(GL_PREFIX(_dispatch_stub_653, _dispatch_stub_653@4)) - GL_STUB(_dispatch_stub_654, _gloffset_GenFencesNV, _dispatch_stub_654@8) - HIDDEN(GL_PREFIX(_dispatch_stub_654, _dispatch_stub_654@8)) - GL_STUB(_dispatch_stub_655, _gloffset_GetFenceivNV, _dispatch_stub_655@12) - HIDDEN(GL_PREFIX(_dispatch_stub_655, _dispatch_stub_655@12)) - GL_STUB(_dispatch_stub_656, _gloffset_IsFenceNV, _dispatch_stub_656@4) - HIDDEN(GL_PREFIX(_dispatch_stub_656, _dispatch_stub_656@4)) - GL_STUB(_dispatch_stub_657, _gloffset_SetFenceNV, _dispatch_stub_657@8) - HIDDEN(GL_PREFIX(_dispatch_stub_657, _dispatch_stub_657@8)) - GL_STUB(_dispatch_stub_658, _gloffset_TestFenceNV, _dispatch_stub_658@4) - HIDDEN(GL_PREFIX(_dispatch_stub_658, _dispatch_stub_658@4)) + GL_STUB(_dispatch_stub_654, _gloffset_MultiModeDrawArraysIBM, _dispatch_stub_654@20) + HIDDEN(GL_PREFIX(_dispatch_stub_654, _dispatch_stub_654@20)) + GL_STUB(_dispatch_stub_655, _gloffset_MultiModeDrawElementsIBM, _dispatch_stub_655@24) + HIDDEN(GL_PREFIX(_dispatch_stub_655, _dispatch_stub_655@24)) + GL_STUB(_dispatch_stub_656, _gloffset_DeleteFencesNV, _dispatch_stub_656@8) + HIDDEN(GL_PREFIX(_dispatch_stub_656, _dispatch_stub_656@8)) + GL_STUB(_dispatch_stub_657, _gloffset_FinishFenceNV, _dispatch_stub_657@4) + HIDDEN(GL_PREFIX(_dispatch_stub_657, _dispatch_stub_657@4)) + GL_STUB(_dispatch_stub_658, _gloffset_GenFencesNV, _dispatch_stub_658@8) + HIDDEN(GL_PREFIX(_dispatch_stub_658, _dispatch_stub_658@8)) + GL_STUB(_dispatch_stub_659, _gloffset_GetFenceivNV, _dispatch_stub_659@12) + HIDDEN(GL_PREFIX(_dispatch_stub_659, _dispatch_stub_659@12)) + GL_STUB(_dispatch_stub_660, _gloffset_IsFenceNV, _dispatch_stub_660@4) + HIDDEN(GL_PREFIX(_dispatch_stub_660, _dispatch_stub_660@4)) + GL_STUB(_dispatch_stub_661, _gloffset_SetFenceNV, _dispatch_stub_661@8) + HIDDEN(GL_PREFIX(_dispatch_stub_661, _dispatch_stub_661@8)) + GL_STUB(_dispatch_stub_662, _gloffset_TestFenceNV, _dispatch_stub_662@4) + HIDDEN(GL_PREFIX(_dispatch_stub_662, _dispatch_stub_662@4)) GL_STUB(AreProgramsResidentNV, _gloffset_AreProgramsResidentNV, AreProgramsResidentNV@12) GL_STUB(BindProgramNV, _gloffset_BindProgramNV, BindProgramNV@8) GL_STUB(DeleteProgramsNV, _gloffset_DeleteProgramsNV, DeleteProgramsNV@8) @@ -910,26 +914,26 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(SetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI, SetFragmentShaderConstantATI@8) GL_STUB(PointParameteriNV, _gloffset_PointParameteriNV, PointParameteriNV@8) GL_STUB(PointParameterivNV, _gloffset_PointParameterivNV, PointParameterivNV@8) - GL_STUB(_dispatch_stub_739, _gloffset_ActiveStencilFaceEXT, _dispatch_stub_739@4) - HIDDEN(GL_PREFIX(_dispatch_stub_739, _dispatch_stub_739@4)) - GL_STUB(_dispatch_stub_740, _gloffset_BindVertexArrayAPPLE, _dispatch_stub_740@4) - HIDDEN(GL_PREFIX(_dispatch_stub_740, _dispatch_stub_740@4)) - GL_STUB(_dispatch_stub_741, _gloffset_DeleteVertexArraysAPPLE, _dispatch_stub_741@8) - HIDDEN(GL_PREFIX(_dispatch_stub_741, _dispatch_stub_741@8)) - GL_STUB(_dispatch_stub_742, _gloffset_GenVertexArraysAPPLE, _dispatch_stub_742@8) - HIDDEN(GL_PREFIX(_dispatch_stub_742, _dispatch_stub_742@8)) - GL_STUB(_dispatch_stub_743, _gloffset_IsVertexArrayAPPLE, _dispatch_stub_743@4) + GL_STUB(_dispatch_stub_743, _gloffset_ActiveStencilFaceEXT, _dispatch_stub_743@4) HIDDEN(GL_PREFIX(_dispatch_stub_743, _dispatch_stub_743@4)) + GL_STUB(_dispatch_stub_744, _gloffset_BindVertexArrayAPPLE, _dispatch_stub_744@4) + HIDDEN(GL_PREFIX(_dispatch_stub_744, _dispatch_stub_744@4)) + GL_STUB(_dispatch_stub_745, _gloffset_DeleteVertexArraysAPPLE, _dispatch_stub_745@8) + HIDDEN(GL_PREFIX(_dispatch_stub_745, _dispatch_stub_745@8)) + GL_STUB(_dispatch_stub_746, _gloffset_GenVertexArraysAPPLE, _dispatch_stub_746@8) + HIDDEN(GL_PREFIX(_dispatch_stub_746, _dispatch_stub_746@8)) + GL_STUB(_dispatch_stub_747, _gloffset_IsVertexArrayAPPLE, _dispatch_stub_747@4) + HIDDEN(GL_PREFIX(_dispatch_stub_747, _dispatch_stub_747@4)) GL_STUB(GetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV, GetProgramNamedParameterdvNV@16) GL_STUB(GetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV, GetProgramNamedParameterfvNV@16) GL_STUB(ProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV, ProgramNamedParameter4dNV@44) GL_STUB(ProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV, ProgramNamedParameter4dvNV@16) GL_STUB(ProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV, ProgramNamedParameter4fNV@28) GL_STUB(ProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV, ProgramNamedParameter4fvNV@16) - GL_STUB(_dispatch_stub_750, _gloffset_DepthBoundsEXT, _dispatch_stub_750@16) - HIDDEN(GL_PREFIX(_dispatch_stub_750, _dispatch_stub_750@16)) - GL_STUB(_dispatch_stub_751, _gloffset_BlendEquationSeparateEXT, _dispatch_stub_751@8) - HIDDEN(GL_PREFIX(_dispatch_stub_751, _dispatch_stub_751@8)) + GL_STUB(_dispatch_stub_754, _gloffset_DepthBoundsEXT, _dispatch_stub_754@16) + HIDDEN(GL_PREFIX(_dispatch_stub_754, _dispatch_stub_754@16)) + GL_STUB(_dispatch_stub_755, _gloffset_BlendEquationSeparateEXT, _dispatch_stub_755@8) + HIDDEN(GL_PREFIX(_dispatch_stub_755, _dispatch_stub_755@8)) GL_STUB(BindFramebufferEXT, _gloffset_BindFramebufferEXT, BindFramebufferEXT@8) GL_STUB(BindRenderbufferEXT, _gloffset_BindRenderbufferEXT, BindRenderbufferEXT@8) GL_STUB(CheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4) @@ -947,19 +951,20 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(IsFramebufferEXT, _gloffset_IsFramebufferEXT, IsFramebufferEXT@4) GL_STUB(IsRenderbufferEXT, _gloffset_IsRenderbufferEXT, IsRenderbufferEXT@4) GL_STUB(RenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT, RenderbufferStorageEXT@16) - GL_STUB(_dispatch_stub_769, _gloffset_BlitFramebufferEXT, _dispatch_stub_769@40) - HIDDEN(GL_PREFIX(_dispatch_stub_769, _dispatch_stub_769@40)) + GL_STUB(_dispatch_stub_773, _gloffset_BlitFramebufferEXT, _dispatch_stub_773@40) + HIDDEN(GL_PREFIX(_dispatch_stub_773, _dispatch_stub_773@40)) GL_STUB(FramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) - GL_STUB(_dispatch_stub_771, _gloffset_StencilFuncSeparateATI, _dispatch_stub_771@16) - HIDDEN(GL_PREFIX(_dispatch_stub_771, _dispatch_stub_771@16)) - GL_STUB(_dispatch_stub_772, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_772@16) - HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@16)) - GL_STUB(_dispatch_stub_773, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_773@16) - HIDDEN(GL_PREFIX(_dispatch_stub_773, _dispatch_stub_773@16)) - GL_STUB(_dispatch_stub_774, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_774@12) - HIDDEN(GL_PREFIX(_dispatch_stub_774, _dispatch_stub_774@12)) - GL_STUB(_dispatch_stub_775, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_775@12) - HIDDEN(GL_PREFIX(_dispatch_stub_775, _dispatch_stub_775@12)) + GL_STUB(ProvokingVertexEXT, _gloffset_ProvokingVertexEXT, ProvokingVertexEXT@4) + GL_STUB(_dispatch_stub_776, _gloffset_StencilFuncSeparateATI, _dispatch_stub_776@16) + HIDDEN(GL_PREFIX(_dispatch_stub_776, _dispatch_stub_776@16)) + GL_STUB(_dispatch_stub_777, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_777@16) + HIDDEN(GL_PREFIX(_dispatch_stub_777, _dispatch_stub_777@16)) + GL_STUB(_dispatch_stub_778, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_778@16) + HIDDEN(GL_PREFIX(_dispatch_stub_778, _dispatch_stub_778@16)) + GL_STUB(_dispatch_stub_779, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_779@12) + HIDDEN(GL_PREFIX(_dispatch_stub_779, _dispatch_stub_779@12)) + GL_STUB(_dispatch_stub_780, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_780@12) + HIDDEN(GL_PREFIX(_dispatch_stub_780, _dispatch_stub_780@12)) GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4) GL_STUB_ALIAS(BindTextureEXT, _gloffset_BindTexture, BindTextureEXT@8, BindTexture, BindTexture@8) GL_STUB_ALIAS(DrawArraysEXT, _gloffset_DrawArrays, DrawArraysEXT@12, DrawArrays, DrawArrays@12) diff --git a/src/mesa/x86/sse_xform2.S b/src/mesa/x86/sse_xform2.S index 91b82e72971..b490d4c169f 100644 --- a/src/mesa/x86/sse_xform2.S +++ b/src/mesa/x86/sse_xform2.S @@ -186,6 +186,7 @@ GLNAME(_mesa_sse_transform_points2_3d_no_rot): MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ ADD_L( EDI, ECX ) /* count += dest ptr */ + PXOR( XMM0, XMM0 ) ALIGNTEXT32 MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ diff --git a/src/mesa/x86/sse_xform3.S b/src/mesa/x86/sse_xform3.S index 1fc79ef21bd..8a79eeda18d 100644 --- a/src/mesa/x86/sse_xform3.S +++ b/src/mesa/x86/sse_xform3.S @@ -198,6 +198,7 @@ GLNAME(_mesa_sse_transform_points3_3d_no_rot): MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ ADD_L( EDI, ECX ) /* count += dest ptr */ + PXOR( XMM0, XMM0 ) ALIGNTEXT32 MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ |