From 0f82aa5f15479aea692613fb56643bf3b769cf37 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 22 Mar 2009 18:10:10 -0600 Subject: tgsi: minor comments --- src/gallium/auxiliary/tgsi/tgsi_exec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 4ffd4efbffa..0b4b2a6fb6e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -205,8 +205,8 @@ struct tgsi_exec_machine const float (*Consts)[4]; struct tgsi_exec_vector *Inputs; struct tgsi_exec_vector *Outputs; - const struct tgsi_token *Tokens; - unsigned Processor; + const struct tgsi_token *Tokens; /**< Declarations, instructions */ + unsigned Processor; /**< TGSI_PROCESSOR_x */ /* GEOMETRY processor only. */ unsigned *Primitives; -- cgit v1.2.3 From bab6d6bfe928687717a5e5f274110fe1838f99ba Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 22 Mar 2009 18:11:12 -0600 Subject: softpipe: reformatting, comments, minor clean-ups --- src/gallium/drivers/softpipe/sp_fs_exec.c | 17 ++++++++--------- src/gallium/drivers/softpipe/sp_fs_llvm.c | 14 ++++++++++---- src/gallium/drivers/softpipe/sp_fs_sse.c | 25 +++++++++++++++++++------ src/gallium/drivers/softpipe/sp_quad_fs.c | 21 ++++++++++----------- 4 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c index 0c14d92864f..9ee86fe7878 100644 --- a/src/gallium/drivers/softpipe/sp_fs_exec.c +++ b/src/gallium/drivers/softpipe/sp_fs_exec.c @@ -25,22 +25,29 @@ * **************************************************************************/ +/** + * Execute fragment shader using the TGSI interpreter. + */ #include "sp_context.h" #include "sp_state.h" #include "sp_fs.h" #include "sp_quad.h" - #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "util/u_memory.h" #include "tgsi/tgsi_exec.h" #include "tgsi/tgsi_parse.h" + +/** + * Subclass of sp_fragment_shader + */ struct sp_exec_fragment_shader { struct sp_fragment_shader base; + /* No other members for now */ }; @@ -106,8 +113,6 @@ exec_prepare( const struct sp_fragment_shader *base, } - - /* TODO: hide the machine struct in here somewhere, remove from this * interface: */ @@ -116,7 +121,6 @@ exec_run( const struct sp_fragment_shader *base, struct tgsi_exec_machine *machine, struct quad_header *quad ) { - /* Compute X, Y, Z, W vals for this quad */ sp_setup_pos_vector(quad->posCoef, (float)quad->input.x0, (float)quad->input.y0, @@ -126,7 +130,6 @@ exec_run( const struct sp_fragment_shader *base, } - static void exec_delete( struct sp_fragment_shader *base ) { @@ -135,9 +138,6 @@ exec_delete( struct sp_fragment_shader *base ) } - - - struct sp_fragment_shader * softpipe_create_fs_exec(struct softpipe_context *softpipe, const struct pipe_shader_state *templ) @@ -160,4 +160,3 @@ softpipe_create_fs_exec(struct softpipe_context *softpipe, return &shader->base; } - diff --git a/src/gallium/drivers/softpipe/sp_fs_llvm.c b/src/gallium/drivers/softpipe/sp_fs_llvm.c index f33b3e32854..95c0d982d12 100644 --- a/src/gallium/drivers/softpipe/sp_fs_llvm.c +++ b/src/gallium/drivers/softpipe/sp_fs_llvm.c @@ -25,7 +25,9 @@ * **************************************************************************/ -/* Authors: +/** + * Execute fragment shader using LLVM code generation. + * Authors: * Zack Rusin */ @@ -33,7 +35,6 @@ #include "sp_state.h" #include "sp_fs.h" - #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "util/u_memory.h" @@ -41,11 +42,16 @@ #if 0 -struct sp_llvm_fragment_shader { +/** + * Subclass of sp_fragment_shader + */ +struct sp_llvm_fragment_shader +{ struct sp_fragment_shader base; struct gallivm_prog *llvm_prog; }; + static void shade_quad_llvm(struct quad_stage *qs, struct quad_header *quad) @@ -160,7 +166,7 @@ delete_llvm_fs( struct sp_fragment_shader *base ) struct sp_fragment_shader * softpipe_create_fs_llvm(struct softpipe_context *softpipe, - const struct pipe_shader_state *templ) + const struct pipe_shader_state *templ) { struct sp_llvm_fragment_shader *shader = NULL; diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c index 366abe2ed49..31c3ca21c51 100644 --- a/src/gallium/drivers/softpipe/sp_fs_sse.c +++ b/src/gallium/drivers/softpipe/sp_fs_sse.c @@ -25,13 +25,15 @@ * **************************************************************************/ +/** + * Execute fragment shader using runtime SSE code generation. + */ #include "sp_context.h" #include "sp_state.h" #include "sp_fs.h" #include "sp_quad.h" - #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "util/u_memory.h" @@ -56,14 +58,25 @@ typedef void (PIPE_CDECL *codegen_function)( ); -struct sp_sse_fragment_shader { +/** + * Subclass of sp_fragment_shader + */ +struct sp_sse_fragment_shader +{ struct sp_fragment_shader base; - struct x86_function sse2_program; + struct x86_function sse2_program; codegen_function func; float immediates[TGSI_EXEC_NUM_IMMEDIATES][4]; }; +/** cast wrapper */ +static INLINE struct sp_sse_fragment_shader * +sp_sse_fragment_shader(const struct sp_fragment_shader *base) +{ + return (struct sp_sse_fragment_shader *) base; +} + static void fs_sse_prepare( const struct sp_fragment_shader *base, @@ -83,7 +96,7 @@ fs_sse_run( const struct sp_fragment_shader *base, struct tgsi_exec_machine *machine, struct quad_header *quad ) { - struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base; + struct sp_sse_fragment_shader *shader = sp_sse_fragment_shader(base); /* Compute X, Y, Z, W vals for this quad -- place in temp[0] for now */ sp_setup_pos_vector(quad->posCoef, @@ -110,7 +123,7 @@ fs_sse_run( const struct sp_fragment_shader *base, static void fs_sse_delete( struct sp_fragment_shader *base ) { - struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base; + struct sp_sse_fragment_shader *shader = sp_sse_fragment_shader(base); x86_release_func( &shader->sse2_program ); FREE(shader); @@ -156,7 +169,7 @@ softpipe_create_fs_sse(struct softpipe_context *softpipe, #else -/* Maybe put this varient in the header file. +/* Maybe put this variant in the header file. */ struct sp_fragment_shader * softpipe_create_fs_sse(struct softpipe_context *softpipe, diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c index adca5df73d8..ca637a1d6a4 100644 --- a/src/gallium/drivers/softpipe/sp_quad_fs.c +++ b/src/gallium/drivers/softpipe/sp_quad_fs.c @@ -65,14 +65,11 @@ quad_shade_stage(struct quad_stage *qs) } - /** * Execute fragment shader for the four fragments in the quad. */ static void -shade_quad( - struct quad_stage *qs, - struct quad_header *quad ) +shade_quad(struct quad_stage *qs, struct quad_header *quad) { struct quad_shade_stage *qss = quad_shade_stage( qs ); struct softpipe_context *softpipe = qs->softpipe; @@ -85,9 +82,7 @@ shade_quad( machine->InterpCoefs = quad->coef; /* run shader */ - quad->inout.mask &= softpipe->fs->run( softpipe->fs, - &qss->machine, - quad ); + quad->inout.mask &= softpipe->fs->run( softpipe->fs, machine, quad ); /* store outputs */ z_written = FALSE; @@ -135,15 +130,17 @@ shade_quad( } /* shader may cull fragments */ - if( quad->inout.mask ) { + if (quad->inout.mask) { qs->next->run( qs->next, quad ); } } + /** * Per-primitive (or per-begin?) setup */ -static void shade_begin(struct quad_stage *qs) +static void +shade_begin(struct quad_stage *qs) { struct quad_shade_stage *qss = quad_shade_stage(qs); struct softpipe_context *softpipe = qs->softpipe; @@ -157,7 +154,8 @@ static void shade_begin(struct quad_stage *qs) } -static void shade_destroy(struct quad_stage *qs) +static void +shade_destroy(struct quad_stage *qs) { struct quad_shade_stage *qss = (struct quad_shade_stage *) qs; @@ -168,7 +166,8 @@ static void shade_destroy(struct quad_stage *qs) } -struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe ) +struct quad_stage * +sp_quad_shade_stage( struct softpipe_context *softpipe ) { struct quad_shade_stage *qss = CALLOC_STRUCT(quad_shade_stage); -- cgit v1.2.3 From 3708aaeaff5041040783bd252768fadf2b794ec2 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 23 Mar 2009 12:05:07 +0000 Subject: util: Add a new macro for testing empty lists. --- src/gallium/auxiliary/util/u_double_list.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/auxiliary/util/u_double_list.h b/src/gallium/auxiliary/util/u_double_list.h index d108d92e52b..53bb1342ddc 100644 --- a/src/gallium/auxiliary/util/u_double_list.h +++ b/src/gallium/auxiliary/util/u_double_list.h @@ -95,5 +95,8 @@ struct list_head #define LIST_ENTRY(__type, __item, __field) \ ((__type *)(((char *)(__item)) - offsetof(__type, __field))) +#define LIST_IS_EMPTY(__list) \ + ((__list)->next == (__list)) + #endif /*_U_DOUBLE_LIST_H_*/ -- cgit v1.2.3 From 1196885293f19003472276a6446a1904e9c69112 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 20 Mar 2009 23:06:05 +0100 Subject: trace: Fix args to buffer write --- src/gallium/drivers/trace/tr_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 954576d7217..c83ec4e30e6 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -706,7 +706,7 @@ trace_screen_buffer_unmap(struct pipe_screen *_screen, struct pipe_buffer *buffer = tr_buf->buffer; if (tr_buf->map && !tr_buf->range_flushed) - buffer_write(screen, buffer, tr_buf->map, 0, buffer->size); + buffer_write(screen, buffer, 0, tr_buf->map, buffer->size); tr_buf->map = NULL; tr_buf->range_flushed = FALSE; screen->buffer_unmap(screen, buffer); -- cgit v1.2.3 From da96767c8971e792285e3190c708438d65802379 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 21 Mar 2009 14:23:04 +0100 Subject: debug: Add function for writing transfers to files --- src/gallium/auxiliary/util/u_debug.c | 71 ++++++++++++++++++++---------------- src/gallium/auxiliary/util/u_debug.h | 3 ++ 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index f96e27e09fd..0af69d8c8f0 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -715,78 +715,85 @@ struct bmp_rgb_quad { uint8_t rgbAlpha; }; -void +void debug_dump_surface_bmp(const char *filename, struct pipe_surface *surface) { -#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT + struct pipe_transfer *transfer; struct pipe_texture *texture; struct pipe_screen *screen; + + transfer = screen->get_tex_transfer(screen, texture, surface->face, + surface->level, surface->zslice, + PIPE_TRANSFER_READ, 0, 0, surface->width, + surface->height); + + debug_dump_transfer_bmp(filename, transfer); + + screen->tex_transfer_destroy(transfer); +} + +void +debug_dump_transfer_bmp(const char *filename, + struct pipe_transfer *transfer) +{ +#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT struct util_stream *stream; - struct pipe_transfer *transfer; struct bmp_file_header bmfh; struct bmp_info_header bmih; float *rgba; unsigned x, y; - if (!surface) + if (!transfer) goto error1; - rgba = MALLOC(surface->width*4*sizeof(float)); + rgba = MALLOC(transfer->width*transfer->height*4*sizeof(float)); if(!rgba) goto error1; - + bmfh.bfType = 0x4d42; - bmfh.bfSize = 14 + 40 + surface->height*surface->width*4; + bmfh.bfSize = 14 + 40 + transfer->height*transfer->width*4; bmfh.bfReserved1 = 0; bmfh.bfReserved2 = 0; bmfh.bfOffBits = 14 + 40; - + bmih.biSize = 40; - bmih.biWidth = surface->width; - bmih.biHeight = surface->height; + bmih.biWidth = transfer->width; + bmih.biHeight = transfer->height; bmih.biPlanes = 1; bmih.biBitCount = 32; bmih.biCompression = 0; - bmih.biSizeImage = surface->height*surface->width*4; + bmih.biSizeImage = transfer->height*transfer->width*4; bmih.biXPelsPerMeter = 0; bmih.biYPelsPerMeter = 0; bmih.biClrUsed = 0; bmih.biClrImportant = 0; - + stream = util_stream_create(filename, bmfh.bfSize); if(!stream) goto error2; - + util_stream_write(stream, &bmfh, 14); util_stream_write(stream, &bmih, 40); - texture = surface->texture; - screen = texture->screen; - - transfer = screen->get_tex_transfer(screen, texture, surface->face, - surface->level, surface->zslice, - PIPE_TRANSFER_READ, 0, 0, surface->width, - surface->height); + pipe_get_tile_rgba(transfer, 0, 0, + transfer->width, transfer->height, + rgba); - y = surface->height; + y = transfer->height; while(y--) { - pipe_get_tile_rgba(transfer, - 0, y, surface->width, 1, - rgba); - for(x = 0; x < surface->width; ++x) + float *ptr = rgba + (transfer->width * y * 4); + for(x = 0; x < transfer->width; ++x) { struct bmp_rgb_quad pixel; - pixel.rgbRed = float_to_ubyte(rgba[x*4 + 0]); - pixel.rgbGreen = float_to_ubyte(rgba[x*4 + 1]); - pixel.rgbBlue = float_to_ubyte(rgba[x*4 + 2]); - pixel.rgbAlpha = float_to_ubyte(rgba[x*4 + 3]); + pixel.rgbRed = float_to_ubyte(ptr[x*4 + 0]); + pixel.rgbGreen = float_to_ubyte(ptr[x*4 + 1]); + pixel.rgbBlue = float_to_ubyte(ptr[x*4 + 2]); + pixel.rgbAlpha = 255; util_stream_write(stream, &pixel, 4); - } + } } - screen->tex_transfer_destroy(transfer); - util_stream_close(stream); error2: FREE(rgba); diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 7c829707b20..33e7cb3419e 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -338,6 +338,7 @@ debug_profile_stop(void); #ifdef DEBUG struct pipe_surface; +struct pipe_transfer; void debug_dump_image(const char *prefix, unsigned format, unsigned cpp, unsigned width, unsigned height, @@ -347,6 +348,8 @@ void debug_dump_surface(const char *prefix, struct pipe_surface *surface); void debug_dump_surface_bmp(const char *filename, struct pipe_surface *surface); +void debug_dump_transfer_bmp(const char *filename, + struct pipe_transfer *transfer); #else #define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0) #define debug_dump_surface(prefix, surface) ((void)0) -- cgit v1.2.3 From e9d156e9e4f92ae1ce70bd563c251b34d238c4bc Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 23 Mar 2009 18:03:13 +0100 Subject: gallium: Remove remnants of reference counting internals outside of p_refcnt.h. --- src/gallium/auxiliary/pipebuffer/pb_buffer.h | 8 ++++---- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 8 ++++---- src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 6 +++--- src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 4 ++-- src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c | 2 +- src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c | 4 ++-- src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 2 +- src/gallium/drivers/softpipe/sp_texture.c | 1 - src/gallium/include/pipe/p_refcnt.h | 12 ++++++++++-- src/mesa/state_tracker/st_texture.c | 2 +- 10 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h index 2a1315922a8..92b6fd00564 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h @@ -158,7 +158,7 @@ pb_map(struct pb_buffer *buf, assert(buf); if(!buf) return NULL; - assert(p_atomic_read(&buf->base.reference.count) > 0); + assert(pipe_is_referenced(&buf->base.reference)); return buf->vtbl->map(buf, flags); } @@ -169,7 +169,7 @@ pb_unmap(struct pb_buffer *buf) assert(buf); if(!buf) return; - assert(p_atomic_read(&buf->base.reference.count) > 0); + assert(pipe_is_referenced(&buf->base.reference)); buf->vtbl->unmap(buf); } @@ -185,7 +185,7 @@ pb_get_base_buffer( struct pb_buffer *buf, offset = 0; return; } - assert(p_atomic_read(&buf->base.reference.count) > 0); + assert(pipe_is_referenced(&buf->base.reference)); assert(buf->vtbl->get_base_buffer); buf->vtbl->get_base_buffer(buf, base_buf, offset); assert(*base_buf); @@ -221,7 +221,7 @@ pb_destroy(struct pb_buffer *buf) assert(buf); if(!buf) return; - assert(p_atomic_read(&buf->base.reference.count) == 0); + assert(!pipe_is_referenced(&buf->base.reference)); buf->vtbl->destroy(buf); } diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 1bdf7a0b2da..48d76a7af79 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -115,7 +115,7 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf) { struct fenced_buffer_list *fenced_list = fenced_buf->list; - assert(p_atomic_read(&fenced_buf->base.base.reference.count)); + assert(pipe_is_referenced(&fenced_buf->base.base.reference)); assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE); assert(fenced_buf->fence); @@ -137,7 +137,7 @@ _fenced_buffer_destroy(struct fenced_buffer *fenced_buf) { struct fenced_buffer_list *fenced_list = fenced_buf->list; - assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0); + assert(!pipe_is_referenced(&fenced_buf->base.base.reference)); assert(!fenced_buf->fence); #ifdef DEBUG assert(fenced_buf->head.prev); @@ -181,7 +181,7 @@ _fenced_buffer_remove(struct fenced_buffer_list *fenced_list, * FIXME!!! */ - if(!p_atomic_read(&fenced_buf->base.base.reference.count)) + if(!pipe_is_referenced(&fenced_buf->base.base.reference)) _fenced_buffer_destroy(fenced_buf); } @@ -257,7 +257,7 @@ fenced_buffer_destroy(struct pb_buffer *buf) struct fenced_buffer_list *fenced_list = fenced_buf->list; pipe_mutex_lock(fenced_list->mutex); - assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0); + assert(!pipe_is_referenced(&fenced_buf->base.base.reference)); if (fenced_buf->fence) { struct pb_fence_ops *ops = fenced_list->ops; if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) { diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index 010a2ecc1fa..35358430b43 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c @@ -112,7 +112,7 @@ _pb_cache_buffer_destroy(struct pb_cache_buffer *buf) LIST_DEL(&buf->head); assert(mgr->numDelayed); --mgr->numDelayed; - assert(p_atomic_read(&buf->base.base.reference.count) == 0); + assert(!pipe_is_referenced(&buf->base.base.reference)); pb_reference(&buf->buffer, NULL); FREE(buf); } @@ -153,7 +153,7 @@ pb_cache_buffer_destroy(struct pb_buffer *_buf) struct pb_cache_manager *mgr = buf->mgr; pipe_mutex_lock(mgr->mutex); - assert(p_atomic_read(&buf->base.base.reference.count) == 0); + assert(!pipe_is_referenced(&buf->base.base.reference)); _pb_cache_buffer_list_check_free(mgr); @@ -310,7 +310,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr, return NULL; } - assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1); + assert(pipe_is_referenced(&buf->buffer->base.reference)); assert(pb_check_alignment(desc->alignment, buf->buffer->base.alignment)); assert(pb_check_usage(desc->usage, buf->buffer->base.usage)); assert(buf->buffer->base.size >= size); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index 478682dbee9..f1a05be46e4 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -208,7 +208,7 @@ pb_debug_buffer_destroy(struct pb_buffer *_buf) { struct pb_debug_buffer *buf = pb_debug_buffer(_buf); - assert(p_atomic_read(&buf->base.base.reference.count) == 0); + assert(!pipe_is_referenced(&buf->base.base.reference)); pb_debug_buffer_check(buf); @@ -315,7 +315,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, return NULL; } - assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1); + assert(pipe_is_referenced(&buf->buffer->base.reference)); assert(pb_check_alignment(real_desc.alignment, buf->buffer->base.alignment)); assert(pb_check_usage(real_desc.usage, buf->buffer->base.usage)); assert(buf->buffer->base.size >= real_size); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c index fb18dcc5dca..5a342fbf3b1 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c @@ -97,7 +97,7 @@ mm_buffer_destroy(struct pb_buffer *buf) struct mm_buffer *mm_buf = mm_buffer(buf); struct mm_pb_manager *mm = mm_buf->mgr; - assert(p_atomic_read(&mm_buf->base.base.reference.count) == 0); + assert(!pipe_is_referenced(&mm_buf->base.base.reference)); pipe_mutex_lock(mm->mutex); u_mmFreeMem(mm_buf->block); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c index 75b95e132e8..07fd1a22d93 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c @@ -108,7 +108,7 @@ pool_buffer_destroy(struct pb_buffer *buf) struct pool_buffer *pool_buf = pool_buffer(buf); struct pool_pb_manager *pool = pool_buf->mgr; - assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0); + assert(!pipe_is_referenced(&pool_buf->base.base.reference)); pipe_mutex_lock(pool->mutex); LIST_ADD(&pool_buf->head, &pool->free); @@ -216,7 +216,7 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr, pipe_mutex_unlock(pool->mutex); pool_buf = LIST_ENTRY(struct pool_buffer, item, head); - assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0); + assert(!pipe_is_referenced(&pool_buf->base.base.reference)); pipe_reference_init(&pool_buf->base.base.reference, 1); pool_buf->base.base.alignment = desc->alignment; pool_buf->base.base.usage = desc->usage; diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c index a431fd5211e..724aaadb436 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c @@ -202,7 +202,7 @@ pb_slab_buffer_destroy(struct pb_buffer *_buf) pipe_mutex_lock(mgr->mutex); - assert(p_atomic_read(&buf->base.base.reference.count) == 0); + assert(!pipe_is_referenced(&buf->base.base.reference)); buf->mapCount = 0; diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 48b2c22af45..e3c577c2494 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -138,7 +138,6 @@ softpipe_texture_create(struct pipe_screen *screen, goto fail; } - assert(p_atomic_read(&spt->base.reference.count) == 1); return &spt->base; fail: diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h index 60844e40a57..1f89453e09a 100644 --- a/src/gallium/include/pipe/p_refcnt.h +++ b/src/gallium/include/pipe/p_refcnt.h @@ -51,6 +51,13 @@ pipe_reference_init(struct pipe_reference *reference, unsigned count) } +static INLINE bool +pipe_is_referenced(struct pipe_reference *reference) +{ + return p_atomic_read(&reference->count) != 0; +} + + /** * Set 'ptr' to point to 'reference' and update reference counting. * The old thing pointed to, if any, will be unreferenced first. @@ -65,12 +72,12 @@ pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference) /* bump the reference.count first */ if (reference) { - assert(p_atomic_read(&reference->count) != 0); + assert(pipe_is_referenced(reference)); p_atomic_inc(&reference->count); } if (*ptr) { - assert(p_atomic_read(&(*ptr)->count) != 0); + assert(pipe_is_referenced(*ptr)); if (p_atomic_dec_zero(&(*ptr)->count)) { destroy = TRUE; } @@ -81,6 +88,7 @@ pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference) return destroy; } + #ifdef __cplusplus } #endif diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 6f274d6d69b..3f90ad502c2 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -107,7 +107,7 @@ st_texture_create(struct st_context *st, newtex = screen->texture_create(screen, &pt); - assert(!newtex || p_atomic_read(&newtex->reference.count) == 1); + assert(!newtex || pipe_is_referenced(&newtex->reference)); return newtex; } -- cgit v1.2.3 From 103a4bd71136b14424a4af5a2eadf56c51692115 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 23 Mar 2009 18:37:33 +0000 Subject: progs/fp: pass texcoord to triangle, add a test shader --- progs/fp/fp-tri.c | 6 ++++++ progs/fp/kil-pos.txt | 9 +++++++++ progs/fp/kil-texcoord-sgt.txt | 8 ++++++++ progs/fp/kill-pos.txt | 9 --------- 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 progs/fp/kil-pos.txt create mode 100644 progs/fp/kil-texcoord-sgt.txt delete mode 100644 progs/fp/kill-pos.txt diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index bc490c05201..6c15540d38d 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -210,11 +210,17 @@ static void Display(void) glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, 1.0, 1.0, 0.0, 0.0); glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 0.0, 0.0, 1.0, 1.0); glBegin(GL_TRIANGLES); + glColor3f(0,0,1); + glTexCoord3f(1,1,0); glVertex3f( 0.9, -0.9, -30.0); + glColor3f(1,0,0); + glTexCoord3f(1,-1,0); glVertex3f( 0.9, 0.9, -30.0); + glColor3f(0,1,0); + glTexCoord3f(-1,0,0); glVertex3f(-0.9, 0.0, -30.0); glEnd(); diff --git a/progs/fp/kil-pos.txt b/progs/fp/kil-pos.txt new file mode 100644 index 00000000000..5ff4f6f2c84 --- /dev/null +++ b/progs/fp/kil-pos.txt @@ -0,0 +1,9 @@ +!!ARBfp1.0 +TEMP R0; +SUB R0.xy, fragment.position, {125}.x; +MOV R0.zw, {0}.x; +DP3 R0, R0, R0; +SUB R0.x, R0, {10000}.x; +KIL -R0.x; +MOV result.color, fragment.color; +END diff --git a/progs/fp/kil-texcoord-sgt.txt b/progs/fp/kil-texcoord-sgt.txt new file mode 100644 index 00000000000..c74fd10dacb --- /dev/null +++ b/progs/fp/kil-texcoord-sgt.txt @@ -0,0 +1,8 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0.xy, fragment.texcoord[0], fragment.texcoord[0]; +ADD R0.x, R0.x, R0.y; +SGE R0.y, R0.x, fragment.texcoord[0].w; +KIL -R0.y; +MOV result.color, fragment.color; +END diff --git a/progs/fp/kill-pos.txt b/progs/fp/kill-pos.txt deleted file mode 100644 index 5ff4f6f2c84..00000000000 --- a/progs/fp/kill-pos.txt +++ /dev/null @@ -1,9 +0,0 @@ -!!ARBfp1.0 -TEMP R0; -SUB R0.xy, fragment.position, {125}.x; -MOV R0.zw, {0}.x; -DP3 R0, R0, R0; -SUB R0.x, R0, {10000}.x; -KIL -R0.x; -MOV result.color, fragment.color; -END -- cgit v1.2.3 From d0d5e6a22cca4aae487be6828d1dd87621929a7d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 23 Mar 2009 18:38:11 +0000 Subject: draw: update aa points shader comment --- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index 5008086cf26..3133abe5dc7 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -286,7 +286,7 @@ aa_transform_inst(struct tgsi_transform_context *ctx, ctx->emit_instruction(ctx, &newInst); #endif - /* SGT t0.y, t0.xxxx, t0.wwww; # bool b = d > 1 (NOTE t0.w == 1) */ + /* SGT t0.y, t0.xxxx, tex.wwww; # bool b = d > 1 (NOTE tex.w == 1) */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_SGT; newInst.Instruction.NumDstRegs = 1; -- cgit v1.2.3 From 1a28750b43d3d5190ad88278945dc7b15209dd3f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 23 Mar 2009 19:01:40 +0000 Subject: vpglsl: add missing SConscript --- progs/vpglsl/SConscript | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 progs/vpglsl/SConscript diff --git a/progs/vpglsl/SConscript b/progs/vpglsl/SConscript new file mode 100644 index 00000000000..640c5dd8470 --- /dev/null +++ b/progs/vpglsl/SConscript @@ -0,0 +1,13 @@ +Import('env') + +if not env['GLUT']: + Return() + +env = env.Clone() + +env.Prepend(LIBS = ['$GLUT_LIB']) + +env.Program( + target = 'vp-tris', + source = ['vp-tris.c'], + ) -- cgit v1.2.3 From c0d6e07909733af054cc592e2cfc6212155b0a9e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Mar 2009 12:29:02 -0700 Subject: i965: Fix occlusion query when no other WM state updates occur. Turns out that XXX comment was important. We weren't flagging the WM to re-update with the statistics enable, so we got zeroes out of our query. Bug #20740, fixes piglit occlusion_query test. Signed-off-by: Eric Anholt --- src/mesa/drivers/dri/i965/brw_wm_state.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 63fc8a004fd..5b14074502a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -113,7 +113,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) /* temporary sanity check assertion */ ASSERT(bfp->isGLSL == brw_wm_is_glsl(fp)); - /* XXX: This needs a flag to indicate when it changes. */ + /* _NEW_DEPTH */ key->stats_wm = intel->stats_wm; /* _NEW_LINE */ @@ -282,7 +282,8 @@ const struct brw_tracked_state brw_wm_unit = { .mesa = (_NEW_POLYGON | _NEW_POLYGONSTIPPLE | _NEW_LINE | - _NEW_COLOR), + _NEW_COLOR | + _NEW_DEPTH), .brw = (BRW_NEW_FRAGMENT_PROGRAM | BRW_NEW_CURBE_OFFSETS | -- cgit v1.2.3 From bae07564c487b3cb02ba060edbb57a895874738a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Mar 2009 13:48:24 -0700 Subject: i965: Fix trailing "d" in debug output for 3DSTATE_VERTEX_ELEMENTS. --- src/mesa/drivers/dri/intel/intel_decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_decode.c b/src/mesa/drivers/dri/intel/intel_decode.c index f2e2e619358..f04638206d5 100644 --- a/src/mesa/drivers/dri/intel/intel_decode.c +++ b/src/mesa/drivers/dri/intel/intel_decode.c @@ -1513,7 +1513,7 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures) for (i = 1; i < len;) { instr_out(data, hw_offset, i, "buffer %d: %svalid, type 0x%04x, " - "src offset 0x%04xd bytes\n", + "src offset 0x%04x bytes\n", data[i] >> 27, data[i] & (1 << 26) ? "" : "in", (data[i] >> 16) & 0x1ff, -- cgit v1.2.3 From b013f945d8514ed827183a4cbfbc4dccc100704f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Mar 2009 22:30:12 -0700 Subject: i965: Clean up a bit of mess with unneeded variables in emit_interp. --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 533be3858e9..cff50b85e26 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -313,18 +313,13 @@ static void emit_interp( struct brw_wm_compile *c, struct prog_dst_register dst = dst_reg(PROGRAM_INPUT, idx); struct prog_src_register interp = src_reg(PROGRAM_PAYLOAD, idx); struct prog_src_register deltas = get_delta_xy(c); - struct prog_src_register arg2; - GLuint opcode; - + /* Need to use PINTERP on attributes which have been * multiplied by 1/W in the SF program, and LINTERP on those * which have not: */ switch (idx) { case FRAG_ATTRIB_WPOS: - opcode = WM_LINTERP; - arg2 = src_undef(); - /* Have to treat wpos.xy specially: */ emit_op(c, @@ -345,7 +340,7 @@ static void emit_interp( struct brw_wm_compile *c, 0, interp, deltas, - arg2); + src_undef()); break; case FRAG_ATTRIB_COL0: case FRAG_ATTRIB_COL1: -- cgit v1.2.3 From 411d913ccea362dbd75411266d7abb685214ee93 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Mar 2009 22:35:03 -0700 Subject: i965: Fix fog coordinate g,b,a values when glFrontFacing isn't used. Previously, we would sample (f,glFrontFacing,undef,undef) instead of the (f,0,0,1) that fragment.fogcoord is supposed to return. Due to glFrontFacing's presence in FOGC.y, we'll still give bad results there when glFrontFacing is used. Bug #19122, piglit testcase fp-fog. --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index cff50b85e26..63a7593449a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -363,6 +363,56 @@ static void emit_interp( struct brw_wm_compile *c, src_undef()); } break; + case FRAG_ATTRIB_FOGC: + /* The FOGC input is really special. When a program uses glFogFragCoord, + * the results returned are supposed to be (f,0,0,1). But for Mesa GLSL, + * the glFrontFacing and glPointCoord values are also stashed in FOGC. + * So, write the interpolated fog value to X, then either 0, 1, or the + * stashed values to Y, Z, W. Note that this means that + * glFogFragCoord.yzw can be wrong in those cases! + */ + + /* Interpolate the fog coordinate */ + emit_op(c, + WM_PINTERP, + dst_mask(dst, WRITEMASK_X), + 0, + interp, + deltas, + get_pixel_w(c)); + + /* Move the front facing value into FOGC.y if it's needed. */ + if (c->fp->program.UsesFrontFacing) { + emit_op(c, + WM_PINTERP, + dst_mask(dst, WRITEMASK_Y), + 0, + interp, + deltas, + get_pixel_w(c)); + } else { + emit_op(c, + OPCODE_MOV, + dst_mask(dst, WRITEMASK_Y), + 0, + src_swizzle1(interp, SWIZZLE_ZERO), + src_undef(), + src_undef()); + } + + /* Should do the PointCoord thing here. */ + emit_op(c, + OPCODE_MOV, + dst_mask(dst, WRITEMASK_ZW), + 0, + src_swizzle(interp, + SWIZZLE_ZERO, + SWIZZLE_ZERO, + SWIZZLE_ZERO, + SWIZZLE_ONE), + src_undef(), + src_undef()); + break; default: emit_op(c, WM_PINTERP, -- cgit v1.2.3 From 699db6d842c52d0b3b98b320f8ef1104a65fa783 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Mar 2009 16:29:31 -0700 Subject: i965: Fix glFrontFacing in twoside GLSL demo. This also cuts instructions by just using the existing bit in the payload rather than computing it from the determinant in the SF unit and passing it as a varying down to the WM. Something still goes wrong with getting the backface color right, but a simpler shader appears to get the right result. --- src/mesa/drivers/dri/i965/brw_sf_emit.c | 32 ------------------------------- src/mesa/drivers/dri/i965/brw_wm.c | 2 ++ src/mesa/drivers/dri/i965/brw_wm.h | 3 ++- src/mesa/drivers/dri/i965/brw_wm_debug.c | 3 +++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 32 +++++++++++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm_fp.c | 11 ++++++----- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 33 ++++++++++++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm_pass1.c | 1 + 8 files changed, 79 insertions(+), 38 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c index ffdb0ae6df8..862835f157a 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_emit.c +++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c @@ -59,37 +59,6 @@ static GLboolean have_attr(struct brw_sf_compile *c, return (c->key.attrs & (1<func; - int i; - - if (!have_attr(c, VERT_RESULT_FOGC)) - return; - - brw_push_insn_state(p); - brw_CMP(p, brw_null_reg(), - c->key.frontface_ccw ? BRW_CONDITIONAL_G : BRW_CONDITIONAL_L, - c->det, brw_imm_f(0)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - for (i = 0; i < 3; i++) { - struct brw_reg fogc = get_vert_attr(c, c->vert[i],FRAG_ATTRIB_FOGC); - brw_MOV(p, get_element(fogc, 1), brw_imm_f(0)); - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); - brw_MOV(p, get_element(fogc, 1), brw_imm_f(1)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - } - brw_pop_insn_state(p); -} - - /*********************************************************************** * Twoside lighting */ @@ -384,7 +353,6 @@ void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate) invert_det(c); copy_z_inv_w(c); - do_front_facing(c); if (c->key.do_twoside_color) do_twoside_color(c); diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 1645ca0b70e..7909fd65a93 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -40,6 +40,8 @@ GLuint brw_wm_nr_args( GLuint opcode ) { switch (opcode) { + case WM_FRONTFACING: + return 0; case WM_PIXELXY: case WM_CINTERP: case WM_WPOSXY: diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 7f0e5702f2e..03dc08fcca9 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -172,7 +172,8 @@ struct brw_wm_instruction { #define WM_CINTERP (MAX_OPCODE + 5) #define WM_WPOSXY (MAX_OPCODE + 6) #define WM_FB_WRITE (MAX_OPCODE + 7) -#define MAX_WM_OPCODE (MAX_OPCODE + 8) +#define WM_FRONTFACING (MAX_OPCODE + 8) +#define MAX_WM_OPCODE (MAX_OPCODE + 9) #define PROGRAM_PAYLOAD (PROGRAM_FILE_MAX) #define PAYLOAD_DEPTH (FRAG_ATTRIB_MAX) diff --git a/src/mesa/drivers/dri/i965/brw_wm_debug.c b/src/mesa/drivers/dri/i965/brw_wm_debug.c index 8f07f89ebc5..220821087c1 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_debug.c +++ b/src/mesa/drivers/dri/i965/brw_wm_debug.c @@ -130,6 +130,9 @@ void brw_wm_print_insn( struct brw_wm_compile *c, case WM_FB_WRITE: _mesa_printf(" = FB_WRITE"); break; + case WM_FRONTFACING: + _mesa_printf(" = FRONTFACING"); + break; default: _mesa_printf(" = %s", _mesa_opcode_string(inst->opcode)); break; diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index f2dca9caa6c..4372ed3d9a1 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -254,6 +254,34 @@ static void emit_cinterp( struct brw_compile *p, } } +/* Sets the destination channels to 1.0 or 0.0 according to glFrontFacing. */ +static void emit_frontfacing( struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask ) +{ + struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); + GLuint i; + + if (!(mask & WRITEMASK_XYZW)) + return; + + for (i = 0; i < 4; i++) { + if (mask & (1<target, inst->eot); break; + case WM_FRONTFACING: + emit_frontfacing(p, dst, dst_flags); + break; + /* Straightforward arithmetic: */ case OPCODE_ADD: diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 63a7593449a..a7f5f1b9a28 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -58,7 +58,8 @@ static const char *wm_opcode_strings[] = { "PINTERP", "CINTERP", "WPOSXY", - "FB_WRITE" + "FB_WRITE", + "FRONTFACING", }; #if 0 @@ -384,12 +385,12 @@ static void emit_interp( struct brw_wm_compile *c, /* Move the front facing value into FOGC.y if it's needed. */ if (c->fp->program.UsesFrontFacing) { emit_op(c, - WM_PINTERP, + WM_FRONTFACING, dst_mask(dst, WRITEMASK_Y), 0, - interp, - deltas, - get_pixel_w(c)); + src_undef(), + src_undef(), + src_undef()); } else { emit_op(c, OPCODE_MOV, diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 4cf092226cf..b3c15fe87f8 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -653,6 +653,36 @@ static void emit_pinterp(struct brw_wm_compile *c, } } +/* Sets the destination channels to 1.0 or 0.0 according to glFrontFacing. */ +static void emit_frontfacing(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); + struct brw_reg dst; + GLuint mask = inst->DstReg.WriteMask; + int i; + + for (i = 0; i < 4; i++) { + if (mask & (1< Date: Sun, 22 Mar 2009 08:46:18 +0100 Subject: progs/tests: Build texcompress2 with scons --- progs/tests/SConscript | 1 + progs/tests/texcompress2.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/tests/SConscript b/progs/tests/SConscript index cfeb9d1c378..bf1e7f8a7d8 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -105,6 +105,7 @@ progs = [ 'subtexrate', 'tex1d', 'texcmp', + 'texcompress2', 'texfilt', 'texgenmix', 'texline', diff --git a/progs/tests/texcompress2.c b/progs/tests/texcompress2.c index 3e8e9908cbe..cbb8f1d3a22 100644 --- a/progs/tests/texcompress2.c +++ b/progs/tests/texcompress2.c @@ -7,7 +7,6 @@ #include #include #include -#include #include "readtex.c" #define IMAGE_FILE "../images/arch.rgb" -- cgit v1.2.3 From 2312f697a27da366ecda9cbae9ddf8c63de910d5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Mar 2009 15:27:21 +0000 Subject: progs/trivial: draw non-interleaved arrays out of one vbo --- progs/trivial/Makefile | 1 + progs/trivial/SConscript | 1 + progs/trivial/tri-multitex-vbo.c | 260 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 262 insertions(+) create mode 100644 progs/trivial/tri-multitex-vbo.c diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 082387d86ea..69c71cbaf61 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -111,6 +111,7 @@ SOURCES = \ tri-scissor-tri.c \ tri-stencil.c \ tri-stipple.c \ + tri-multitex-vbo.c \ tri-tex.c \ tri-tex-3d.c \ tri-tri.c \ diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript index 6a9ffafe509..480630e210e 100644 --- a/progs/trivial/SConscript +++ b/progs/trivial/SConscript @@ -107,6 +107,7 @@ progs = [ 'tri-scissor-tri', 'tri-stencil', 'tri-stipple', + 'tri-multitex-vbo', 'tri-tex', 'tri-tex-3d', 'tri-tri', diff --git a/progs/trivial/tri-multitex-vbo.c b/progs/trivial/tri-multitex-vbo.c new file mode 100644 index 00000000000..76e117a333f --- /dev/null +++ b/progs/trivial/tri-multitex-vbo.c @@ -0,0 +1,260 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF + * ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include + +#define NR_VERTS 4 + +struct { + GLfloat position[NR_VERTS][4]; + GLubyte color[NR_VERTS][4]; + GLfloat tex0[NR_VERTS][2]; + GLfloat tex1[NR_VERTS][2]; +} verts = { + + { { 0.9, -0.9, 0.0, 1.0 }, + { 0.9, 0.9, 0.0, 1.0 }, + { -0.9, 0.9, 0.0, 1.0 }, + { -0.9, -0.9, 0.0, 1.0 } }, + + { { 0x00, 0x00, 0xff, 0x00 }, + { 0x00, 0xff, 0x00, 0x00 }, + { 0xff, 0x00, 0x00, 0x00 }, + { 0xff, 0xff, 0xff, 0x00 } + }, + + { { 1, -1 }, + { 1, 1 }, + { -1, 1 }, + { -1, -1 } }, + + { { 3, 0 }, + { 0, 3 }, + { -3, 0 }, + { 0, -3} }, + +}; + +GLuint indices[] = { 0, 1, 2, 3 }; + +GLuint arrayObj, elementObj; + + +GLenum doubleBuffer; + + +#define Offset(ptr, member) (void *)((const char *)&((ptr)->member) - (const char *)(ptr)) + +static void Init(void) +{ + GLuint texObj[2]; + + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + + glClearColor(0.0, 0.0, 1.0, 0.0); + + glGenTextures(2, texObj); + +#define SIZE 32 + { + GLubyte tex2d[SIZE][SIZE][3]; + GLint s, t; + + for (s = 0; s < SIZE; s++) { + for (t = 0; t < SIZE; t++) { + tex2d[t][s][0] = s*255/(SIZE-1); + tex2d[t][s][1] = t*255/(SIZE-1); + tex2d[t][s][2] = 0; + } + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glActiveTextureARB(GL_TEXTURE0_ARB); + glBindTexture(GL_TEXTURE_2D, texObj[0]); + + + glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0, + GL_RGB, GL_UNSIGNED_BYTE, tex2d); + + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + } + + { + GLubyte tex2d[SIZE][SIZE][3]; + GLint s, t; + + for (s = 0; s < SIZE; s++) { + for (t = 0; t < SIZE; t++) { + GLboolean on = ((s/4) ^ (t/4)) & 1; + tex2d[t][s][0] = on ? 128 : 0; + tex2d[t][s][1] = on ? 128 : 0; + tex2d[t][s][2] = on ? 128 : 0; + } + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glActiveTextureARB(GL_TEXTURE1_ARB); + glBindTexture(GL_TEXTURE_2D, texObj[1]); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0, + GL_RGB, GL_UNSIGNED_BYTE, tex2d); + + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + } + + glActiveTextureARB( GL_TEXTURE0_ARB ); + + + { + + glGenBuffersARB(1, &arrayObj); + glGenBuffersARB(1, &elementObj); + + glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); + glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj); + + glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), &verts, GL_STATIC_DRAW_ARB); + glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB); + + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 4, GL_FLOAT, 0, Offset(&verts, position) ); + + glEnableClientState( GL_COLOR_ARRAY ); + glColorPointer( 4, GL_UNSIGNED_BYTE, 0, Offset(&verts, color) ); + + glClientActiveTextureARB( GL_TEXTURE0_ARB ); + glEnableClientState( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer( 2, GL_FLOAT, 0, Offset(&verts, tex0) ); + + glClientActiveTextureARB( GL_TEXTURE1_ARB ); + glEnableClientState( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer( 2, GL_FLOAT, 0, Offset(&verts, tex1) ); + + glClientActiveTextureARB( GL_TEXTURE0_ARB ); + } +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); +/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL ); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + fprintf(stderr, "%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); + + type = GLUT_RGB | GLUT_ALPHA; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(*argv) == GL_FALSE) { + exit(1); + } + + glewInit(); + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From cc8afbd3862fedfe42e51c3774960d1c7078ec53 Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Tue, 24 Mar 2009 09:53:22 -0600 Subject: i965: fix point rasterization when rendering to FBO The FBO pixel coordinate system, with (0,0) as the upper-left pixel, is inverted in Y compared to the normal OpenGL pixel coordinate system, which has (0,0) as its lower-left pixel. Viewport and polygon stipple are sensitive to this inversion; so is point rasterization. The basic fix is simple: when rendering to an FBO, instead of the normal RASTRULE_UPPER_RIGHT that's appropriate for OpenGL windows, use the Y inversion RASTRULE_LOWER_RIGHT. Unfortunately, current Intel documentation has this value listed as "Reserved, but not seen as useful". It does work on at least some i965-class devices, though; and the worst that could happen if an older device didn't support it would be incorrect point rasterization to FBOs, which is what happens already, so this fix is at least no worse than what happens presently, and is better for some (and possibly all) i965-class devices. --- src/gallium/drivers/i965simple/brw_defines.h | 18 ++++++++++++++++++ src/mesa/drivers/dri/i965/brw_defines.h | 18 ++++++++++++++++++ src/mesa/drivers/dri/i965/brw_sf_state.c | 28 +++++++++++++++++++++++++++- 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/i965simple/brw_defines.h b/src/gallium/drivers/i965simple/brw_defines.h index 9379a397f63..715d2d2d011 100644 --- a/src/gallium/drivers/i965simple/brw_defines.h +++ b/src/gallium/drivers/i965simple/brw_defines.h @@ -289,6 +289,24 @@ #define BRW_RASTRULE_UPPER_LEFT 0 #define BRW_RASTRULE_UPPER_RIGHT 1 +/* These are listed as "Reserved, but not seen as useful" + * in Intel documentation (page 212, "Point Rasterization Rule", + * section 7.4 "SF Pipeline State Summary", of document + * "Intel® 965 Express Chipset Family and Intel® G35 Express + * Chipset Graphics Controller Programmer's Reference Manual, + * Volume 2: 3D/Media", Revision 1.0b as of January 2008, + * available at + * http://intellinuxgraphics.org/documentation.html + * at the time of this writing). + * + * These appear to be supported on at least some + * i965-family devices, and the BRW_RASTRULE_LOWER_RIGHT + * is useful when using OpenGL to render to a FBO + * (which has the pixel coordinate Y orientation inverted + * with respect to the normal OpenGL pixel coordinate system). + */ +#define BRW_RASTRULE_LOWER_LEFT 2 +#define BRW_RASTRULE_LOWER_RIGHT 3 #define BRW_RENDERTARGET_CLAMPRANGE_UNORM 0 #define BRW_RENDERTARGET_CLAMPRANGE_SNORM 1 diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 590b064c7ef..74dbba4fdd1 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -225,6 +225,24 @@ #define BRW_RASTRULE_UPPER_LEFT 0 #define BRW_RASTRULE_UPPER_RIGHT 1 +/* These are listed as "Reserved, but not seen as useful" + * in Intel documentation (page 212, "Point Rasterization Rule", + * section 7.4 "SF Pipeline State Summary", of document + * "Intel® 965 Express Chipset Family and Intel® G35 Express + * Chipset Graphics Controller Programmer's Reference Manual, + * Volume 2: 3D/Media", Revision 1.0b as of January 2008, + * available at + * http://intellinuxgraphics.org/documentation.html + * at the time of this writing). + * + * These appear to be supported on at least some + * i965-family devices, and the BRW_RASTRULE_LOWER_RIGHT + * is useful when using OpenGL to render to a FBO + * (which has the pixel coordinate Y orientation inverted + * with respect to the normal OpenGL pixel coordinate system). + */ +#define BRW_RASTRULE_LOWER_LEFT 2 +#define BRW_RASTRULE_LOWER_RIGHT 3 #define BRW_RENDERTARGET_CLAMPRANGE_UNORM 0 #define BRW_RENDERTARGET_CLAMPRANGE_SNORM 1 diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 93a9686f718..fc4eddda0a5 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -231,7 +231,33 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key, sf.sf6.line_width = 0; /* _NEW_POINT */ - sf.sf6.point_rast_rule = BRW_RASTRULE_UPPER_RIGHT; /* opengl conventions */ + key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0; + if (!key->render_to_fbo) { + /* Rendering to an OpenGL window */ + sf.sf6.point_rast_rule = BRW_RASTRULE_UPPER_RIGHT; + } + else { + /* If rendering to an FBO, the pixel coordinate system is + * inverted with respect to the normal OpenGL coordinate + * system, so BRW_RASTRULE_LOWER_RIGHT is correct. + * But this value is listed as "Reserved, but not seen as useful" + * in Intel documentation (page 212, "Point Rasterization Rule", + * section 7.4 "SF Pipeline State Summary", of document + * "Intel® 965 Express Chipset Family and Intel® G35 Express + * Chipset Graphics Controller Programmer's Reference Manual, + * Volume 2: 3D/Media", Revision 1.0b as of January 2008, + * available at + * http://intellinuxgraphics.org/documentation.html + * at the time of this writing). + * + * It does work on at least some devices, if not all; + * if devices that don't support it can be identified, + * the likely failure case is that points are rasterized + * incorrectly, which is no worse than occurs without + * the value, so we're using it here. + */ + sf.sf6.point_rast_rule = BRW_RASTRULE_LOWER_RIGHT; + } /* XXX clamp max depends on AA vs. non-AA */ sf.sf7.sprite_point = key->point_sprite; -- cgit v1.2.3 From eb9801ccfbd6d808e4761d66202bc368b86679b6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Mar 2009 16:35:29 +0000 Subject: progs/trivial: add fflushes for cygwin --- progs/trivial/clear-fbo-tex.c | 1 + progs/trivial/clear-fbo.c | 1 + progs/trivial/clear-random.c | 1 + progs/trivial/clear-repeat.c | 1 + progs/trivial/clear-scissor.c | 1 + progs/trivial/clear-undefined.c | 1 + progs/trivial/clear.c | 1 + progs/trivial/createwin.c | 1 + progs/trivial/dlist-dangling.c | 1 + progs/trivial/dlist-edgeflag-dangling.c | 1 + progs/trivial/dlist-edgeflag.c | 1 + progs/trivial/line-clip.c | 1 + progs/trivial/line-cull.c | 1 + progs/trivial/line-smooth.c | 2 ++ progs/trivial/line-stipple-wide.c | 1 + progs/trivial/line-userclip-clip.c | 1 + progs/trivial/line-userclip-nop-clip.c | 1 + progs/trivial/line-userclip-nop.c | 1 + progs/trivial/line-userclip.c | 1 + progs/trivial/line-wide.c | 1 + progs/trivial/line.c | 1 + progs/trivial/lineloop-clip.c | 1 + progs/trivial/lineloop.c | 1 + progs/trivial/linestrip-clip.c | 1 + progs/trivial/linestrip-flat-stipple.c | 1 + progs/trivial/linestrip-stipple-wide.c | 1 + progs/trivial/linestrip-stipple.c | 1 + progs/trivial/linestrip.c | 1 + progs/trivial/long-fixed-func.c | 1 + progs/trivial/point-clip.c | 1 + progs/trivial/point-param.c | 1 + progs/trivial/point-sprite.c | 1 + progs/trivial/point-wide-smooth.c | 1 + progs/trivial/point-wide.c | 1 + progs/trivial/point.c | 1 + progs/trivial/poly-flat-clip.c | 1 + progs/trivial/poly-flat-unfilled-clip.c | 1 + progs/trivial/poly-flat.c | 1 + progs/trivial/poly-unfilled.c | 1 + progs/trivial/poly.c | 1 + progs/trivial/quad-clip-all-vertices.c | 1 + progs/trivial/quad-clip-nearplane.c | 1 + progs/trivial/quad-clip.c | 1 + progs/trivial/quad-degenerate.c | 1 + progs/trivial/quad-flat.c | 1 + progs/trivial/quad-offset-factor.c | 1 + progs/trivial/quad-offset-unfilled.c | 1 + progs/trivial/quad-offset-units.c | 1 + progs/trivial/quad-tex-2d.c | 1 + progs/trivial/quad-tex-3d.c | 1 + progs/trivial/quad-tex-alpha.c | 1 + progs/trivial/quad-tex-pbo.c | 1 + progs/trivial/quad-tex-sub.c | 1 + progs/trivial/quad-unfilled-clip.c | 1 + progs/trivial/quad-unfilled-stipple.c | 1 + progs/trivial/quad-unfilled.c | 1 + progs/trivial/quad.c | 1 + progs/trivial/quads.c | 1 + progs/trivial/quadstrip-clip.c | 1 + progs/trivial/quadstrip-cont.c | 1 + progs/trivial/quadstrip-flat.c | 1 + progs/trivial/quadstrip.c | 1 + progs/trivial/readpixels.c | 1 + progs/trivial/tri-alpha-tex.c | 1 + progs/trivial/tri-alpha.c | 1 + progs/trivial/tri-blend-color.c | 1 + progs/trivial/tri-clear.c | 1 + progs/trivial/tri-clip.c | 1 + progs/trivial/tri-cull-both.c | 1 + progs/trivial/tri-cull.c | 1 + progs/trivial/tri-dlist.c | 1 + progs/trivial/tri-edgeflag.c | 1 + progs/trivial/tri-fbo.c | 1 + progs/trivial/tri-flat-clip.c | 1 + progs/trivial/tri-flat.c | 1 + progs/trivial/tri-fog.c | 1 + progs/trivial/tri-fp-const-imm.c | 1 + progs/trivial/tri-fp.c | 1 + progs/trivial/tri-lit.c | 1 + progs/trivial/tri-logicop-none.c | 1 + progs/trivial/tri-logicop-xor.c | 1 + progs/trivial/tri-mask-tri.c | 1 + progs/trivial/tri-multitex-vbo.c | 1 + progs/trivial/tri-orig.c | 1 + progs/trivial/tri-query.c | 1 + progs/trivial/tri-repeat.c | 1 + progs/trivial/tri-scissor-tri.c | 1 + progs/trivial/tri-square.c | 1 + progs/trivial/tri-stipple.c | 1 + progs/trivial/tri-tex-3d.c | 1 + progs/trivial/tri-tex.c | 1 + progs/trivial/tri-tri.c | 1 + progs/trivial/tri-unfilled-clip.c | 1 + progs/trivial/tri-unfilled-edgeflag.c | 1 + progs/trivial/tri-unfilled-fog.c | 1 + progs/trivial/tri-unfilled-point.c | 1 + progs/trivial/tri-unfilled-smooth.c | 1 + progs/trivial/tri-unfilled-tri-lit.c | 1 + progs/trivial/tri-unfilled-tri.c | 1 + progs/trivial/tri-unfilled-userclip-stip.c | 1 + progs/trivial/tri-unfilled-userclip.c | 1 + progs/trivial/tri-unfilled.c | 1 + progs/trivial/tri-userclip.c | 1 + progs/trivial/tri-viewport.c | 1 + progs/trivial/tri-z-9.c | 1 + progs/trivial/tri-z-eq.c | 1 + progs/trivial/tri.c | 1 + progs/trivial/trifan-flat-clip.c | 1 + progs/trivial/trifan-flat-unfilled-clip.c | 1 + progs/trivial/trifan-flat.c | 1 + progs/trivial/trifan-unfilled.c | 1 + progs/trivial/trifan.c | 1 + progs/trivial/tristrip-clip.c | 1 + progs/trivial/tristrip-flat.c | 1 + progs/trivial/tristrip.c | 1 + 115 files changed, 116 insertions(+) diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c index eccfde5ae63..a206676e48e 100644 --- a/progs/trivial/clear-fbo-tex.c +++ b/progs/trivial/clear-fbo-tex.c @@ -27,6 +27,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { diff --git a/progs/trivial/clear-fbo.c b/progs/trivial/clear-fbo.c index 64b25430c66..0aeb45489f2 100644 --- a/progs/trivial/clear-fbo.c +++ b/progs/trivial/clear-fbo.c @@ -23,6 +23,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { diff --git a/progs/trivial/clear-random.c b/progs/trivial/clear-random.c index f3a67dbe8a8..e3da23a8f55 100644 --- a/progs/trivial/clear-random.c +++ b/progs/trivial/clear-random.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); } diff --git a/progs/trivial/clear-repeat.c b/progs/trivial/clear-repeat.c index 9c618d492f3..f966adb0801 100644 --- a/progs/trivial/clear-repeat.c +++ b/progs/trivial/clear-repeat.c @@ -38,6 +38,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.3, 0.1, 0.3, 0.0); } diff --git a/progs/trivial/clear-scissor.c b/progs/trivial/clear-scissor.c index 5e2025bed74..01735327480 100644 --- a/progs/trivial/clear-scissor.c +++ b/progs/trivial/clear-scissor.c @@ -16,6 +16,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); } static void Reshape(int width, int height) diff --git a/progs/trivial/clear-undefined.c b/progs/trivial/clear-undefined.c index ce066bf8e6f..5ec33bf3d78 100644 --- a/progs/trivial/clear-undefined.c +++ b/progs/trivial/clear-undefined.c @@ -17,6 +17,7 @@ static void Init(void) fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); fprintf(stderr, "Top right corner should be red\n"); + fflush(stderr); } static void Reshape(int width, int height) diff --git a/progs/trivial/clear.c b/progs/trivial/clear.c index 37cfd54fbe2..03857b4b893 100644 --- a/progs/trivial/clear.c +++ b/progs/trivial/clear.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/createwin.c b/progs/trivial/createwin.c index 44d5b1b2c5f..f2cc6f1cffc 100644 --- a/progs/trivial/createwin.c +++ b/progs/trivial/createwin.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/dlist-dangling.c b/progs/trivial/dlist-dangling.c index 64054ec96c1..de106280092 100644 --- a/progs/trivial/dlist-dangling.c +++ b/progs/trivial/dlist-dangling.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/dlist-edgeflag-dangling.c b/progs/trivial/dlist-edgeflag-dangling.c index 1b66244cabf..3d3aaeb6944 100644 --- a/progs/trivial/dlist-edgeflag-dangling.c +++ b/progs/trivial/dlist-edgeflag-dangling.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/dlist-edgeflag.c b/progs/trivial/dlist-edgeflag.c index 350100681e5..8002129ed14 100644 --- a/progs/trivial/dlist-edgeflag.c +++ b/progs/trivial/dlist-edgeflag.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/line-clip.c b/progs/trivial/line-clip.c index bcee32e25fc..5276baffd5d 100644 --- a/progs/trivial/line-clip.c +++ b/progs/trivial/line-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/line-cull.c b/progs/trivial/line-cull.c index 98218731304..1e1b77a942c 100644 --- a/progs/trivial/line-cull.c +++ b/progs/trivial/line-cull.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/line-smooth.c b/progs/trivial/line-smooth.c index f030de9b9fe..9c4b9a01155 100644 --- a/progs/trivial/line-smooth.c +++ b/progs/trivial/line-smooth.c @@ -44,10 +44,12 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glGetFloatv(GL_LINE_WIDTH_RANGE, aarange); glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range); printf("Non-AA line width range: %f .. %f\n", range[0], range[1]); printf("AA line width range: %f .. %f\n", aarange[0], aarange[1]); + fflush(stdout); } diff --git a/progs/trivial/line-stipple-wide.c b/progs/trivial/line-stipple-wide.c index 28d96c797b0..1804ffad3f0 100644 --- a/progs/trivial/line-stipple-wide.c +++ b/progs/trivial/line-stipple-wide.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/line-userclip-clip.c b/progs/trivial/line-userclip-clip.c index 1b9f059729c..8e030b47cea 100644 --- a/progs/trivial/line-userclip-clip.c +++ b/progs/trivial/line-userclip-clip.c @@ -41,6 +41,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); glClipPlane(GL_CLIP_PLANE0, plane); diff --git a/progs/trivial/line-userclip-nop-clip.c b/progs/trivial/line-userclip-nop-clip.c index 9f144a6e9a3..6fcd4bcfe73 100644 --- a/progs/trivial/line-userclip-nop-clip.c +++ b/progs/trivial/line-userclip-nop-clip.c @@ -41,6 +41,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); glClipPlane(GL_CLIP_PLANE0, plane); diff --git a/progs/trivial/line-userclip-nop.c b/progs/trivial/line-userclip-nop.c index 7588faeb98f..e59fd133a5f 100644 --- a/progs/trivial/line-userclip-nop.c +++ b/progs/trivial/line-userclip-nop.c @@ -41,6 +41,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); glClipPlane(GL_CLIP_PLANE0, plane); diff --git a/progs/trivial/line-userclip.c b/progs/trivial/line-userclip.c index 77d8228188c..e30be5580bd 100644 --- a/progs/trivial/line-userclip.c +++ b/progs/trivial/line-userclip.c @@ -41,6 +41,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); glClipPlane(GL_CLIP_PLANE0, plane); diff --git a/progs/trivial/line-wide.c b/progs/trivial/line-wide.c index f20505378cb..b74021dea73 100644 --- a/progs/trivial/line-wide.c +++ b/progs/trivial/line-wide.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/line.c b/progs/trivial/line.c index 7ccbce3750a..e1d73280bfc 100644 --- a/progs/trivial/line.c +++ b/progs/trivial/line.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/lineloop-clip.c b/progs/trivial/lineloop-clip.c index fbeca985b90..45fa47491f8 100644 --- a/progs/trivial/lineloop-clip.c +++ b/progs/trivial/lineloop-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/lineloop.c b/progs/trivial/lineloop.c index 5863df654b8..c290dbd8cb3 100644 --- a/progs/trivial/lineloop.c +++ b/progs/trivial/lineloop.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/linestrip-clip.c b/progs/trivial/linestrip-clip.c index dae27c31d44..f2528229218 100644 --- a/progs/trivial/linestrip-clip.c +++ b/progs/trivial/linestrip-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/linestrip-flat-stipple.c b/progs/trivial/linestrip-flat-stipple.c index ee79f150194..5caa7244235 100644 --- a/progs/trivial/linestrip-flat-stipple.c +++ b/progs/trivial/linestrip-flat-stipple.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/linestrip-stipple-wide.c b/progs/trivial/linestrip-stipple-wide.c index c6307d59941..701c82c266a 100644 --- a/progs/trivial/linestrip-stipple-wide.c +++ b/progs/trivial/linestrip-stipple-wide.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/linestrip-stipple.c b/progs/trivial/linestrip-stipple.c index 2b40b5f1b8e..df2eef96b5d 100644 --- a/progs/trivial/linestrip-stipple.c +++ b/progs/trivial/linestrip-stipple.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/linestrip.c b/progs/trivial/linestrip.c index 865a752796c..0219b1ab70e 100644 --- a/progs/trivial/linestrip.c +++ b/progs/trivial/linestrip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/long-fixed-func.c b/progs/trivial/long-fixed-func.c index f2a29a9d376..4b6c412f9e8 100644 --- a/progs/trivial/long-fixed-func.c +++ b/progs/trivial/long-fixed-func.c @@ -53,6 +53,7 @@ Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.3, 0.1, 0.3, 0.0); diff --git a/progs/trivial/point-clip.c b/progs/trivial/point-clip.c index 6aaee0d1a5f..4c89ba598d7 100644 --- a/progs/trivial/point-clip.c +++ b/progs/trivial/point-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/point-param.c b/progs/trivial/point-param.c index 1edeec3468a..6f43720a892 100644 --- a/progs/trivial/point-param.c +++ b/progs/trivial/point-param.c @@ -38,6 +38,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/point-sprite.c b/progs/trivial/point-sprite.c index 2f8226ee273..5d29a6a3cf9 100644 --- a/progs/trivial/point-sprite.c +++ b/progs/trivial/point-sprite.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); #define SIZE 16 diff --git a/progs/trivial/point-wide-smooth.c b/progs/trivial/point-wide-smooth.c index 63f83badf8c..f6e9b8df5f9 100644 --- a/progs/trivial/point-wide-smooth.c +++ b/progs/trivial/point-wide-smooth.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/point-wide.c b/progs/trivial/point-wide.c index 725edae49ec..8abd64c6a99 100644 --- a/progs/trivial/point-wide.c +++ b/progs/trivial/point-wide.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/point.c b/progs/trivial/point.c index 3c472c1b91e..49959dcc487 100644 --- a/progs/trivial/point.c +++ b/progs/trivial/point.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/poly-flat-clip.c b/progs/trivial/poly-flat-clip.c index d58a3a358f8..5490068b08e 100644 --- a/progs/trivial/poly-flat-clip.c +++ b/progs/trivial/poly-flat-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/poly-flat-unfilled-clip.c b/progs/trivial/poly-flat-unfilled-clip.c index 74249eb4999..26b90ef9645 100644 --- a/progs/trivial/poly-flat-unfilled-clip.c +++ b/progs/trivial/poly-flat-unfilled-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/poly-flat.c b/progs/trivial/poly-flat.c index 82098bc1bbc..a4e3cdb6334 100644 --- a/progs/trivial/poly-flat.c +++ b/progs/trivial/poly-flat.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/poly-unfilled.c b/progs/trivial/poly-unfilled.c index 5cc8523f815..2ad443dc159 100644 --- a/progs/trivial/poly-unfilled.c +++ b/progs/trivial/poly-unfilled.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/poly.c b/progs/trivial/poly.c index 8944f148d09..e5b788ea5be 100644 --- a/progs/trivial/poly.c +++ b/progs/trivial/poly.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-clip-all-vertices.c b/progs/trivial/quad-clip-all-vertices.c index 6559adf4af8..60c87fc9ce1 100644 --- a/progs/trivial/quad-clip-all-vertices.c +++ b/progs/trivial/quad-clip-all-vertices.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-clip-nearplane.c b/progs/trivial/quad-clip-nearplane.c index 0e4f4c947c3..9380e4f9ae1 100644 --- a/progs/trivial/quad-clip-nearplane.c +++ b/progs/trivial/quad-clip-nearplane.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); fprintf(stderr, "Press z/Z to translate quad\n"); diff --git a/progs/trivial/quad-clip.c b/progs/trivial/quad-clip.c index fd3522a89a2..063de6106a6 100644 --- a/progs/trivial/quad-clip.c +++ b/progs/trivial/quad-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-degenerate.c b/progs/trivial/quad-degenerate.c index 29fb2774deb..fdc142bcd61 100644 --- a/progs/trivial/quad-degenerate.c +++ b/progs/trivial/quad-degenerate.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-flat.c b/progs/trivial/quad-flat.c index 570eb6bc715..e3147b3b3fe 100644 --- a/progs/trivial/quad-flat.c +++ b/progs/trivial/quad-flat.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-offset-factor.c b/progs/trivial/quad-offset-factor.c index 2c4946a13a6..dfe99bbae68 100644 --- a/progs/trivial/quad-offset-factor.c +++ b/progs/trivial/quad-offset-factor.c @@ -34,6 +34,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(1.0, 1.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-offset-unfilled.c b/progs/trivial/quad-offset-unfilled.c index 40762825bd1..06590021fed 100644 --- a/progs/trivial/quad-offset-unfilled.c +++ b/progs/trivial/quad-offset-unfilled.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(1.0, 1.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-offset-units.c b/progs/trivial/quad-offset-units.c index b4b138b4b44..922529d977e 100644 --- a/progs/trivial/quad-offset-units.c +++ b/progs/trivial/quad-offset-units.c @@ -34,6 +34,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(1.0, 1.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-tex-2d.c b/progs/trivial/quad-tex-2d.c index ed6f4a07330..8a886ef578c 100644 --- a/progs/trivial/quad-tex-2d.c +++ b/progs/trivial/quad-tex-2d.c @@ -38,6 +38,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/quad-tex-3d.c b/progs/trivial/quad-tex-3d.c index 84acb35fd82..d05131d3b8a 100644 --- a/progs/trivial/quad-tex-3d.c +++ b/progs/trivial/quad-tex-3d.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/quad-tex-alpha.c b/progs/trivial/quad-tex-alpha.c index be24255a3e2..eebaf9170ec 100644 --- a/progs/trivial/quad-tex-alpha.c +++ b/progs/trivial/quad-tex-alpha.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/quad-tex-pbo.c b/progs/trivial/quad-tex-pbo.c index dcb4ae0e7f8..ad41a9a22e5 100644 --- a/progs/trivial/quad-tex-pbo.c +++ b/progs/trivial/quad-tex-pbo.c @@ -42,6 +42,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/quad-tex-sub.c b/progs/trivial/quad-tex-sub.c index aabbb9edce9..5620dbc6f81 100644 --- a/progs/trivial/quad-tex-sub.c +++ b/progs/trivial/quad-tex-sub.c @@ -89,6 +89,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/quad-unfilled-clip.c b/progs/trivial/quad-unfilled-clip.c index e25a34bda85..761878bd4b6 100644 --- a/progs/trivial/quad-unfilled-clip.c +++ b/progs/trivial/quad-unfilled-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-unfilled-stipple.c b/progs/trivial/quad-unfilled-stipple.c index d33e5918bce..cd7d2769284 100644 --- a/progs/trivial/quad-unfilled-stipple.c +++ b/progs/trivial/quad-unfilled-stipple.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quad-unfilled.c b/progs/trivial/quad-unfilled.c index b60af3e7f56..d64f17fdf95 100644 --- a/progs/trivial/quad-unfilled.c +++ b/progs/trivial/quad-unfilled.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quad.c b/progs/trivial/quad.c index c4773ec7dab..d360e309d30 100644 --- a/progs/trivial/quad.c +++ b/progs/trivial/quad.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quads.c b/progs/trivial/quads.c index 5bc622144ed..fe11fef207c 100644 --- a/progs/trivial/quads.c +++ b/progs/trivial/quads.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quadstrip-clip.c b/progs/trivial/quadstrip-clip.c index 82a6d4e0769..4cea81a45d7 100644 --- a/progs/trivial/quadstrip-clip.c +++ b/progs/trivial/quadstrip-clip.c @@ -34,6 +34,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quadstrip-cont.c b/progs/trivial/quadstrip-cont.c index 62208dfae75..329523531aa 100644 --- a/progs/trivial/quadstrip-cont.c +++ b/progs/trivial/quadstrip-cont.c @@ -34,6 +34,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quadstrip-flat.c b/progs/trivial/quadstrip-flat.c index 9011ee0873f..228c6c255e5 100644 --- a/progs/trivial/quadstrip-flat.c +++ b/progs/trivial/quadstrip-flat.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/quadstrip.c b/progs/trivial/quadstrip.c index 6923afc04b5..d49a9a53020 100644 --- a/progs/trivial/quadstrip.c +++ b/progs/trivial/quadstrip.c @@ -34,6 +34,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/readpixels.c b/progs/trivial/readpixels.c index 88aac2684a8..5671618446a 100644 --- a/progs/trivial/readpixels.c +++ b/progs/trivial/readpixels.c @@ -17,6 +17,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.3, 0.1, 0.3, 0.0); } diff --git a/progs/trivial/tri-alpha-tex.c b/progs/trivial/tri-alpha-tex.c index 382d7b21029..780ebe6be5b 100644 --- a/progs/trivial/tri-alpha-tex.c +++ b/progs/trivial/tri-alpha-tex.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/tri-alpha.c b/progs/trivial/tri-alpha.c index 1a653713bbf..aec1cbb3772 100644 --- a/progs/trivial/tri-alpha.c +++ b/progs/trivial/tri-alpha.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-blend-color.c b/progs/trivial/tri-blend-color.c index db831e3d6e0..92f019259ec 100644 --- a/progs/trivial/tri-blend-color.c +++ b/progs/trivial/tri-blend-color.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); } diff --git a/progs/trivial/tri-clear.c b/progs/trivial/tri-clear.c index a3908e38e9d..f49186bd8ae 100644 --- a/progs/trivial/tri-clear.c +++ b/progs/trivial/tri-clear.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-clip.c b/progs/trivial/tri-clip.c index 0d31086c855..e1deca1bdcf 100644 --- a/progs/trivial/tri-clip.c +++ b/progs/trivial/tri-clip.c @@ -37,6 +37,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-cull-both.c b/progs/trivial/tri-cull-both.c index 73c5583cfdd..864be710c2a 100644 --- a/progs/trivial/tri-cull-both.c +++ b/progs/trivial/tri-cull-both.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); glCullFace(GL_FRONT_AND_BACK); diff --git a/progs/trivial/tri-cull.c b/progs/trivial/tri-cull.c index c6bcf444e42..c71ad9a0315 100644 --- a/progs/trivial/tri-cull.c +++ b/progs/trivial/tri-cull.c @@ -60,6 +60,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); cull(); } diff --git a/progs/trivial/tri-dlist.c b/progs/trivial/tri-dlist.c index 1c0e320f61a..c410be221a7 100644 --- a/progs/trivial/tri-dlist.c +++ b/progs/trivial/tri-dlist.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/tri-edgeflag.c b/progs/trivial/tri-edgeflag.c index e1278dd6490..4c8736ad8c2 100644 --- a/progs/trivial/tri-edgeflag.c +++ b/progs/trivial/tri-edgeflag.c @@ -35,6 +35,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); } static void Reshape(int width, int height) diff --git a/progs/trivial/tri-fbo.c b/progs/trivial/tri-fbo.c index 7a38f2124cc..1ed177ffdfb 100644 --- a/progs/trivial/tri-fbo.c +++ b/progs/trivial/tri-fbo.c @@ -23,6 +23,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { diff --git a/progs/trivial/tri-flat-clip.c b/progs/trivial/tri-flat-clip.c index 3235100385c..2aab5ba00a5 100644 --- a/progs/trivial/tri-flat-clip.c +++ b/progs/trivial/tri-flat-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.5, 0.5, 0.5, 0.0); } diff --git a/progs/trivial/tri-flat.c b/progs/trivial/tri-flat.c index a7fdaa1f469..ea703ec6f3f 100644 --- a/progs/trivial/tri-flat.c +++ b/progs/trivial/tri-flat.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.5, 0.5, 0.5, 0.0); } diff --git a/progs/trivial/tri-fog.c b/progs/trivial/tri-fog.c index 0099a90ad6c..0cea3d32582 100644 --- a/progs/trivial/tri-fog.c +++ b/progs/trivial/tri-fog.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/tri-fp-const-imm.c b/progs/trivial/tri-fp-const-imm.c index 2b1499903c1..d2df442abfc 100644 --- a/progs/trivial/tri-fp-const-imm.c +++ b/progs/trivial/tri-fp-const-imm.c @@ -51,6 +51,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); /* Setup the fragment program */ glGenProgramsARB(1, &prognum); diff --git a/progs/trivial/tri-fp.c b/progs/trivial/tri-fp.c index b30f9b73e0f..4d1508120ea 100644 --- a/progs/trivial/tri-fp.c +++ b/progs/trivial/tri-fp.c @@ -49,6 +49,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); /* Setup the fragment program */ glGenProgramsARB(1, &prognum); diff --git a/progs/trivial/tri-lit.c b/progs/trivial/tri-lit.c index 91fac1a5981..15a7ad24c51 100644 --- a/progs/trivial/tri-lit.c +++ b/progs/trivial/tri-lit.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); diff --git a/progs/trivial/tri-logicop-none.c b/progs/trivial/tri-logicop-none.c index aba3614bf68..53c2614ac32 100644 --- a/progs/trivial/tri-logicop-none.c +++ b/progs/trivial/tri-logicop-none.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.3, 0.1, 0.3, 0.0); } diff --git a/progs/trivial/tri-logicop-xor.c b/progs/trivial/tri-logicop-xor.c index e2c94f9bee7..f018a851ace 100644 --- a/progs/trivial/tri-logicop-xor.c +++ b/progs/trivial/tri-logicop-xor.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.3, 0.1, 0.3, 0.0); } diff --git a/progs/trivial/tri-mask-tri.c b/progs/trivial/tri-mask-tri.c index 449125a4db7..d62620905dd 100644 --- a/progs/trivial/tri-mask-tri.c +++ b/progs/trivial/tri-mask-tri.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-multitex-vbo.c b/progs/trivial/tri-multitex-vbo.c index 76e117a333f..e319447ac15 100644 --- a/progs/trivial/tri-multitex-vbo.c +++ b/progs/trivial/tri-multitex-vbo.c @@ -77,6 +77,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/tri-orig.c b/progs/trivial/tri-orig.c index 6861ff6e492..e7cfee3a367 100644 --- a/progs/trivial/tri-orig.c +++ b/progs/trivial/tri-orig.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c index 9b319ba2a7d..85e39df2dfa 100644 --- a/progs/trivial/tri-query.c +++ b/progs/trivial/tri-query.c @@ -42,6 +42,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/tri-repeat.c b/progs/trivial/tri-repeat.c index a271fab54cc..91e355c71f3 100644 --- a/progs/trivial/tri-repeat.c +++ b/progs/trivial/tri-repeat.c @@ -38,6 +38,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.3, 0.1, 0.3, 0.0); } diff --git a/progs/trivial/tri-scissor-tri.c b/progs/trivial/tri-scissor-tri.c index 2b5536ecd65..608ebf29cff 100644 --- a/progs/trivial/tri-scissor-tri.c +++ b/progs/trivial/tri-scissor-tri.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-square.c b/progs/trivial/tri-square.c index 9102888abd0..0b82a1dd8e3 100644 --- a/progs/trivial/tri-square.c +++ b/progs/trivial/tri-square.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-stipple.c b/progs/trivial/tri-stipple.c index 33e6dd16a7e..aa94fa224b7 100644 --- a/progs/trivial/tri-stipple.c +++ b/progs/trivial/tri-stipple.c @@ -51,6 +51,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glEnable (GL_POLYGON_STIPPLE); glPolygonStipple (fly); diff --git a/progs/trivial/tri-tex-3d.c b/progs/trivial/tri-tex-3d.c index 4f276af653f..3ccbe125105 100644 --- a/progs/trivial/tri-tex-3d.c +++ b/progs/trivial/tri-tex-3d.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/tri-tex.c b/progs/trivial/tri-tex.c index 1dbbe6aa586..56afb4748d7 100644 --- a/progs/trivial/tri-tex.c +++ b/progs/trivial/tri-tex.c @@ -36,6 +36,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); diff --git a/progs/trivial/tri-tri.c b/progs/trivial/tri-tri.c index 8b0c2dafefe..f996bd01a16 100644 --- a/progs/trivial/tri-tri.c +++ b/progs/trivial/tri-tri.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-unfilled-clip.c b/progs/trivial/tri-unfilled-clip.c index 438899dc1a0..2fd894a49a8 100644 --- a/progs/trivial/tri-unfilled-clip.c +++ b/progs/trivial/tri-unfilled-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-unfilled-edgeflag.c b/progs/trivial/tri-unfilled-edgeflag.c index 78c5ae8e9cd..11c21d1bf68 100644 --- a/progs/trivial/tri-unfilled-edgeflag.c +++ b/progs/trivial/tri-unfilled-edgeflag.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-unfilled-fog.c b/progs/trivial/tri-unfilled-fog.c index 113b8d051df..c6ecc705b37 100644 --- a/progs/trivial/tri-unfilled-fog.c +++ b/progs/trivial/tri-unfilled-fog.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-unfilled-point.c b/progs/trivial/tri-unfilled-point.c index b0502801552..750a254669a 100644 --- a/progs/trivial/tri-unfilled-point.c +++ b/progs/trivial/tri-unfilled-point.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-unfilled-smooth.c b/progs/trivial/tri-unfilled-smooth.c index 9306af849a4..eddae176e5f 100644 --- a/progs/trivial/tri-unfilled-smooth.c +++ b/progs/trivial/tri-unfilled-smooth.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-unfilled-tri-lit.c b/progs/trivial/tri-unfilled-tri-lit.c index 775c3530b7e..1d42b40b713 100644 --- a/progs/trivial/tri-unfilled-tri-lit.c +++ b/progs/trivial/tri-unfilled-tri-lit.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); diff --git a/progs/trivial/tri-unfilled-tri.c b/progs/trivial/tri-unfilled-tri.c index ce789255fd9..695cc890955 100644 --- a/progs/trivial/tri-unfilled-tri.c +++ b/progs/trivial/tri-unfilled-tri.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-unfilled-userclip-stip.c b/progs/trivial/tri-unfilled-userclip-stip.c index 6835b53c0f5..ddc0dffd4f4 100644 --- a/progs/trivial/tri-unfilled-userclip-stip.c +++ b/progs/trivial/tri-unfilled-userclip-stip.c @@ -41,6 +41,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); glClipPlane(GL_CLIP_PLANE0, plane); diff --git a/progs/trivial/tri-unfilled-userclip.c b/progs/trivial/tri-unfilled-userclip.c index aab5abc2303..0dec0bfc9b4 100644 --- a/progs/trivial/tri-unfilled-userclip.c +++ b/progs/trivial/tri-unfilled-userclip.c @@ -41,6 +41,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); glClipPlane(GL_CLIP_PLANE0, plane); diff --git a/progs/trivial/tri-unfilled.c b/progs/trivial/tri-unfilled.c index 4f50d083c2d..b98cb9a842a 100644 --- a/progs/trivial/tri-unfilled.c +++ b/progs/trivial/tri-unfilled.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tri-userclip.c b/progs/trivial/tri-userclip.c index 43d19cebab5..8f37e0fae20 100644 --- a/progs/trivial/tri-userclip.c +++ b/progs/trivial/tri-userclip.c @@ -41,6 +41,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); glClipPlane(GL_CLIP_PLANE0, plane); diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c index 3205b9ee9c3..8e5f155c7dd 100644 --- a/progs/trivial/tri-viewport.c +++ b/progs/trivial/tri-viewport.c @@ -35,6 +35,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.3, 0.1, 0.3, 0.0); } diff --git a/progs/trivial/tri-z-9.c b/progs/trivial/tri-z-9.c index e7d4184bdb0..099e89f6f4a 100644 --- a/progs/trivial/tri-z-9.c +++ b/progs/trivial/tri-z-9.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); } diff --git a/progs/trivial/tri-z-eq.c b/progs/trivial/tri-z-eq.c index 4ec55ac080a..b81c992f7d1 100644 --- a/progs/trivial/tri-z-eq.c +++ b/progs/trivial/tri-z-eq.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); } diff --git a/progs/trivial/tri.c b/progs/trivial/tri.c index d99d5872a90..d44cb6a9fe3 100644 --- a/progs/trivial/tri.c +++ b/progs/trivial/tri.c @@ -40,6 +40,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.3, 0.1, 0.3, 0.0); } diff --git a/progs/trivial/trifan-flat-clip.c b/progs/trivial/trifan-flat-clip.c index ec7a50a75e0..199f91a637e 100644 --- a/progs/trivial/trifan-flat-clip.c +++ b/progs/trivial/trifan-flat-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/trifan-flat-unfilled-clip.c b/progs/trivial/trifan-flat-unfilled-clip.c index 4887b5a30c5..ea3e1553872 100644 --- a/progs/trivial/trifan-flat-unfilled-clip.c +++ b/progs/trivial/trifan-flat-unfilled-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/trifan-flat.c b/progs/trivial/trifan-flat.c index cf75d4cf08f..d69b4887e39 100644 --- a/progs/trivial/trifan-flat.c +++ b/progs/trivial/trifan-flat.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/trifan-unfilled.c b/progs/trivial/trifan-unfilled.c index 491fe5b3df2..91447e4e44d 100644 --- a/progs/trivial/trifan-unfilled.c +++ b/progs/trivial/trifan-unfilled.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/trifan.c b/progs/trivial/trifan.c index ee9854dc94a..84eb4172de1 100644 --- a/progs/trivial/trifan.c +++ b/progs/trivial/trifan.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tristrip-clip.c b/progs/trivial/tristrip-clip.c index eeab676ea90..343e2938049 100644 --- a/progs/trivial/tristrip-clip.c +++ b/progs/trivial/tristrip-clip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tristrip-flat.c b/progs/trivial/tristrip-flat.c index 49bb432b9df..02da97efcea 100644 --- a/progs/trivial/tristrip-flat.c +++ b/progs/trivial/tristrip-flat.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } diff --git a/progs/trivial/tristrip.c b/progs/trivial/tristrip.c index 023e6475c0d..77bf2fad282 100644 --- a/progs/trivial/tristrip.c +++ b/progs/trivial/tristrip.c @@ -39,6 +39,7 @@ static void Init(void) fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); glClearColor(0.0, 0.0, 1.0, 0.0); } -- cgit v1.2.3 From a4a0ba1adb9fbe168c6b84cdd281992893208c08 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Mar 2009 16:38:07 +0000 Subject: mesa/st: bump gallium version to 0.3 To distinguish from the -0.2 version still being maintained on the gallium-mesa-7.4 branch. There are already greater interface changes between these two branches than there were between -0.2 and -0.1. Also stop injecting Tungsten into the vendor string - the Gallium in the renderer string should be sufficient. --- src/mesa/state_tracker/st_cb_strings.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c index 2036ccafbfb..bb931f17c4e 100644 --- a/src/mesa/state_tracker/st_cb_strings.c +++ b/src/mesa/state_tracker/st_cb_strings.c @@ -39,7 +39,7 @@ #include "st_context.h" #include "st_cb_strings.h" -#define ST_VERSION_STRING "0.2" +#define ST_VERSION_STRING "0.3" static const GLubyte * st_get_string(GLcontext * ctx, GLenum name) @@ -50,18 +50,7 @@ st_get_string(GLcontext * ctx, GLenum name) switch (name) { case GL_VENDOR: { const char *vendor = screen->get_vendor( screen ); - const char *tungsten = "Tungsten Graphics, Inc."; - - /* Tungsten Graphics, Inc. developed the state_tracker module - * (and much of Mesa), but the driver itself may come from elsewhere. - * The additional string allows "and XyzCorp" to reflect this. - */ - if (vendor && strcmp(vendor, tungsten) != 0) - util_snprintf(st->vendor, sizeof(st->vendor), - "%s and %s", tungsten, vendor); - else - util_snprintf(st->vendor, sizeof(st->vendor), "%s", tungsten); - + util_snprintf(st->vendor, sizeof(st->vendor), "%s", vendor); return (GLubyte *) st->vendor; } -- cgit v1.2.3 From 993b7e1d5cdf1df3e7967afef16852fe287dc162 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Mar 2009 17:50:36 +0000 Subject: progs/vp: add pointsize + clamp test --- progs/vp/psiz-mul-clamp.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 progs/vp/psiz-mul-clamp.txt diff --git a/progs/vp/psiz-mul-clamp.txt b/progs/vp/psiz-mul-clamp.txt new file mode 100644 index 00000000000..284c032d790 --- /dev/null +++ b/progs/vp/psiz-mul-clamp.txt @@ -0,0 +1,9 @@ +!!ARBvp1.0 +TEMP R0; +MOV result.color, vertex.color; +MUL R0.x, vertex.color.x, {10.0}.x; +MAX R0.x, R0.x, {2.0}.x; +MIN result.pointsize.x, R0.x, {4.0}.x; +MOV result.position, vertex.position; +END + -- cgit v1.2.3 From c4c4358e0858fcbc09f4bf35d93f593af5bcd9db Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 16:06:27 -0600 Subject: demos: add LDFLAGS for corender target, bug 20844 --- progs/xdemos/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile index bb353e318c9..6581df80398 100644 --- a/progs/xdemos/Makefile +++ b/progs/xdemos/Makefile @@ -99,7 +99,7 @@ xrotfontdemo.o: xrotfontdemo.c xuserotfont.h $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xrotfontdemo.c corender: corender.o ipc.o - $(APP_CC) $(CFLAGS) corender.o ipc.o $(LIBS) -o $@ + $(APP_CC) $(CFLAGS) $(LDFLAGS) corender.o ipc.o $(LIBS) -o $@ corender.o: corender.c ipc.h $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) corender.c -- cgit v1.2.3 From 578af516104bf0078cf93b1b9dd783e19e113177 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Tue, 24 Mar 2009 18:55:37 -0400 Subject: nouveau: Frontbuffer needs to be marked as linear. --- src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c index c4cbbc21248..0b45b1ff1f6 100644 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c +++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c @@ -199,7 +199,8 @@ dri_surface_from_handle(struct pipe_screen *screen, return NULL; memset(&templat, 0, sizeof(templat)); - templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET; + templat.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY | + NOUVEAU_TEXTURE_USAGE_LINEAR; templat.target = PIPE_TEXTURE_2D; templat.last_level = 0; templat.depth[0] = 1; -- cgit v1.2.3 From 0be8af8a392541acde3f8791a754a260b877ac17 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Tue, 24 Mar 2009 22:59:20 +0000 Subject: mesa: bump MAX_PROGRAM_TEMPS to 256 (there's some big shaders out there) --- src/mesa/main/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index fc31155b35b..2a9fdf9ca05 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -184,7 +184,7 @@ #define MAX_PROGRAM_MATRICES 8 #define MAX_PROGRAM_MATRIX_STACK_DEPTH 4 #define MAX_PROGRAM_CALL_DEPTH 8 -#define MAX_PROGRAM_TEMPS 128 +#define MAX_PROGRAM_TEMPS 256 #define MAX_PROGRAM_ADDRESS_REGS 2 #define MAX_UNIFORMS 1024 /**< number of vec4 uniforms */ #define MAX_VARYING 8 /**< number of float[4] vectors */ -- cgit v1.2.3 From 88b19bbe651e4362d0bc96eb6ec10218c2ef6cf2 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 25 Mar 2009 12:09:58 +1000 Subject: nouveau: fix some pipe_buffer reference counting issues --- src/gallium/drivers/nouveau/nouveau_stateobj.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h index 97859110b5f..a54820e8512 100644 --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h @@ -46,9 +46,12 @@ static INLINE void so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso) { struct nouveau_stateobj *so = *pso; + int i; if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) { free(so->push); + for (i = 0; i < so->cur_reloc; i++) + pipe_buffer_reference(&so->reloc[i].bo, NULL); free(so->reloc); free(so); } @@ -83,7 +86,8 @@ so_reloc(struct nouveau_stateobj *so, struct pipe_buffer *bo, { struct nouveau_stateobj_reloc *r = &so->reloc[so->cur_reloc++]; - r->bo = bo; + r->bo = NULL; + pipe_buffer_reference(&r->bo, bo); r->offset = so->cur - so->push; r->packet = so->cur_packet; r->data = data; -- cgit v1.2.3 From c306bf94d6ae20ce75965b1ae13213e24c976ed7 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 25 Mar 2009 12:16:25 +1000 Subject: nv50: fix typo in nv50_query.c --- src/gallium/drivers/nv50/nv50_query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c index a2c56f99a89..35cebdbdc32 100644 --- a/src/gallium/drivers/nv50/nv50_query.c +++ b/src/gallium/drivers/nv50/nv50_query.c @@ -41,7 +41,7 @@ nv50_query(struct pipe_query *pipe) static struct pipe_query * nv50_query_create(struct pipe_context *pipe, unsigned type) { - struct pipe_screen *screen = pipe->winsys; + struct pipe_screen *screen = pipe->screen; struct nv50_query *q = CALLOC_STRUCT(nv50_query); assert (q->type == PIPE_QUERY_OCCLUSION_COUNTER); -- cgit v1.2.3 From e919bfa1f1766e71780d0a4db5a8b6a04d19868f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Mar 2009 19:25:56 +0000 Subject: progs/vp: more psiz tests --- progs/vp/psiz-imm.txt | 5 +++++ progs/vp/psiz-param-clamp.txt | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 progs/vp/psiz-imm.txt create mode 100644 progs/vp/psiz-param-clamp.txt diff --git a/progs/vp/psiz-imm.txt b/progs/vp/psiz-imm.txt new file mode 100644 index 00000000000..18de2498d67 --- /dev/null +++ b/progs/vp/psiz-imm.txt @@ -0,0 +1,5 @@ +!!ARBvp1.0 +MOV result.color, vertex.color; +MOV result.pointsize, {2.0, 0, 0, 1}; +MOV result.position, vertex.position; +END diff --git a/progs/vp/psiz-param-clamp.txt b/progs/vp/psiz-param-clamp.txt new file mode 100644 index 00000000000..7f83fc45165 --- /dev/null +++ b/progs/vp/psiz-param-clamp.txt @@ -0,0 +1,10 @@ +!!ARBvp1.0 +TEMP R0; +TEMP R1; +MOV result.color, vertex.color; +MUL R0.x, vertex.color.x, {10.0}.x; +MAX R0.x, R0.x, {2.0}.x; +MIN result.pointsize.x, R0.x, {4.0}.x; +MOV result.position, vertex.position; +END + -- cgit v1.2.3 From e101959b6a262ba34a12b407ea6f480e6b4d7d72 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Wed, 25 Mar 2009 11:13:28 +0100 Subject: r300: Texture size limit cleanups. Since core Mesa MAX_TEXTURE_LEVELS was bumped, we were incorrectly advertising a maximum texture size of 4096 on older chips, causing corrupted menu text in Extreme Tux Racer or Armagetron. Also make sure our texture image array can actually hold all the mipmap levels we support... --- src/mesa/drivers/dri/r300/r300_context.c | 19 ++++++++++++++++--- src/mesa/drivers/dri/r300/r300_context.h | 6 +++++- src/mesa/drivers/dri/r300/r300_texmem.c | 2 +- src/mesa/drivers/dri/r300/r300_texstate.c | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index fddd87b85ff..12bee1a8fbb 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -288,10 +288,23 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, 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; - ctx->Const.MaxTextureRectSize = 4096; - } + else + ctx->Const.MaxTextureLevels = 12; + + driCalculateMaxTextureLevels( r300->texture_heaps, + r300->nr_heaps, + & ctx->Const, + 4, + ctx->Const.MaxTextureLevels - 1, + MIN2(ctx->Const.MaxTextureLevels, + MAX_3D_TEXTURE_LEVELS) - 1, + ctx->Const.MaxTextureLevels - 1, + ctx->Const.MaxTextureLevels - 1, + ctx->Const.MaxTextureLevels - 1, + GL_FALSE, + 2 ); ctx->Const.MinPointSize = 1.0; ctx->Const.MinPointSizeAA = 1.0; diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index c15e9fa3009..9c495869984 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -170,6 +170,10 @@ struct r300_dma { typedef struct r300_tex_obj r300TexObj, *r300TexObjPtr; +/* Maximum number of mipmap levels supported by any supported GPU + */ +#define R300_MAX_TEXTURE_LEVELS 13 + /* Texture object in locally shared texture space. */ struct r300_tex_obj { @@ -178,7 +182,7 @@ struct r300_tex_obj { GLuint bufAddr; /* Offset to start of locally shared texture block */ - drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS]; + drm_radeon_tex_image_t image[6][R300_MAX_TEXTURE_LEVELS]; /* Six, for the cube faces */ GLboolean image_override; /* Image overridden by GLX_EXT_tfp */ diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c index b03eefaa7c5..0fe51b0c680 100644 --- a/src/mesa/drivers/dri/r300/r300_texmem.c +++ b/src/mesa/drivers/dri/r300/r300_texmem.c @@ -306,7 +306,7 @@ static void r300UploadSubImage(r300ContextPtr rmesa, r300TexObjPtr t, ASSERT(face < 6); /* Ensure we have a valid texture to upload */ - if ((hwlevel < 0) || (hwlevel >= RADEON_MAX_TEXTURE_LEVELS)) { + if ((hwlevel < 0) || (hwlevel >= R300_MAX_TEXTURE_LEVELS)) { _mesa_problem(NULL, "bad texture level in %s", __FUNCTION__); return; } diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index e2329f04ec7..cadec7f3ecf 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -345,7 +345,7 @@ static void r300SetTexImages(r300ContextPtr rmesa, numLevels = t->base.lastLevel - t->base.firstLevel + 1; - assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS); + assert(numLevels <= R300_MAX_TEXTURE_LEVELS); /* Calculate mipmap offsets and dimensions for blitting (uploading) * The idea is that we lay out the mipmap levels within a block of -- cgit v1.2.3 From ff421b6e0b3ef218799350358b9bff5610f17c3a Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 24 Mar 2009 20:51:53 -0700 Subject: r300_cmdbuf.c: convert cast to a form supported by Sun cc Fixes Sun cc error: "r300_cmdbuf.c", line 142: invalid cast expression Signed-off-by: Alan Coopersmith --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 3eb2dc8f5a0..f4472756f10 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -139,7 +139,7 @@ static void r300PrintStateAtom(r300ContextPtr r300, struct r300_state_atom *stat if (RADEON_DEBUG & DEBUG_VERBOSE) { for (i = 0; i < dwords;) { - cmd = (drm_r300_cmd_header_t) state->cmd[i]; + cmd = *((drm_r300_cmd_header_t *) &state->cmd[i]); reg = (cmd.packet0.reghi << 8) | cmd.packet0.reglo; fprintf(stderr, " %s[%d]: cmdpacket0 (first reg=0x%04x, count=%d)\n", state->name, i, reg, cmd.packet0.count); -- cgit v1.2.3 From e36f01a7a195a747c7d40bc0bab0bfbd00f0a5a7 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 25 Mar 2009 05:48:07 -0700 Subject: r300-gallium: r500-fs: Remove unused variable. --- src/gallium/drivers/r300/r300_state_shader.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index 20b83bd15b1..b5dc1a61b0e 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -371,7 +371,6 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, struct r300_fs_asm* assembler, struct tgsi_full_instruction* inst) { - int i; /* Switch between opcodes. When possible, prefer using the official * AMD/ATI names for opcodes, please, as it facilitates using the * documentation. */ -- cgit v1.2.3 From 1db736f74a911f74228d6843f4d981eeafb8669d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 25 Mar 2009 06:24:39 -0700 Subject: r300-gallium: Unify shader interfaces, enable r300 shader, start unbreaking. progs/trivial/clear no longer is horrifically wrong, just kind of wrong. --- src/gallium/drivers/r300/r300_emit.c | 2 +- src/gallium/drivers/r300/r300_state.c | 6 +- src/gallium/drivers/r300/r300_state_shader.c | 102 +++++++++++++++++++++------ src/gallium/drivers/r300/r300_state_shader.h | 5 +- 4 files changed, 84 insertions(+), 31 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 9bfb89626cd..bf190a7dcdc 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -87,7 +87,7 @@ void r300_emit_fragment_shader(struct r300_context* r300, BEGIN_CS(22); - OUT_CS_REG(R300_US_CONFIG, MAX2(fs->indirections - 1, 0)); + OUT_CS_REG(R300_US_CONFIG, fs->indirections); OUT_CS_REG(R300_US_PIXSIZE, fs->shader.stack_size); /* XXX figure out exactly how big the sizes are on this reg */ OUT_CS_REG(R300_US_CODE_OFFSET, 0x0); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 2a026e7fcac..8c38f7c706e 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -293,11 +293,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader) r300->fs = NULL; return; } else if (!fs->translated) { - if (r300_screen(r300->context.screen)->caps->is_r500) { - r500_translate_fragment_shader(r300, (struct r500_fragment_shader*)fs); - } else { - r300_translate_fragment_shader(r300, (struct r300_fragment_shader*)fs); - } + r300_translate_fragment_shader(r300, fs); } fs->translated = TRUE; diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index b5dc1a61b0e..7d81cb87a24 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -171,6 +171,26 @@ static INLINE uint32_t r500_alpha_swiz(struct tgsi_full_src_register* reg) (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) { switch (op) { @@ -249,6 +269,33 @@ 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[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) | + R300_RGB_SWIZB(R300_ALU_ARGC_ONE) | + R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) | + R300_ALU_OUTC_MAD; + fs->instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | + R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ; + fs->instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) | + R300_ALPHA_SWIZB(R300_ALU_ARGA_ONE) | + R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) | + R300_ALU_OUTA_MAD; + fs->instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) | + R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT; + + fs->alu_instruction_count++; + fs->indirections = 0; + fs->shader.stack_size = 2; +} + /* Setup an ALU operation. */ static INLINE void r500_emit_alu(struct r500_fragment_shader* fs, struct r300_fs_asm* assembler, @@ -367,6 +414,27 @@ static INLINE void r500_emit_tex(struct r500_fragment_shader* fs, } } +static void r300_fs_instruction(struct r300_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] = 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; + } +} + static void r500_fs_instruction(struct r500_fragment_shader* fs, struct r300_fs_asm* assembler, struct tgsi_full_instruction* inst) @@ -497,24 +565,11 @@ static void r500_fs_finalize(struct r500_fragment_shader* fs, } void r300_translate_fragment_shader(struct r300_context* r300, - struct r300_fragment_shader* fs) -{ - struct tgsi_parse_context parser; - - tgsi_parse_init(&parser, fs->shader.state.tokens); - - while (!tgsi_parse_end_of_tokens(&parser)) { - tgsi_parse_token(&parser); - } - - r300_copy_passthrough_shader(fs); -} - -void r500_translate_fragment_shader(struct r300_context* r300, - struct r500_fragment_shader* fs) + 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]; @@ -525,7 +580,7 @@ void r500_translate_fragment_shader(struct r300_context* r300, /* Setup starting offset for immediates. */ assembler->imm_offset = consts->user_count; - tgsi_parse_init(&parser, fs->shader.state.tokens); + tgsi_parse_init(&parser, fs->state.tokens); while (!tgsi_parse_end_of_tokens(&parser)) { tgsi_parse_token(&parser); @@ -552,8 +607,13 @@ void r500_translate_fragment_shader(struct r300_context* r300, assembler->imm_count++; break; case TGSI_TOKEN_TYPE_INSTRUCTION: - r500_fs_instruction(fs, assembler, - &parser.FullToken.FullInstruction); + 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; } @@ -567,10 +627,10 @@ void r500_translate_fragment_shader(struct r300_context* r300, debug_printf("r300: %d total constants, " "%d from user and %d from immediates\n", consts->count, consts->user_count, assembler->imm_count); - r500_fs_finalize(fs, assembler); + //r500_fs_finalize(fs, assembler); - tgsi_dump(fs->shader.state.tokens); - r500_fs_dump(fs); + tgsi_dump(fs->state.tokens); + //r500_fs_dump(fs); tgsi_parse_free(&parser); FREE(assembler); diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index 06c0bb73789..fdba207e183 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -102,10 +102,7 @@ struct r300_fs_asm { }; void r300_translate_fragment_shader(struct r300_context* r300, - struct r300_fragment_shader* fs); - -void r500_translate_fragment_shader(struct r300_context* r300, - struct r500_fragment_shader* fs); + struct r3xx_fragment_shader* fs); static const struct r300_fragment_shader r300_passthrough_fragment_shader = { /* XXX This is the emission code. TODO: decode -- cgit v1.2.3 From def5660c9eed84f92838f9f7679deef94ab27c58 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 25 Mar 2009 07:15:07 -0700 Subject: r300-gallium: r300-fs: Moar. --- src/gallium/drivers/r300/r300_context.h | 5 +--- src/gallium/drivers/r300/r300_debug.c | 8 +++++++ src/gallium/drivers/r300/r300_emit.c | 4 ++-- src/gallium/drivers/r300/r300_state_shader.c | 36 +++++++++++++++++----------- src/gallium/drivers/r300/r300_state_shader.h | 4 ++-- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 0e5e471d116..ed6480bea79 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -169,10 +169,7 @@ struct r300_fragment_shader { int indirections; /* Indirection node offsets */ - int offset0; - int offset1; - int offset2; - int offset3; + int alu_offset[4]; /* Machine instructions */ struct { diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index f657588c720..8d44756c332 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -22,6 +22,14 @@ #include "r300_debug.h" +static void r300_dump_fs(struct r300_fragment_shader* fs) +{ + int i; + + for (i = 0; i < fs->alu_instruction_count; i++) { + } +} + static char* r500_fs_swiz[] = { " R", " G", diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index bf190a7dcdc..16455e48ce8 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -90,12 +90,12 @@ void r300_emit_fragment_shader(struct r300_context* r300, OUT_CS_REG(R300_US_CONFIG, fs->indirections); OUT_CS_REG(R300_US_PIXSIZE, fs->shader.stack_size); /* XXX figure out exactly how big the sizes are on this reg */ - OUT_CS_REG(R300_US_CODE_OFFSET, 0x0); + OUT_CS_REG(R300_US_CODE_OFFSET, 0x40); /* XXX figure these ones out a bit better kthnx */ OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0); OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0); OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0); - OUT_CS_REG(R300_US_CODE_ADDR_3, R300_RGBA_OUT); + OUT_CS_REG(R300_US_CODE_ADDR_3, 0x40 | R300_RGBA_OUT); for (i = 0; i < fs->alu_instruction_count; i++) { OUT_CS_REG(R300_US_ALU_RGB_INST_0 + (4 * i), diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index 7d81cb87a24..ed9d26f0b9b 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -278,22 +278,20 @@ static INLINE void r300_emit_maths(struct r300_fragment_shader* fs, { int i = fs->alu_instruction_count; - fs->instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) | - R300_RGB_SWIZB(R300_ALU_ARGC_ONE) | + 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_ALU_OUTC_MAD; - fs->instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | + 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[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) | - R300_ALPHA_SWIZB(R300_ALU_ARGA_ONE) | + 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_ALU_OUTA_MAD; - fs->instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) | + 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++; - fs->indirections = 0; - fs->shader.stack_size = 2; } /* Setup an ALU operation. */ @@ -554,11 +552,15 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, } } -static void r500_fs_finalize(struct r500_fragment_shader* fs, +static void r300_fs_finalize(struct r3xx_fragment_shader* fs, struct r300_fs_asm* assembler) { - fs->shader.stack_size = assembler->temp_count + assembler->temp_offset; + fs->stack_size = assembler->temp_count + assembler->temp_offset; +} +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; @@ -627,10 +629,16 @@ void r300_translate_fragment_shader(struct r300_context* r300, debug_printf("r300: %d total constants, " "%d from user and %d from immediates\n", consts->count, consts->user_count, assembler->imm_count); - //r500_fs_finalize(fs, assembler); + r300_fs_finalize(fs, assembler); + if (is_r500) { + r500_fs_finalize((struct r500_fragment_shader*)fs, assembler); + } tgsi_dump(fs->state.tokens); - //r500_fs_dump(fs); + /* 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/r300_state_shader.h index fdba207e183..e83d007ba20 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -115,8 +115,8 @@ static const struct r300_fragment_shader r300_passthrough_fragment_shader = { */ .alu_instruction_count = 1, .tex_instruction_count = 0, - .indirections = 1, - .shader.stack_size = 2, + .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_ONE) | -- cgit v1.2.3 From 7c8639e007c2daeb0a192c30bb56a9716b65da20 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Wed, 25 Mar 2009 14:04:18 +0000 Subject: slang: ensure structure elements have their array length set --- src/mesa/shader/slang/slang_typeinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c index 1ef43f58c02..4a48bc8b8ee 100644 --- a/src/mesa/shader/slang/slang_typeinfo.c +++ b/src/mesa/shader/slang/slang_typeinfo.c @@ -790,6 +790,7 @@ _slang_typeof_operation(slang_operation * op, return GL_FALSE; } ti->can_be_referenced = _ti.can_be_referenced; + ti->array_len = field->array_len; } else { GLuint rows; -- cgit v1.2.3 From 66b0b200ee53fe342466513640deef55619cab17 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 Mar 2009 08:17:37 -0600 Subject: egl: don't use __FUNCTION__ in error messages --- src/egl/main/eglconfigutil.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/egl/main/eglconfigutil.c b/src/egl/main/eglconfigutil.c index 7061df691b2..138dc729e74 100644 --- a/src/egl/main/eglconfigutil.c +++ b/src/egl/main/eglconfigutil.c @@ -192,8 +192,8 @@ _eglFillInConfigs(_EGLConfig * configs, if ( bytes_per_pixel[index] == 0 ) { _eglLog(_EGL_INFO, - "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.", - __FUNCTION__, __LINE__, fb_type); + "[_eglFillInConfigs:%u] Framebuffer type 0x%04x has 0 bytes per pixel.", + __LINE__, fb_type); return GL_FALSE; } @@ -227,8 +227,8 @@ _eglFillInConfigs(_EGLConfig * configs, default: _eglLog(_EGL_WARNING, - "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.", - __FUNCTION__, __LINE__, fb_format); + "[_eglFillInConfigs:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.", + __LINE__, fb_format); return GL_FALSE; } -- cgit v1.2.3 From 4934ddf5d76775ca3364be08034ebac47e831ec7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 Mar 2009 08:33:10 -0600 Subject: gl: update include/GL/glext.h to version 48 --- include/GL/glext.h | 62 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/include/GL/glext.h b/include/GL/glext.h index d3f01a2b6c4..b24142934e9 100644 --- a/include/GL/glext.h +++ b/include/GL/glext.h @@ -46,9 +46,9 @@ extern "C" { /*************************************************************/ /* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated 2009/03/04 */ +/* glext.h last updated 2009/03/19 */ /* Current version at http://www.opengl.org/registry/ */ -#define GL_GLEXT_VERSION 46 +#define GL_GLEXT_VERSION 48 #ifndef GL_VERSION_1_2 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 @@ -3878,6 +3878,26 @@ extern "C" { #define GL_PERFMON_RESULT_AMD 0x8BC6 #endif +#ifndef GL_AMD_texture_texture4 +#endif + +#ifndef GL_AMD_vertex_shader_tesselator +#define GL_SAMPLER_BUFFER_AMD 0x9001 +#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 +#define GL_TESSELLATION_MODE_AMD 0x9004 +#define GL_TESSELLATION_FACTOR_AMD 0x9005 +#define GL_DISCRETE_AMD 0x9006 +#define GL_CONTINUOUS_AMD 0x9007 +#endif + +#ifndef GL_EXT_provoking_vertex +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_PROVOKING_VERTEX_EXT 0x8E4F +#endif + /*************************************************************/ @@ -4503,8 +4523,8 @@ GLAPI void APIENTRY glBeginTransformFeedback (GLenum); GLAPI void APIENTRY glEndTransformFeedback (void); GLAPI void APIENTRY glBindBufferRange (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); GLAPI void APIENTRY glBindBufferBase (GLenum, GLuint, GLuint); -GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLint *, GLenum); -GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLint *); +GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLchar* *, GLenum); +GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); GLAPI void APIENTRY glClampColor (GLenum, GLenum); GLAPI void APIENTRY glBeginConditionalRender (GLuint, GLenum); GLAPI void APIENTRY glEndConditionalRender (void); @@ -4562,8 +4582,8 @@ typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLint *location); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); @@ -8053,16 +8073,16 @@ GLAPI void APIENTRY glEndTransformFeedbackEXT (void); GLAPI void APIENTRY glBindBufferRangeEXT (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum, GLuint, GLuint, GLintptr); GLAPI void APIENTRY glBindBufferBaseEXT (GLenum, GLuint, GLuint); -GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLint *, GLenum); -GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLint *); +GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLchar* *, GLenum); +GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLint *location); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); #endif #ifndef GL_EXT_direct_state_access @@ -8515,6 +8535,28 @@ typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); #endif +#ifndef GL_AMD_texture_texture4 +#define GL_AMD_texture_texture4 1 +#endif + +#ifndef GL_AMD_vertex_shader_tesselator +#define GL_AMD_vertex_shader_tesselator 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTessellationFactorAMD (GLfloat); +GLAPI void APIENTRY glTessellationModeAMD (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_provoking_vertex +#define GL_EXT_provoking_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProvokingVertexEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode); +#endif + #ifdef __cplusplus } -- cgit v1.2.3 From 11da7e02aa3dba192aa3d95e9debec620133a41c Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Wed, 25 Mar 2009 15:53:28 +0100 Subject: Revert "dri2: Avoid round-tripping on DRI2GetBuffers for the same set of buffers." This scheme breaks when the display connection doesn't receive ConfigureNotify events. This caused reporoducible problems (cropped / misplaced output) when starting a 3D application in a guest operating system in VMware Workstation. This reverts commit dd1c68f15123a889a3ce9d2afe724e272d163e32. Conflicts: src/glx/x11/dri2_glx.c --- src/glx/x11/dri2_glx.c | 52 ------------------------------------------------- src/glx/x11/glxclient.h | 1 - 2 files changed, 53 deletions(-) diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c index 0ef5d3ab56f..9c8f1101b9e 100644 --- a/src/glx/x11/dri2_glx.c +++ b/src/glx/x11/dri2_glx.c @@ -60,9 +60,6 @@ struct __GLXDRIdisplayPrivateRec { int driMajor; int driMinor; int driPatch; - - unsigned long configureSeqno; - Bool (*oldConfigProc)(Display *, XEvent *, xEvent *); }; struct __GLXDRIcontextPrivateRec { @@ -76,7 +73,6 @@ struct __GLXDRIdrawablePrivateRec { __DRIbuffer buffers[5]; int bufferCount; int width, height; - unsigned long configureSeqno; int have_back; int have_front; int have_fake_front; @@ -174,7 +170,6 @@ static __GLXDRIdrawable *dri2CreateDrawable(__GLXscreenConfigs *psc, pdraw->base.drawable = drawable; pdraw->base.psc = psc; pdraw->bufferCount = 0; - pdraw->configureSeqno = ~0; DRI2CreateDrawable(psc->dpy, xDrawable); @@ -293,30 +288,9 @@ dri2GetBuffers(__DRIdrawable *driDrawable, int *out_count, void *loaderPrivate) { __GLXDRIdrawablePrivate *pdraw = loaderPrivate; - __GLXdisplayPrivate *dpyPriv = __glXInitialize(pdraw->base.psc->dpy); - __GLXDRIdisplayPrivate *pdp = (__GLXDRIdisplayPrivate *)dpyPriv->dri2Display; DRI2Buffer *buffers; int i; - /** - * Check if a ConfigureNotify has come in since we last asked for the - * buffers associated with this drawable. If not, we can assume that they're - * the same set at glViewport time, and save a synchronous round-trip to the - * X Server. - */ - if (pdraw->configureSeqno == pdp->configureSeqno && - count == pdraw->bufferCount) { - for (i = 0; i < count; i++) { - if (pdraw->buffers[i].attachment != attachments[i]) - break; - } - if (i == count) { - *out_count = pdraw->bufferCount; - return pdraw->buffers; - } - } - pdraw->configureSeqno = pdp->configureSeqno; - buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable, width, height, attachments, count, out_count); if (buffers == NULL) @@ -468,28 +442,6 @@ static void dri2DestroyDisplay(__GLXDRIdisplay *dpy) Xfree(dpy); } -/** - * Makes a note on receiving ConfigureNotify that we need to re-check the - * DRI2 buffers, as window sizes may have resulted in reallocation. - */ -static Bool dri2ConfigureNotifyProc(Display *dpy, XEvent *re, xEvent *event) -{ - __GLXdisplayPrivate *dpyPriv = __glXInitialize(dpy); - __GLXDRIdisplayPrivate *pdp; - Bool ret; - - /* We should always be able to find our pdp, as it only gets torn down - * when the Display is torn down. - */ - pdp = (__GLXDRIdisplayPrivate *)dpyPriv->dri2Display; - - ret = pdp->oldConfigProc(dpy, re, event); - - pdp->configureSeqno = re->xconfigure.serial; - - return ret; -} - /* * Allocate, initialize and return a __DRIdisplayPrivate object. * This is called from __glXInitialize() when we are given a new @@ -512,11 +464,7 @@ _X_HIDDEN __GLXDRIdisplay *dri2CreateDisplay(Display *dpy) return NULL; } - pdp->oldConfigProc = XESetWireToEvent(dpy, ConfigureNotify, - dri2ConfigureNotifyProc); - pdp->driPatch = 0; - pdp->configureSeqno = 0; pdp->base.destroyDisplay = dri2DestroyDisplay; pdp->base.createScreen = dri2CreateScreen; diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index c42e80a0e86..fa3ec26e60a 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -609,7 +609,6 @@ extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint, const GLvoid *, GLint); /* Initialize the GLX extension for dpy */ -extern __GLXdisplayPrivate * __glXGetPrivateFromDisplay(Display *dpy); extern __GLXdisplayPrivate *__glXInitialize(Display*); extern void __glXPreferEGL(int state); -- cgit v1.2.3 From c10df26a31b6af5a720fbfd06411d580cd38a2c8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 Mar 2009 08:59:31 -0600 Subject: glew: fix GLEW_LIB_NAME This fixes rebuilding of the library every time we run make. --- src/glew/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glew/Makefile b/src/glew/Makefile index 8e6ccb4f7c3..cd692f3ef78 100644 --- a/src/glew/Makefile +++ b/src/glew/Makefile @@ -6,7 +6,7 @@ include $(TOP)/configs/current ##### MACROS ##### -GLEW_LIB_NAME = libglew.a +GLEW_LIB_NAME = libGLEW.a MAJOR = 1 MINOR = 5 -- cgit v1.2.3 From 3cf6e62ae32870d16b2cfc45a37e54a6fb3a1fbe Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 23 Mar 2009 16:51:54 -0700 Subject: mklib improvements for Solaris Move flags for linking standard C/C++ libraries from configure.ac to mklib Use -norunpath flag when linking with Sun C++ compiler Convert mklib -exports list into a linker mapfile Set FINAL_LIBS correctly when -noprefix is used Signed-off-by: Alan Coopersmith --- bin/mklib | 28 +++++++++++++++++++++++++++- configure.ac | 35 ++++++++++++----------------------- 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/bin/mklib b/bin/mklib index d7b740f8e34..a3e826abac9 100755 --- a/bin/mklib +++ b/bin/mklib @@ -394,6 +394,30 @@ case $ARCH in fi fi + # If using Sun C++ compiler, need to tell it not to add runpaths + # that are specific to the build machine + if [ ${LINK} = "CC" ] ; then + OPTS="${OPTS} -norunpath" + fi + + # Solaris linker requires explicitly listing the Standard C & C++ + # libraries in the link path when building shared objects + if [ ${LINK} = "CC" ] ; then + DEPS="${DEPS} -lCrun" + fi + DEPS="${DEPS} -lc" + + if [ $EXPORTS ] ; then + # Make the 'mapfile.scope' linker mapfile + echo "{" > mapfile.scope + echo "global:" >> mapfile.scope + sed 's/$/;/' ${EXPORTS} >> mapfile.scope + echo "local:" >> mapfile.scope + echo " *;" >> mapfile.scope + echo "};" >> mapfile.scope + OPTS="${OPTS} -Wl,-Mmapfile.scope" + fi + # Check if objects are SPARC v9 # file says: ELF 64-bit MSB relocatable SPARCV9 Version 1 set ${OBJECTS} @@ -406,17 +430,19 @@ case $ARCH in if [ "${ALTOPTS}" ] ; then OPTS=${ALTOPTS} fi + # for debug: #echo "mklib: linker is" ${LINK} ${OPTS} if [ $NOPREFIX = 1 ] ; then rm -f ${LIBNAME} ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS="${LIBNAME}" else rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} + FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" fi - FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" fi ;; diff --git a/configure.ac b/configure.ac index 46070fd73c9..67994274f3a 100644 --- a/configure.ac +++ b/configure.ac @@ -375,17 +375,6 @@ if test "x$enable_selinux" = "xyes"; then DEFINES="$DEFINES -DMESA_SELINUX" fi -dnl OS-specific libraries -OS_LIBS="" -case "$host_os" in -solaris*) - OS_LIBS="-lc" - if test "x$GXX" != xyes; then - OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS" - fi - ;; -esac - dnl dnl Driver configuration. Options are xlib, dri and osmesa right now. dnl More later: directfb, fbdev, ... @@ -561,8 +550,8 @@ xlib) GL_PC_LIB_PRIV="$GL_LIB_DEPS" GL_PC_CFLAGS="$X11_INCLUDES" fi - GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS" - GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $OS_LIBS" + GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread" + GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread" # if static, move the external libraries to the programs # and empty the libraries for libGL @@ -612,12 +601,12 @@ dri) fi # need DRM libs, -lpthread, etc. - GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS" - GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS $OS_LIBS" + GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" + GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" ;; osmesa) # No libGL for osmesa - GL_LIB_DEPS="$OS_LIBS" + GL_LIB_DEPS="" ;; esac AC_SUBST([GL_LIB_DEPS]) @@ -860,9 +849,9 @@ osmesa) ;; esac if test "$enable_static" = no; then - OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS" + OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS" fi -OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV $OS_LIBS" +OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV" AC_SUBST([OSMESA_LIB_DEPS]) AC_SUBST([OSMESA_MESA_DEPS]) AC_SUBST([OSMESA_PC_REQ]) @@ -878,7 +867,7 @@ else # should check these... EGL_LIB_DEPS="$X_LIBS -lX11" fi -EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS $OS_LIBS" +EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS" AC_SUBST([EGL_LIB_DEPS]) dnl @@ -988,10 +977,10 @@ if test "x$enable_glw" = xyes; then fi # If static, empty GLW_LIB_DEPS and add libs for programs to link - GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV $OS_LIBS" + GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV" if test "$enable_static" = no; then GLW_MESA_DEPS='-l$(GL_LIB)' - GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS" + GLW_LIB_DEPS="$GLW_LIB_DEPS" else APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS" GLW_LIB_DEPS="" @@ -1047,8 +1036,8 @@ if test "x$enable_glut" = xyes; then GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS" GLUT_PC_CFLAGS="$X11_INCLUDES" fi - GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS" - GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm $OS_LIBS" + GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm" + GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm" # If glut is available, we can build most programs if test "$with_demos" = yes; then -- cgit v1.2.3 From 6dd9c221012d5e091b2ede90d9b2a6f0383abd58 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 23 Mar 2009 19:38:58 -0700 Subject: Convert u_int*_t to C99 standard uint*_t Signed-off-by: Alan Coopersmith --- include/EGL/eglext.h | 4 ++-- include/EGL/eglplatform.h | 2 +- src/mesa/drivers/dri/common/utils.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index a4698ccd160..b65f7f2bcc6 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -136,8 +136,8 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGL #define EGL_INTERLACED_MESA 0x4008 #define EGL_SCREEN_BIT_MESA 0x08 -typedef u_int32_t EGLScreenMESA; -typedef u_int32_t EGLModeMESA; +typedef uint32_t EGLScreenMESA; +typedef uint32_t EGLModeMESA; #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h index d873428d756..0f34da063e3 100644 --- a/include/EGL/eglplatform.h +++ b/include/EGL/eglplatform.h @@ -57,7 +57,7 @@ #endif typedef long int32_t; -typedef unsigned long u_int32_t; +typedef unsigned long uint32_t; typedef unsigned char uint8_t; #define snprintf _snprintf #define strcasecmp _stricmp diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index c9acd81be74..66f277c10b2 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -481,7 +481,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes, - const u_int8_t * msaa_samples, unsigned num_msaa_modes) + const uint8_t * msaa_samples, unsigned num_msaa_modes) { static const uint8_t bits_table[4][4] = { /* R G B A */ -- cgit v1.2.3 From ad11107206ff4954366d77f334431b637ee256fa Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 23 Mar 2009 20:17:57 -0700 Subject: Add #ifdefs needed to compile Gallium on Solaris with gcc or Sun cc Signed-off-by: Alan Coopersmith --- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 4 ++-- src/gallium/auxiliary/rtasm/rtasm_execmem.c | 6 +++--- src/gallium/auxiliary/util/u_stream_stdc.c | 2 +- src/gallium/auxiliary/util/u_time.c | 12 ++++++------ src/gallium/auxiliary/util/u_time.h | 6 +++--- src/gallium/drivers/trace/tr_dump.c | 4 ++-- src/gallium/include/pipe/p_compiler.h | 19 +++++++++++++++++++ src/gallium/include/pipe/p_config.h | 12 ++++++++---- src/gallium/include/pipe/p_thread.h | 10 +++++----- 9 files changed, 49 insertions(+), 26 deletions(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 48d76a7af79..2cd0b8a8cdf 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -36,7 +36,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) #include #include #endif @@ -573,7 +573,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list) /* Wait on outstanding fences */ while (fenced_list->numDelayed) { pipe_mutex_unlock(fenced_list->mutex); -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) sched_yield(); #endif _fenced_buffer_list_check_free(fenced_list, 1); diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c index 1f0923b6831..01811d50114 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c +++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c @@ -42,7 +42,7 @@ #endif -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) /* @@ -118,7 +118,7 @@ rtasm_exec_free(void *addr) } -#else /* PIPE_OS_LINUX || PIPE_OS_BSD */ +#else /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */ /* * Just use regular memory. @@ -138,4 +138,4 @@ rtasm_exec_free(void *addr) } -#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */ +#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */ diff --git a/src/gallium/auxiliary/util/u_stream_stdc.c b/src/gallium/auxiliary/util/u_stream_stdc.c index 0ead45a7491..d8f648e5dd1 100644 --- a/src/gallium/auxiliary/util/u_stream_stdc.c +++ b/src/gallium/auxiliary/util/u_stream_stdc.c @@ -32,7 +32,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_OS_SOLARIS) #include diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c index 357d9360c90..8afe4fccf7b 100644 --- a/src/gallium/auxiliary/util/u_time.c +++ b/src/gallium/auxiliary/util/u_time.c @@ -35,7 +35,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) #include #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) #include @@ -77,7 +77,7 @@ util_time_get_frequency(void) void util_time_get(struct util_time *t) { -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) gettimeofday(&t->tv, NULL); #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) LONGLONG temp; @@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1, int64_t usecs, struct util_time *t2) { -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000; t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) @@ -124,7 +124,7 @@ int64_t util_time_diff(const struct util_time *t1, const struct util_time *t2) { -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) return (t2->tv.tv_usec - t1->tv.tv_usec) + (t2->tv.tv_sec - t1->tv.tv_sec)*1000000; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) @@ -144,7 +144,7 @@ util_time_micros( void ) util_time_get(&t1); -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) util_time_get_frequency(); @@ -166,7 +166,7 @@ static INLINE int util_time_compare(const struct util_time *t1, const struct util_time *t2) { -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) if (t1->tv.tv_sec < t2->tv.tv_sec) return -1; else if(t1->tv.tv_sec > t2->tv.tv_sec) diff --git a/src/gallium/auxiliary/util/u_time.h b/src/gallium/auxiliary/util/u_time.h index 4346ce1fa45..6bca6077a2a 100644 --- a/src/gallium/auxiliary/util/u_time.h +++ b/src/gallium/auxiliary/util/u_time.h @@ -38,7 +38,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) #include /* timeval */ #include /* usleep */ #endif @@ -58,7 +58,7 @@ extern "C" { */ struct util_time { -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) struct timeval tv; #else int64_t counter; @@ -89,7 +89,7 @@ util_time_timeout(const struct util_time *start, const struct util_time *end, const struct util_time *curr); -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) #define util_time_sleep usleep #else void diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index 6837c94542d..5fb020538ee 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -40,7 +40,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) #include #endif @@ -239,7 +239,7 @@ boolean trace_dump_trace_begin() trace_dump_writes("\n"); trace_dump_writes("\n"); -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) /* Linux applications rarely cleanup GL / Gallium resources so catch * application exit here */ atexit(trace_dump_trace_close); diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index bc2a0a7ef3a..e6a67f8c2fd 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -124,11 +124,30 @@ typedef unsigned char boolean; # define INLINE inline # elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) # define INLINE __inline +# elif defined(__SUNPRO_C) && defined(__C99FEATURES__) +# define INLINE inline +# elif (__STDC_VERSION__ >= 199901L) /* C99 */ +# define INLINE inline # else # define INLINE # endif #endif +/* The __FUNCTION__ gcc variable is generally only used for debugging. + * If we're not using gcc, define __FUNCTION__ as a cpp symbol here. + */ +#ifndef __FUNCTION__ +# if (!defined(__GNUC__) || (__GNUC__ < 2)) +# if (__STDC_VERSION__ >= 199901L) /* C99 */ || \ + (defined(__SUNPRO_C) && defined(__C99FEATURES__)) +# define __FUNCTION__ __func__ +# else +# define __FUNCTION__ "" +# endif +# endif +#endif + + /* This should match linux gcc cdecl semantics everywhere, so that we * just codegen one calling convention on all platforms. diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h index 7f7657031d8..63238ea46e9 100644 --- a/src/gallium/include/pipe/p_config.h +++ b/src/gallium/include/pipe/p_config.h @@ -77,11 +77,11 @@ * Processor architecture */ -#if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386) +#if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386) || defined(__i386) /* Sun cc */ #define PIPE_ARCH_X86 #endif -#if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */ +#if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */ || defined(__x86_64) /* Sun cc */ #define PIPE_ARCH_X86_64 #endif @@ -115,6 +115,10 @@ #define PIPE_OS_BSD #endif +#if defined(__sun) +#define PIPE_OS_SOLARIS +#endif + #if defined(_WIN32) || defined(WIN32) #define PIPE_OS_WINDOWS #endif @@ -126,9 +130,9 @@ * NOTE: There is no way to auto-detect most of these. */ -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) #define PIPE_SUBSYSTEM_DRI -#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */ +#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */ #if defined(PIPE_OS_WINDOWS) #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h index a9cd77541d4..de55e99ed49 100644 --- a/src/gallium/include/pipe/p_thread.h +++ b/src/gallium/include/pipe/p_thread.h @@ -38,7 +38,7 @@ #include "pipe/p_compiler.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) #include /* POSIX threads headers */ #include /* for perror() */ @@ -210,7 +210,7 @@ typedef unsigned pipe_condvar; */ typedef struct { -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) pthread_key_t key; #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) DWORD key; @@ -225,7 +225,7 @@ typedef struct { static INLINE void pipe_tsd_init(pipe_tsd *tsd) { -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) { perror("pthread_key_create(): failed to allocate key for thread specific data"); exit(-1); @@ -242,7 +242,7 @@ pipe_tsd_get(pipe_tsd *tsd) if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) { pipe_tsd_init(tsd); } -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) return pthread_getspecific(tsd->key); #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) assert(0); @@ -259,7 +259,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value) if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) { pipe_tsd_init(tsd); } -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) if (pthread_setspecific(tsd->key, value) != 0) { perror("pthread_set_specific() failed"); exit(-1); -- cgit v1.2.3 From 707c017af68df24441e86b8a69831633a4106ca3 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 23 Mar 2009 20:35:09 -0700 Subject: define __builtin_expect for non-gcc compilers in two more glx files Signed-off-by: Alan Coopersmith --- src/glx/x11/indirect_vertex_program.c | 4 ++++ src/glx/x11/pixelstore.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/glx/x11/indirect_vertex_program.c b/src/glx/x11/indirect_vertex_program.c index 865a4b1ba14..3313ac008a5 100644 --- a/src/glx/x11/indirect_vertex_program.c +++ b/src/glx/x11/indirect_vertex_program.c @@ -30,6 +30,10 @@ #include "indirect_vertex_array.h" #include +#if !defined __GNUC__ || __GNUC__ < 3 +# define __builtin_expect(x, y) x +#endif + static void do_vertex_attrib_enable(GLuint index, GLboolean val) { diff --git a/src/glx/x11/pixelstore.c b/src/glx/x11/pixelstore.c index 0eb31bf1e30..8b51b5d8b7f 100644 --- a/src/glx/x11/pixelstore.c +++ b/src/glx/x11/pixelstore.c @@ -31,6 +31,10 @@ #include "glxclient.h" #include "indirect.h" +#if !defined __GNUC__ || __GNUC__ < 3 +# define __builtin_expect(x, y) x +#endif + /** * Send glPixelStore command to the server * -- cgit v1.2.3 From 2e2f3b408655fa8abd97030af3d8482cfd7c6fa0 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 23 Mar 2009 20:35:54 -0700 Subject: Add Solaris to OS'es using X in eglplatform.h Signed-off-by: Alan Coopersmith --- include/EGL/eglplatform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h index 0f34da063e3..b6311f84aef 100644 --- a/include/EGL/eglplatform.h +++ b/include/EGL/eglplatform.h @@ -68,7 +68,7 @@ typedef HWND NativeWindowType; typedef HBITMAP NativePixmapType; /** END Added for Windows **/ -#elif defined(__gnu_linux__) || defined(__FreeBSD__) +#elif defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__sun) /** BEGIN Added for X (Mesa) **/ #ifndef EGLAPI -- cgit v1.2.3 From 33fa6a27557171e8368d96ebf8e61aad283538b1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 Mar 2009 13:02:44 -0600 Subject: egl: include stdint.h to get the c99 integer typedefs Fixes breakage from commit 6dd9c221012d5e091b2ede90d9b2a6f0383abd58 --- include/EGL/eglplatform.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h index b6311f84aef..83e89cd7043 100644 --- a/include/EGL/eglplatform.h +++ b/include/EGL/eglplatform.h @@ -15,6 +15,7 @@ #if !defined(_WIN32_WCE) #include +#include #endif /* Macros used in EGL function prototype declarations. -- cgit v1.2.3 From 26e27ba30884be927cf1bc21d39f32d6096a6678 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 19:24:16 +0000 Subject: scons: Support building with the Windows SDK. x86_64 is also supported. --- common.py | 2 +- scons/gallium.py | 7 +- scons/generic.py | 7 +- scons/winsdk.py | 139 ++++++++++++++++++++++++++++++++++++++ src/gallium/winsys/gdi/SConscript | 2 +- 5 files changed, 151 insertions(+), 6 deletions(-) create mode 100644 scons/winsdk.py diff --git a/common.py b/common.py index 1a99df41c01..f1c6372abde 100644 --- a/common.py +++ b/common.py @@ -61,7 +61,7 @@ def AddOptions(opts): opts.Add(EnumOption('platform', 'target platform', default_platform, allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince'))) opts.Add(EnumOption('toolchain', 'compiler toolchain', 'default', - allowed_values=('default', 'crossmingw', 'winddk'))) + allowed_values=('default', 'crossmingw', 'winsdk', 'winddk'))) opts.Add(BoolOption('llvm', 'use LLVM', 'no')) opts.Add(BoolOption('dri', 'build DRI drivers', default_dri)) diff --git a/scons/gallium.py b/scons/gallium.py index ecdeef06fdf..ed4f49c1d89 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -198,14 +198,17 @@ def generate(env): env['toolchain'] = 'wcesdk' env.Tool(env['toolchain']) + env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-') + env['msvc'] = env['CC'] == 'cl' + # shortcuts debug = env['debug'] machine = env['machine'] platform = env['platform'] x86 = env['machine'] == 'x86' ppc = env['machine'] == 'ppc' - gcc = env['platform'] in ('linux', 'freebsd', 'darwin') or env['toolchain'] == 'crossmingw' - msvc = env['platform'] in ('windows', 'winddk', 'wince') and env['toolchain'] != 'crossmingw' + gcc = env['gcc'] + msvc = env['msvc'] # Put build output in a separate dir, which depends on the current # configuration. See also http://www.scons.org/wiki/AdvancedBuildExample diff --git a/scons/generic.py b/scons/generic.py index 01a374e3633..764b626e588 100644 --- a/scons/generic.py +++ b/scons/generic.py @@ -303,14 +303,17 @@ def generate(env): # Load tool chain env.Tool(env['toolchain']) + env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-') + env['msvc'] = env['CC'] == 'cl' + # shortcuts debug = env['debug'] machine = env['machine'] platform = env['platform'] x86 = env['machine'] == 'x86' ppc = env['machine'] == 'ppc' - gcc = env['platform'] in ('linux', 'freebsd', 'darwin') or env['toolchain'] == 'crossmingw' - msvc = env['platform'] in ('windows', 'winddk', 'wince') and env['toolchain'] != 'crossmingw' + gcc = env['gcc'] + msvc = env['msvc'] # C preprocessor options cppdefines = [] diff --git a/scons/winsdk.py b/scons/winsdk.py new file mode 100644 index 00000000000..255f9c5a654 --- /dev/null +++ b/scons/winsdk.py @@ -0,0 +1,139 @@ +"""winsdk + +Tool-specific initialization for Microsoft Windows SDK. + +""" + +# +# Copyright (c) 2001-2007 The SCons Foundation +# Copyright (c) 2008 Tungsten Graphics, Inc. +# Copyright (c) 2009 VMware, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +import os.path +import platform + +import SCons.Errors +import SCons.Util + +import msvc_sa +import mslib_sa +import mslink_sa + + +def get_vs_root(env): + # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 + path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0') + return path + +def get_vs_paths(env): + vs_root = get_vs_root(env) + if vs_root is None: + raise SCons.Errors.InternalError, "WINSDK compiler not found" + + tool_path = os.path.join(vs_root, 'Common7', 'IDE') + + env.PrependENVPath('PATH', tool_path) + +def get_vc_root(env): + # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VC7 + path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0', 'VC') + return path + +def get_vc_paths(env): + vc_root = get_vc_root(env) + if vc_root is None: + raise SCons.Errors.InternalError, "WINSDK compiler not found" + + target_cpu = env['machine'] + + if target_cpu in ('generic', 'x86'): + bin_dir = 'bin' + lib_dir = 'lib' + elif target_cpu == 'x86_64': + # TODO: take in consideration the host cpu + bin_dir = r'bin\x86_amd64' + lib_dir = r'lib\amd64' + else: + raise SCons.Errors.InternalError, "Unsupported target machine" + include_dir = 'include' + + exe_path = os.path.join(vc_root, bin_dir) + include_path = os.path.join(vc_root, include_dir) + lib_path = os.path.join(vc_root, lib_dir) + + env.PrependENVPath('INCLUDE', include_path) + env.PrependENVPath('LIB', lib_path) + env.PrependENVPath('PATH', exe_path) + +def get_sdk_root(env): + if SCons.Util.can_read_reg: + key = r'SOFTWARE\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder' + try: + path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key) + except SCons.Util.RegError: + pass + else: + return path + + return None + +def get_sdk_paths(env): + sdk_root = get_sdk_root(env) + if sdk_root is None: + raise SCons.Errors.InternalError, "WINSDK not found" + + target_cpu = env['machine'] + + bin_dir = 'Bin' + if target_cpu in ('generic', 'x86'): + lib_dir = 'Lib' + elif target_cpu == 'x86_64': + lib_dir = 'Lib/x64' + else: + raise SCons.Errors.InternalError, "Unsupported target machine" + include_dir = 'Include' + + exe_path = os.path.join(sdk_root, bin_dir) + include_path = os.path.join(sdk_root, include_dir) + lib_path = os.path.join(sdk_root, lib_dir) + + env.PrependENVPath('INCLUDE', include_path) + env.PrependENVPath('LIB', lib_path) + env.PrependENVPath('PATH', exe_path) + +def generate(env): + if not env.has_key('ENV'): + env['ENV'] = {} + + get_vs_paths(env) + get_vc_paths(env) + get_sdk_paths(env) + + msvc_sa.generate(env) + mslib_sa.generate(env) + mslink_sa.generate(env) + +def exists(env): + return get_vc_root(env) is not None and get_sdk_root(env) is not None + +# vim:set ts=4 sw=4 et: diff --git a/src/gallium/winsys/gdi/SConscript b/src/gallium/winsys/gdi/SConscript index 72b5df8ca24..42290d7603e 100644 --- a/src/gallium/winsys/gdi/SConscript +++ b/src/gallium/winsys/gdi/SConscript @@ -21,7 +21,7 @@ if env['platform'] == 'windows': 'gdi_softpipe_winsys.c', ] - if env['toolchain'] == 'crossmingw': + if env['gcc']: sources += ['#src/gallium/state_trackers/wgl/opengl32.mingw.def'] else: sources += ['#src/gallium/state_trackers/wgl/opengl32.def'] -- cgit v1.2.3 From 7860b0886c2f650152e5fb56e2a31ed6079665c1 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 19 Mar 2009 21:17:01 +0100 Subject: r300: cleanup swtcl a little - remove disabled code - silence compiler warnings (uinitialized values) - remove unneeded code --- src/mesa/drivers/dri/r300/r300_swtcl.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index d463ab3a2d6..ba3621b16b2 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -504,7 +504,7 @@ do { \ #define LOCAL_VARS(n) \ r300ContextPtr rmesa = R300_CONTEXT(ctx); \ - GLuint color[n], spec[n]; \ + GLuint color[n] = { 0, }, spec[n] = { 0, }; \ GLuint coloroffset = rmesa->swtcl.coloroffset; \ GLuint specoffset = rmesa->swtcl.specoffset; \ (void) color; (void) spec; (void) coloroffset; (void) specoffset; @@ -629,7 +629,6 @@ static void r300ChooseRenderState( GLcontext *ctx ) static void r300RenderStart(GLcontext *ctx) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); - // fprintf(stderr, "%s\n", __FUNCTION__); r300ChooseRenderState(ctx); r300SetVertexFormat(ctx); @@ -669,8 +668,6 @@ static void r300RenderPrimitive(GLcontext *ctx, GLenum prim) return; r300RasterPrimitive( ctx, reduced_prim[prim] ); - // fprintf(stderr, "%s\n", __FUNCTION__); - } static void r300ResetLineStipple(GLcontext *ctx) @@ -713,11 +710,6 @@ void r300InitSwtcl(GLcontext *ctx) _tnl_need_projected_coords( ctx, GL_FALSE ); r300ChooseRenderState(ctx); - - _mesa_validate_all_lighting_tables( ctx ); - - tnl->Driver.NotifyMaterialChange = - _mesa_validate_all_lighting_tables; } void r300DestroySwtcl(GLcontext *ctx) -- cgit v1.2.3 From b3e03ede3eeb224a2c293ae924ffa58f1de7e84a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 19:32:54 +0000 Subject: scons: Move MSVC specific away from Mingw builds. --- scons/gallium.py | 7 +++++-- scons/generic.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scons/gallium.py b/scons/gallium.py index ed4f49c1d89..e2cd0546c1e 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -251,9 +251,12 @@ def generate(env): ('WINVER', '0x0501'), # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx, 'WIN32_LEAN_AND_MEAN', - 'VC_EXTRALEAN', - '_CRT_SECURE_NO_DEPRECATE', ] + if msvc: + cppdefines += [ + 'VC_EXTRALEAN', + '_CRT_SECURE_NO_DEPRECATE', + ] if debug: cppdefines += ['_DEBUG'] if platform == 'winddk': diff --git a/scons/generic.py b/scons/generic.py index 764b626e588..03563e4c620 100644 --- a/scons/generic.py +++ b/scons/generic.py @@ -331,9 +331,12 @@ def generate(env): #'UNICODE', # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx, #'WIN32_LEAN_AND_MEAN', - 'VC_EXTRALEAN', - '_CRT_SECURE_NO_DEPRECATE', ] + if msvc: + cppdefines += [ + 'VC_EXTRALEAN', + '_CRT_SECURE_NO_DEPRECATE', + ] if debug: cppdefines += ['_DEBUG'] if platform == 'winddk': -- cgit v1.2.3 From 079be0fd3f1d0f52f26a95756809ac4a2325ccb1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 20:56:34 +0000 Subject: draw: Use size_t (for x86_64). --- src/gallium/auxiliary/draw/draw_vertex.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_vertex.h b/src/gallium/auxiliary/draw/draw_vertex.h index c143cf23723..554f4ac3c18 100644 --- a/src/gallium/auxiliary/draw/draw_vertex.h +++ b/src/gallium/auxiliary/draw/draw_vertex.h @@ -87,18 +87,17 @@ struct vertex_info } attrib[PIPE_MAX_SHADER_INPUTS]; }; -static INLINE int +static INLINE size_t draw_vinfo_size( const struct vertex_info *a ) { - return ((const char *)&a->attrib[a->num_attribs] - - (const char *)a); + return offsetof(const struct vertex_info, attrib[a->num_attribs]); } static INLINE int draw_vinfo_compare( const struct vertex_info *a, const struct vertex_info *b ) { - unsigned sizea = draw_vinfo_size( a ); + size_t sizea = draw_vinfo_size( a ); return memcmp( a, b, sizea ); } @@ -106,7 +105,7 @@ static INLINE void draw_vinfo_copy( struct vertex_info *dst, const struct vertex_info *src ) { - unsigned size = draw_vinfo_size( src ); + size_t size = draw_vinfo_size( src ); memcpy( dst, src, size ); } -- cgit v1.2.3 From 8c4bd92b68cf79ff94dc431f78a970bbab7e0d00 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 20:58:38 +0000 Subject: util: Don't use x86 asm on x86_64. --- src/gallium/auxiliary/util/u_debug.c | 10 +++++----- src/gallium/auxiliary/util/u_debug.h | 9 +++------ src/gallium/auxiliary/util/u_debug_stack.c | 2 +- src/gallium/auxiliary/util/u_math.h | 16 ++++++++++++---- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 0af69d8c8f0..1b984425b59 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -169,18 +169,18 @@ void debug_print_blob( const char *name, #endif -void _debug_break(void) +#ifndef debug_break +void debug_break(void) { -#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC) - __asm("int3"); -#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC) - _asm {int 3}; +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) + DebugBreak(); #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) EngDebugBreak(); #else abort(); #endif } +#endif #ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 33e7cb3419e..5e88f3ebb1a 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -125,19 +125,16 @@ void debug_print_format(const char *msg, unsigned fmt ); #endif -void _debug_break(void); - - /** * Hard-coded breakpoint. */ #ifdef DEBUG #if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC) #define debug_break() __asm("int3") -#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC) -#define debug_break() do { _asm {int 3} } while(0) +#elif defined(PIPE_CC_MSVC) +#define debug_break() __debugbreak() #else -#define debug_break() _debug_break() +void debug_break(void); #endif #else /* !DEBUG */ #define debug_break() ((void)0) diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c index 76068a65091..e5d61907c0e 100644 --- a/src/gallium/auxiliary/util/u_debug_stack.c +++ b/src/gallium/auxiliary/util/u_debug_stack.c @@ -49,7 +49,7 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, #if defined(PIPE_CC_GCC) frame_pointer = ((const void **)__builtin_frame_address(1)); -#elif defined(PIPE_CC_MSVC) +#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86) __asm { mov frame_pointer, ebp } diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 1ecde7a9125..9268a9bb7ee 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -319,11 +319,21 @@ util_iround(float f) -#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86) /** * Find first bit set in word. Least significant bit is 1. * Return 0 if no bits set. */ +#if defined(_MSC_VER) && _MSC_VER >= 1300 +static INLINE +unsigned long ffs( unsigned long u ) +{ + unsigned long i; + if(_BitScanForward(&i, u)) + return i + 1; + else + return 0; +} +#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86) static INLINE unsigned ffs( unsigned u ) { @@ -339,9 +349,7 @@ unsigned ffs( unsigned u ) return i; } -#endif - -#ifdef __MINGW32__ +#elif defined(__MINGW32__) #define ffs __builtin_ffs #endif -- cgit v1.2.3 From 9fb46fb4c30fe01c9cb485f909aca502691aaa3b Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 20:58:53 +0000 Subject: util: Use size_t (for x86_64). --- src/gallium/auxiliary/util/u_string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_string.h b/src/gallium/auxiliary/util/u_string.h index 08c89bbf770..cc7992d7391 100644 --- a/src/gallium/auxiliary/util/u_string.h +++ b/src/gallium/auxiliary/util/u_string.h @@ -130,7 +130,7 @@ static INLINE char * util_strstr(const char *haystack, const char *needle) { const char *p = haystack; - int len = strlen(needle); + size_t len = strlen(needle); for (; (p = util_strchr(p, *needle)) != 0; p++) { if (util_strncmp(p, needle, len) == 0) { -- cgit v1.2.3 From 601a6a5839220605e353ea8cb82759b39542f9e5 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 21:00:59 +0000 Subject: wgl: Use SetWindowLongPtr. --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 17c96c411f7..024c9ad36af 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -167,10 +167,10 @@ framebuffer_create( */ fb->hWnd = WindowFromDC( hdc ); if (fb->hWnd != NULL) { - fb->WndProc = (WNDPROC) SetWindowLong( + fb->WndProc = (WNDPROC) SetWindowLongPtr( fb->hWnd, - GWL_WNDPROC, - (LONG) window_proc ); + GWLP_WNDPROC, + (LONG_PTR) window_proc ); } fb->next = fb_head; @@ -188,10 +188,10 @@ framebuffer_destroy( while (pfb != NULL) { if (pfb == fb) { if (fb->hWnd != NULL) { - SetWindowLong( + SetWindowLongPtr( fb->hWnd, - GWL_WNDPROC, - (LONG) fb->WndProc ); + GWLP_WNDPROC, + (LONG_PTR) fb->WndProc ); } *link = fb->next; -- cgit v1.2.3 From ce518f4b0f361189957f20ce642afe919da680ba Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 21:01:23 +0000 Subject: wgl: Use right integer type. --- src/gallium/state_trackers/wgl/shared/stw_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index 3c1eb1ad393..c5501727d4e 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -130,7 +130,7 @@ st_cleanup_thread(void) void st_cleanup(void) { - UINT_PTR i; + unsigned i; debug_printf("%s\n", __FUNCTION__); -- cgit v1.2.3 From 5381331f97e55db12cce30859a0156c69894f1d2 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Mar 2009 21:18:54 +0000 Subject: python: s/num_cbufs/nr_cbufs/ --- src/gallium/state_trackers/python/retrace/interpreter.py | 2 +- src/gallium/state_trackers/python/samples/tri.py | 2 +- src/gallium/state_trackers/python/tests/texture.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index e6999a2211e..3050904ece3 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -396,7 +396,7 @@ class Context(Object): _state = gallium.Framebuffer() _state.width = state.width _state.height = state.height - _state.num_cbufs = state.num_cbufs + _state.nr_cbufs = state.nr_cbufs for i in range(len(state.cbufs)): _state.set_cbuf(i, state.cbufs[i]) _state.set_zsbuf(state.zsbuf) diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index d3ccb6c2f46..ae065c5b9ae 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -139,7 +139,7 @@ def test(dev): fb = Framebuffer() fb.width = width fb.height = height - fb.num_cbufs = 1 + fb.nr_cbufs = 1 fb.set_cbuf(0, _cbuf) ctx.set_framebuffer(fb) _cbuf.clear_value = 0x00000000 diff --git a/src/gallium/state_trackers/python/tests/texture.py b/src/gallium/state_trackers/python/tests/texture.py index 880a61306c9..8cec57e2a60 100644 --- a/src/gallium/state_trackers/python/tests/texture.py +++ b/src/gallium/state_trackers/python/tests/texture.py @@ -234,7 +234,7 @@ class TextureTest(TestCase): fb = Framebuffer() fb.width = width fb.height = height - fb.num_cbufs = 1 + fb.nr_cbufs = 1 fb.set_cbuf(0, cbuf) ctx.set_framebuffer(fb) ctx.surface_clear(cbuf, 0x00000000) -- cgit v1.2.3 From ad5f9752ce7dc7b588a98e0c1ac820a3f918b4d5 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Mar 2009 21:21:37 +0000 Subject: python: s/pitch/stride/ --- src/gallium/state_trackers/python/p_context.i | 4 ++-- src/gallium/state_trackers/python/retrace/interpreter.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 1fdbdf98b26..178ab0e24ef 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -151,7 +151,7 @@ struct st_context { } void set_vertex_buffer(unsigned index, - unsigned pitch, + unsigned stride, unsigned max_index, unsigned buffer_offset, struct st_buffer *buffer) @@ -160,7 +160,7 @@ struct st_context { struct pipe_vertex_buffer state; memset(&state, 0, sizeof(state)); - state.stride = pitch; + state.stride = stride; state.max_index = max_index; state.buffer_offset = buffer_offset; state.buffer = buffer ? buffer->buffer : NULL; diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 3050904ece3..6b9587bf2bf 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -424,7 +424,7 @@ class Context(Object): vbuf = vbufs[i] self.real.set_vertex_buffer( i, - pitch = vbuf.pitch, + stride = vbuf.stride, max_index = vbuf.max_index, buffer_offset = vbuf.buffer_offset, buffer = vbuf.buffer, @@ -452,7 +452,7 @@ class Context(Object): for velem in self.velems: vbuf = self.vbufs[velem.vertex_buffer_index] - offset = vbuf.buffer_offset + velem.src_offset + vbuf.pitch*index + offset = vbuf.buffer_offset + velem.src_offset + vbuf.stride*index format = { gallium.PIPE_FORMAT_R32_FLOAT: 'f', gallium.PIPE_FORMAT_R32G32_FLOAT: '2f', -- cgit v1.2.3 From 8ca95d812148209f78c1e2501c3183623dcae0b2 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Mar 2009 21:24:31 +0000 Subject: python: Tweak instructions. --- src/gallium/state_trackers/python/README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/python/README b/src/gallium/state_trackers/python/README index 8f45fb6d1b7..942f3c06c49 100644 --- a/src/gallium/state_trackers/python/README +++ b/src/gallium/state_trackers/python/README @@ -11,11 +11,11 @@ To build you'll need: Invoke scons on the top dir as - scons statetrackers=python + scons debug=yes statetrackers=python driver=softpipe,trace To use do - export PYTHONPATH=build/XXXX-XXXX-XXXX/gallium/state_trackers/python + export PYTHONPATH=$PWD/build/XXXX-XXXX-XXXX/gallium/state_trackers/python and then try running -- cgit v1.2.3 From a6ad0c86cab0f3044781ece33d3ac0388e238a36 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Mar 2009 21:35:10 +0000 Subject: python: Allow to dump all images to disk. --- src/gallium/state_trackers/python/retrace/interpreter.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 6b9587bf2bf..66d73ed903f 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -75,7 +75,13 @@ def show_image(surface): root.mainloop() +# Verbosity level: 0, 1, 2 verbose = 1 +# Dump images to disk instead of showing: True, False +images = False + + +image_no = 0 class Struct: @@ -538,7 +544,13 @@ class Context(Object): self.real.flush() if self.cbufs and self.cbufs[0]: - show_image(self.cbufs[0]) + if images: + global image_no + image_no += 1 + filename = 'cbuf_%04u.png' % image_no + save_image(filename, self.cbufs[0]) + else: + show_image(self.cbufs[0]) class Interpreter(parser.TraceDumper): -- cgit v1.2.3 From b52b78a2269e6f773fc02c9740e7f2e18cdf1699 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Mar 2009 21:39:16 +0000 Subject: python: List packages needed on debian systems. --- src/gallium/state_trackers/python/README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/state_trackers/python/README b/src/gallium/state_trackers/python/README index 942f3c06c49..4281d9bdb0d 100644 --- a/src/gallium/state_trackers/python/README +++ b/src/gallium/state_trackers/python/README @@ -9,6 +9,10 @@ To build you'll need: * SWIG * Python Imaging Library with TK support (for the samples) +On a debian-based distro you can simply do: + + aptitude install python-dev scons swig python-imaging python-imaging-tk + Invoke scons on the top dir as scons debug=yes statetrackers=python driver=softpipe,trace -- cgit v1.2.3 From 5743483778ffe5b389d10b1651ae1e8951b397ee Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 10:22:05 +0000 Subject: python: Use Ansi escape codes regardless of output is a tty or not. --- src/gallium/state_trackers/python/retrace/format.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/retrace/format.py b/src/gallium/state_trackers/python/retrace/format.py index 0bf6baf0b94..d56d72f606f 100755 --- a/src/gallium/state_trackers/python/retrace/format.py +++ b/src/gallium/state_trackers/python/retrace/format.py @@ -27,6 +27,9 @@ ########################################################################## +import sys + + class Formatter: '''Plain formatter''' @@ -93,7 +96,7 @@ class AnsiFormatter(Formatter): def DefaultFormatter(stream): - if stream.isatty(): + if sys.platform in ('linux2', 'cygwin'): return AnsiFormatter(stream) else: return Formatter(stream) -- cgit v1.2.3 From 9d97c3d0be9e57226b6a438a90b71f36e0c99269 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 13:31:27 +0000 Subject: python/trace: Control the interpreter from command line options. --- .../state_trackers/python/retrace/interpreter.py | 80 +++++++++++++--------- .../state_trackers/python/retrace/parser.py | 40 ++++++++--- 2 files changed, 80 insertions(+), 40 deletions(-) diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 66d73ed903f..23038c5c1c0 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -75,15 +75,6 @@ def show_image(surface): root.mainloop() -# Verbosity level: 0, 1, 2 -verbose = 1 -# Dump images to disk instead of showing: True, False -images = False - - -image_no = 0 - - class Struct: """C-like struct""" @@ -381,7 +372,7 @@ class Context(Object): self.real.set_clip(_state) def dump_constant_buffer(self, buffer): - if verbose < 2: + if not self.interpreter.verbosity(2): return data = buffer.read() @@ -447,7 +438,7 @@ class Context(Object): pass def dump_vertices(self, start, count): - if verbose < 2: + if not self.interpreter.verbosity(2): return for index in range(start, start + count): @@ -474,7 +465,7 @@ class Context(Object): sys.stdout.write('\t},\n') def dump_indices(self, ibuf, isize, start, count): - if verbose < 2: + if not self.interpreter.verbosity(2): return format = { @@ -506,51 +497,48 @@ class Context(Object): self.dump_vertices(start, count) self.real.draw_arrays(mode, start, count) - - self.dirty = True + self._set_dirty() def draw_elements(self, indexBuffer, indexSize, mode, start, count): - if verbose >= 2: + if self.interpreter.verbosity(2): minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count) self.dump_vertices(minindex, maxindex - minindex) self.real.draw_elements(indexBuffer, indexSize, mode, start, count) - - self.dirty = True + self._set_dirty() def draw_range_elements(self, indexBuffer, indexSize, minIndex, maxIndex, mode, start, count): - if verbose >= 2: + if self.interpreter.verbosity(2): minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count) minindex = min(minindex, minIndex) maxindex = min(maxindex, maxIndex) self.dump_vertices(minindex, maxindex - minindex) self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count) - - self.dirty = True + self._set_dirty() + def _set_dirty(self): + if self.interpreter.options.step: + self._present() + else: + self.dirty = True + def flush(self, flags): self.real.flush(flags) if self.dirty: if flags & gallium.PIPE_FLUSH_FRAME: - self._update() + self._present() self.dirty = False return None def clear(self, surface, value): self.real.surface_clear(surface, value) - def _update(self): + def _present(self): self.real.flush() if self.cbufs and self.cbufs[0]: - if images: - global image_no - image_no += 1 - filename = 'cbuf_%04u.png' % image_no - save_image(filename, self.cbufs[0]) - else: - show_image(self.cbufs[0]) + self.interpreter.present(self.cbufs[0], "cbuf") class Interpreter(parser.TraceDumper): @@ -561,11 +549,13 @@ class Interpreter(parser.TraceDumper): ('pipe_screen', 'get_paramf'), )) - def __init__(self, stream): + def __init__(self, stream, options): parser.TraceDumper.__init__(self, stream) + self.options = options self.objects = {} self.result = None self.globl = Global(self, None) + self.image_no = 0 def register_object(self, address, object): self.objects[address] = object @@ -586,7 +576,7 @@ class Interpreter(parser.TraceDumper): if (call.klass, call.method) in self.ignore_calls: return - if verbose >= 1: + if self.verbosity(1): parser.TraceDumper.handle_call(self, call) args = [self.interpret_arg(arg) for name, arg in call.args] @@ -606,7 +596,33 @@ class Interpreter(parser.TraceDumper): def interpret_arg(self, node): translator = Translator(self) return translator.visit(node) + + def verbosity(self, level): + return self.options.verbosity >= level + + def present(self, surface, description): + if self.options.images: + self.image_no += 1 + filename = '%s_%04u.png' % (description, self.image_no) + save_image(filename, surface) + else: + show_image(surface) +class Main(parser.Main): + + def get_optparser(self): + optparser = parser.Main.get_optparser(self) + optparser.add_option("-q", "--quiet", action="store_const", const=0, dest="verbosity", help="no messages") + optparser.add_option("-v", "--verbose", action="count", dest="verbosity", default=1, help="increase verbosity level") + optparser.add_option("-i", "--images", action="store_true", dest="images", default=False, help="save images instead of showing them") + optparser.add_option("-s", "--step", action="store_true", dest="step", default=False, help="step trhough every draw") + return optparser + + def process_arg(self, stream, options): + parser = Interpreter(stream, options) + parser.parse() + + if __name__ == '__main__': - parser.main(Interpreter) + Main().main() diff --git a/src/gallium/state_trackers/python/retrace/parser.py b/src/gallium/state_trackers/python/retrace/parser.py index 5205f2d8dd5..db9bcc8226c 100755 --- a/src/gallium/state_trackers/python/retrace/parser.py +++ b/src/gallium/state_trackers/python/retrace/parser.py @@ -30,6 +30,7 @@ import sys import xml.parsers.expat import binascii +import optparse from model import * @@ -342,16 +343,39 @@ class TraceDumper(TraceParser): self.formatter.newline() -def main(ParserFactory): - for arg in sys.argv[1:]: - if arg.endswith('.gz'): - import gzip - stream = gzip.GzipFile(arg, 'rt') +class Main: + '''Common main class for all retrace command line utilities.''' + + def __init__(self): + pass + + def main(self): + optparser = self.get_optparser() + (options, args) = optparser.parse_args(sys.argv[1:]) + + if args: + for arg in args: + if arg.endswith('.gz'): + from gzip import GzipFile + stream = GzipFile(arg, 'rt') + elif arg.endswith('.bz2'): + from bz2 import BZ2File + stream = BZ2File(arg, 'rt') + else: + stream = open(arg, 'rt') + self.process_arg(stream, options) else: - stream = open(arg, 'rt') - parser = ParserFactory(stream) + self.process_arg(stream, options) + + def get_optparser(self): + optparser = optparse.OptionParser( + usage="\n\t%prog [options] [traces] ...") + return optparser + + def process_arg(self, stream, options): + parser = TraceDumper(stream) parser.parse() if __name__ == '__main__': - main(TraceDumper) + Main().main() -- cgit v1.2.3 From ecfa99ece1743769bbdb4371cf57229481993e91 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 13:44:32 +0000 Subject: python: Use a sequential number to identify each call. TODO: Modify the trace driver to generate these on the XML file itself. --- src/gallium/state_trackers/python/retrace/model.py | 4 +++- src/gallium/state_trackers/python/retrace/parser.py | 13 ++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/python/retrace/model.py b/src/gallium/state_trackers/python/retrace/model.py index ae0f4327d76..d4a079fb1e5 100755 --- a/src/gallium/state_trackers/python/retrace/model.py +++ b/src/gallium/state_trackers/python/retrace/model.py @@ -101,7 +101,8 @@ class Pointer(Node): class Call: - def __init__(self, klass, method, args, ret): + def __init__(self, no, klass, method, args, ret): + self.no = no self.klass = klass self.method = method self.args = args @@ -187,6 +188,7 @@ class PrettyPrinter: self.formatter.address(node.address) def visit_call(self, node): + self.formatter.text('%s ' % node.no) if node.klass is not None: self.formatter.function(node.klass + '::' + node.method) else: diff --git a/src/gallium/state_trackers/python/retrace/parser.py b/src/gallium/state_trackers/python/retrace/parser.py index db9bcc8226c..b0f3e8a432f 100755 --- a/src/gallium/state_trackers/python/retrace/parser.py +++ b/src/gallium/state_trackers/python/retrace/parser.py @@ -190,6 +190,10 @@ class XmlParser: class TraceParser(XmlParser): + def __init__(self, fp): + XmlParser.__init__(self, fp) + self.last_call_no = 0 + def parse(self): self.element_start('trace') while self.token.type not in (ELEMENT_END, EOF): @@ -200,6 +204,13 @@ class TraceParser(XmlParser): def parse_call(self): attrs = self.element_start('call') + try: + no = int(attrs['no']) + except KeyError: + self.last_call_no += 1 + no = self.last_call_no + else: + self.last_call_no = no klass = attrs['class'] method = attrs['method'] args = [] @@ -217,7 +228,7 @@ class TraceParser(XmlParser): raise TokenMismatch(" or ", self.token) self.element_end('call') - return Call(klass, method, args, ret) + return Call(no, klass, method, args, ret) def parse_arg(self): attrs = self.element_start('arg') -- cgit v1.2.3 From 710bcc8050848766a85420d0425e51008943fc78 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 14:02:49 +0000 Subject: python/retrace: Use the call no when dumping images. To make it easy associate images with the calls. --- src/gallium/state_trackers/python/retrace/interpreter.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 23038c5c1c0..6aaea2d65da 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -555,7 +555,7 @@ class Interpreter(parser.TraceDumper): self.objects = {} self.result = None self.globl = Global(self, None) - self.image_no = 0 + self.call_no = None def register_object(self, address, object): self.objects[address] = object @@ -576,6 +576,8 @@ class Interpreter(parser.TraceDumper): if (call.klass, call.method) in self.ignore_calls: return + self.call_no = call.no + if self.verbosity(1): parser.TraceDumper.handle_call(self, call) @@ -593,6 +595,8 @@ class Interpreter(parser.TraceDumper): if call.ret and isinstance(call.ret, model.Pointer): self.register_object(call.ret.address, ret) + self.call_no = None + def interpret_arg(self, node): translator = Translator(self) return translator.visit(node) @@ -602,8 +606,7 @@ class Interpreter(parser.TraceDumper): def present(self, surface, description): if self.options.images: - self.image_no += 1 - filename = '%s_%04u.png' % (description, self.image_no) + filename = '%s_%04u.png' % (description, self.call_no) save_image(filename, surface) else: show_image(surface) -- cgit v1.2.3 From 58351b5023c2d87c22e21a27fd238212040dab8b Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 15:11:30 +0000 Subject: trace: Number calls. --- src/gallium/drivers/trace/tr_dump.c | 10 +++++++++- src/gallium/drivers/trace/trace.xsl | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index 5fb020538ee..97872be784d 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -265,8 +265,16 @@ void trace_dump_trace_end(void) void trace_dump_call_begin(const char *klass, const char *method) { + static long unsigned no = 0; + ++no; trace_dump_indent(1); - trace_dump_tag_begin2("call", "class", klass, "method", method); + trace_dump_writes(""); trace_dump_newline(); } diff --git a/src/gallium/drivers/trace/trace.xsl b/src/gallium/drivers/trace/trace.xsl index 9cd621e7ab9..7be95e0e753 100644 --- a/src/gallium/drivers/trace/trace.xsl +++ b/src/gallium/drivers/trace/trace.xsl @@ -68,6 +68,9 @@ along with this program. If not, see .
  • + + + :: -- cgit v1.2.3 From c847b4515314e11bee6463da908c665424cafa30 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 15:13:06 +0000 Subject: trace: Update readme. Actually, the trace driver with the xlib statetracker is still causing assertion failures here.. --- src/gallium/drivers/trace/README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/trace/README b/src/gallium/drivers/trace/README index f0e1cd596d3..73dce20372e 100644 --- a/src/gallium/drivers/trace/README +++ b/src/gallium/drivers/trace/README @@ -10,15 +10,14 @@ This directory contains a Gallium3D pipe driver which traces all incoming calls. To build, invoke scons on the top dir as - scons statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib + scons dri=no statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib = Usage = To use do - ln -s libGL.so build/linux-x86-debug/gallium/winsys/xlib/libGL.so.1 - export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/gallium/winsys/xlib + export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib ensure the right libGL.so is being picked by doing @@ -26,6 +25,7 @@ ensure the right libGL.so is being picked by doing and then try running + export XMESA_TRACE=y GALLIUM_TRACE=tri.trace progs/trivial/tri which should create a tri.trace file, which is an XML file. You can view copying -- cgit v1.2.3 From de89c022d5a2e63b52a9ae27ec70b9f5e203d3ed Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 15:36:51 +0000 Subject: python: Show call no in image window. --- src/gallium/state_trackers/python/retrace/interpreter.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 6aaea2d65da..a22314d2000 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -54,14 +54,14 @@ def save_image(filename, surface): outimage = make_image(surface) outimage.save(filename, "PNG") -def show_image(surface): +def show_image(surface, title): outimage = make_image(surface) import Tkinter as tk from PIL import Image, ImageTk root = tk.Tk() - root.title('background image') + root.title(title) image1 = ImageTk.PhotoImage(outimage) w = image1.width() @@ -609,7 +609,8 @@ class Interpreter(parser.TraceDumper): filename = '%s_%04u.png' % (description, self.call_no) save_image(filename, surface) else: - show_image(surface) + title = '%u. %s' % (self.call_no, description) + show_image(surface, title) class Main(parser.Main): -- cgit v1.2.3 From 78abcb88fedd7177a5da93a987793d3a86a0ec57 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 25 Mar 2009 20:51:33 +0000 Subject: st/egl: Fix warning --- src/gallium/state_trackers/egl/egl_tracker.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index a22ef381b96..9667c7ee3d4 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -66,10 +66,13 @@ drm_get_device_id(struct drm_device *device) { char path[512]; FILE *file; + char *ret; /* TODO get the real minor */ int minor = 0; + device->deviceID = 0; + snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", minor); file = fopen(path, "r"); if (!file) { @@ -77,7 +80,10 @@ drm_get_device_id(struct drm_device *device) return; } - fgets(path, sizeof( path ), file); + ret = fgets(path, sizeof( path ), file); + if (!ret) + return; + sscanf(path, "%x", &device->deviceID); fclose(file); } -- cgit v1.2.3 From e21d31e8ab047966a3d6c6ee489e5cfe93819781 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 25 Mar 2009 20:51:47 +0000 Subject: st/egl: Set dpms to on when showing screens There is a wonderful bug in 2.6.29 that causes a hard lock on my computer when this code is active for lvds that are turned off. --- src/gallium/state_trackers/egl/egl_surface.c | 7 +++++++ src/gallium/state_trackers/egl/egl_tracker.c | 21 +++++++++++++++++++++ src/gallium/state_trackers/egl/egl_tracker.h | 3 +++ 3 files changed, 31 insertions(+) diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index e6e80b985aa..ca545b12e68 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -330,6 +330,13 @@ drm_show_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy, if (ret) goto err_crtc; + + if (scrn->dpms) + drmModeConnectorSetProperty(dev->drmFD, + scrn->connectorID, + scrn->dpms->prop_id, + DRM_MODE_DPMS_ON); + surf->screen = scrn; scrn->surf = surf; diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index 9667c7ee3d4..abdf84544f3 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -107,6 +107,25 @@ drm_add_modes_from_connector(_EGLScreen *screen, drmModeConnectorPtr connector) } } +static void +drm_find_dpms(struct drm_device *dev, struct drm_screen *screen) +{ + drmModeConnectorPtr c = screen->connector; + drmModePropertyPtr p; + int i; + + for (i = 0; i < c->count_props; i++) { + p = drmModeGetProperty(dev->drmFD, c->props[i]); + if (!strcmp(p->name, "DPMS")) + break; + + drmModeFreeProperty(p); + p = NULL; + } + + screen->dpms = p; +} + EGLBoolean drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor) { @@ -160,6 +179,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor) _eglInitScreen(&screen->base); _eglAddScreen(disp, &screen->base); drm_add_modes_from_connector(&screen->base, connector); + drm_find_dpms(dev, screen); dev->screens[num_screens++] = screen; } dev->count_screens = num_screens; @@ -206,6 +226,7 @@ drm_terminate(_EGLDriver *drv, EGLDisplay dpy) if (screen->shown) drm_takedown_shown_screen(drv, screen); + drmModeFreeProperty(screen->dpms); drmModeFreeConnector(screen->connector); _eglDestroyScreen(&screen->base); dev->screens[i] = NULL; diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h index 908bab5f9bf..ce2717de639 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.h +++ b/src/gallium/state_trackers/egl/egl_tracker.h @@ -114,6 +114,9 @@ struct drm_screen drmModeConnectorPtr connector; uint32_t connectorID; + /* dpms property */ + drmModePropertyPtr dpms; + /* Has this screen been shown */ int shown; -- cgit v1.2.3 From 573346da2a1de9a32b2673a5d4634aa6338da374 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 21:44:54 +0000 Subject: translate: Avoid unused variable warning. --- src/gallium/auxiliary/translate/translate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/auxiliary/translate/translate.c b/src/gallium/auxiliary/translate/translate.c index 7678903f75c..a9b7253bf44 100644 --- a/src/gallium/auxiliary/translate/translate.c +++ b/src/gallium/auxiliary/translate/translate.c @@ -42,6 +42,8 @@ struct translate *translate_create( const struct translate_key *key ) translate = translate_sse2_create( key ); if (translate) return translate; +#else + (void)translate; #endif return translate_generic_create( key ); -- cgit v1.2.3 From e866cd7401e70f1e6494c8adf3983e916c7fa9cf Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 21:45:10 +0000 Subject: softpipe: Include declarations. --- src/gallium/drivers/softpipe/sp_surface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/softpipe/sp_surface.c b/src/gallium/drivers/softpipe/sp_surface.c index ef04843f172..b04c2a63ad6 100644 --- a/src/gallium/drivers/softpipe/sp_surface.c +++ b/src/gallium/drivers/softpipe/sp_surface.c @@ -27,6 +27,7 @@ #include "util/u_rect.h" #include "sp_context.h" +#include "sp_surface.h" static void -- cgit v1.2.3 From 57ea34214c114539a92eafafebf7e7fcfa9fc286 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 21:45:57 +0000 Subject: trace: Defer the cast to after the check for enabled trace. Prevents segfault when trace is disabled. --- src/gallium/drivers/trace/tr_context.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index c8949729047..b69ed2cb526 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1037,9 +1037,9 @@ struct pipe_context * trace_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) { - struct trace_screen *tr_scr = trace_screen(_screen); + struct trace_screen *tr_scr; struct trace_context *tr_ctx; - struct pipe_screen *screen = tr_scr->screen; + struct pipe_screen *screen; if(!pipe) goto error1; @@ -1047,6 +1047,9 @@ trace_context_create(struct pipe_screen *_screen, if(!trace_dump_enabled()) goto error1; + tr_scr = trace_screen(_screen); + screen = tr_scr->screen; + tr_ctx = CALLOC_STRUCT(trace_context); if(!tr_ctx) goto error1; -- cgit v1.2.3 From 8866ff4cacea1005cc137d4fa88386824316a336 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 21:46:26 +0000 Subject: python: Catchup buffer_destroy interface change. --- src/gallium/state_trackers/python/st_softpipe_winsys.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index 426f347d189..41cdeaa6fdc 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -84,8 +84,7 @@ st_softpipe_buffer_unmap(struct pipe_winsys *winsys, static void -st_softpipe_buffer_destroy(struct pipe_winsys *winsys, - struct pipe_buffer *buf) +st_softpipe_buffer_destroy(struct pipe_buffer *buf) { struct st_softpipe_buffer *oldBuf = st_softpipe_buffer(buf); -- cgit v1.2.3 From 6ce06f3fbcc04b6cde52d625368266b1e69e061e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 25 Mar 2009 21:47:04 +0000 Subject: python: Pass transfers to the tile functions. --- src/gallium/state_trackers/python/p_texture.i | 172 +++++++++++++++++++++----- 1 file changed, 140 insertions(+), 32 deletions(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 1e64fc8e41f..e53369cc56c 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -95,37 +95,92 @@ pipe_surface_reference(&ptr, NULL); } - // gets mapped to pipe_surface_map automatically - void * map( unsigned flags ); - - // gets mapped to pipe_surface_unmap automatically - void unmap( void ); - void - get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char *raw, unsigned stride) { - pipe_get_tile_raw($self, x, y, w, h, raw, stride); + get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char *raw, unsigned stride) + { + struct pipe_screen *screen = $self->texture->screen; + struct pipe_transfer *transfer; + transfer = screen->get_tex_transfer(screen, + $self->texture, + $self->face, + $self->level, + $self->zslice, + PIPE_TRANSFER_READ, + 0, 0, + $self->width, + $self->height); + if(transfer) { + pipe_get_tile_raw(transfer, x, y, w, h, raw, stride); + screen->tex_transfer_destroy(transfer); + } } void - put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *raw, unsigned stride) { - pipe_put_tile_raw($self, x, y, w, h, raw, stride); + put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *raw, unsigned stride) + { + struct pipe_screen *screen = $self->texture->screen; + struct pipe_transfer *transfer; + transfer = screen->get_tex_transfer(screen, + $self->texture, + $self->face, + $self->level, + $self->zslice, + PIPE_TRANSFER_WRITE, + 0, 0, + $self->width, + $self->height); + if(transfer) { + pipe_put_tile_raw(transfer, x, y, w, h, raw, stride); + screen->tex_transfer_destroy(transfer); + } } void - get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba) { - pipe_get_tile_rgba($self, x, y, w, h, rgba); + get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba) + { + struct pipe_screen *screen = $self->texture->screen; + struct pipe_transfer *transfer; + transfer = screen->get_tex_transfer(screen, + $self->texture, + $self->face, + $self->level, + $self->zslice, + PIPE_TRANSFER_READ, + 0, 0, + $self->width, + $self->height); + if(transfer) { + pipe_get_tile_rgba(transfer, x, y, w, h, rgba); + screen->tex_transfer_destroy(transfer); + } } void - put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba) { - pipe_put_tile_rgba($self, x, y, w, h, rgba); + put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba) + { + struct pipe_screen *screen = $self->texture->screen; + struct pipe_transfer *transfer; + transfer = screen->get_tex_transfer(screen, + $self->texture, + $self->face, + $self->level, + $self->zslice, + PIPE_TRANSFER_WRITE, + 0, 0, + $self->width, + $self->height); + if(transfer) { + pipe_put_tile_rgba(transfer, x, y, w, h, rgba); + screen->tex_transfer_destroy(transfer); + } } %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1)); void get_tile_rgba8(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH) { - unsigned surface_usage; + struct pipe_screen *screen = $self->texture->screen; + struct pipe_transfer *transfer; float *rgba; unsigned char *rgba8; unsigned i, j, k; @@ -147,32 +202,68 @@ rgba8 = (unsigned char *) *STRING; - /* XXX: force mappable surface */ - surface_usage = $self->usage; - $self->usage |= PIPE_BUFFER_USAGE_CPU_READ; - for(j = 0; j < h; ++j) { - pipe_get_tile_rgba($self, - x, y + j, w, 1, - rgba); - for(i = 0; i < w; ++i) - for(k = 0; k <4; ++k) - rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[i*4 + k]); + transfer = screen->get_tex_transfer(screen, + $self->texture, + $self->face, + $self->level, + $self->zslice, + PIPE_TRANSFER_READ, + 0, 0, + $self->width, + $self->height); + if(transfer) { + pipe_get_tile_rgba(transfer, + x, y + j, w, 1, + rgba); + for(i = 0; i < w; ++i) + for(k = 0; k <4; ++k) + rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[i*4 + k]); + screen->tex_transfer_destroy(transfer); + } } - $self->usage = surface_usage; - free(rgba); } void - get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z) { - pipe_get_tile_z($self, x, y, w, h, z); + get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z) + { + struct pipe_screen *screen = $self->texture->screen; + struct pipe_transfer *transfer; + transfer = screen->get_tex_transfer(screen, + $self->texture, + $self->face, + $self->level, + $self->zslice, + PIPE_TRANSFER_READ, + 0, 0, + $self->width, + $self->height); + if(transfer) { + pipe_get_tile_z(transfer, x, y, w, h, z); + screen->tex_transfer_destroy(transfer); + } } void - put_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z) { - pipe_put_tile_z($self, x, y, w, h, z); + put_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z) + { + struct pipe_screen *screen = $self->texture->screen; + struct pipe_transfer *transfer; + transfer = screen->get_tex_transfer(screen, + $self->texture, + $self->face, + $self->level, + $self->zslice, + PIPE_TRANSFER_WRITE, + 0, 0, + $self->width, + $self->height); + if(transfer) { + pipe_put_tile_z(transfer, x, y, w, h, z); + screen->tex_transfer_destroy(transfer); + } } void @@ -183,6 +274,8 @@ unsigned compare_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba, float tol = 0.0) { + struct pipe_screen *screen = $self->texture->screen; + struct pipe_transfer *transfer; float *rgba2; const float *p1; const float *p2; @@ -192,7 +285,22 @@ if(!rgba2) return ~0; - pipe_get_tile_rgba($self, x, y, w, h, rgba2); + transfer = screen->get_tex_transfer(screen, + $self->texture, + $self->face, + $self->level, + $self->zslice, + PIPE_TRANSFER_WRITE, + 0, 0, + $self->width, + $self->height); + if(!transfer) { + FREE(rgba2); + return ~0; + } + + pipe_get_tile_rgba(transfer, x, y, w, h, rgba2); + screen->tex_transfer_destroy(transfer); p1 = rgba; p2 = rgba2; -- cgit v1.2.3 From d332f8b4efae39f09454593374ff939a08af7619 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 26 Mar 2009 10:53:47 +0100 Subject: gallium: Remove some little-used fields from struct pipe_surface. --- src/gallium/drivers/cell/ppu/cell_clear.c | 13 ------------- src/gallium/drivers/i915simple/i915_clear.c | 1 - src/gallium/drivers/i915simple/i915_texture.c | 9 --------- src/gallium/drivers/i965simple/brw_tex_layout.c | 1 - src/gallium/drivers/nv04/nv04_miptree.c | 1 - src/gallium/drivers/nv10/nv10_miptree.c | 1 - src/gallium/drivers/nv20/nv20_clear.c | 1 - src/gallium/drivers/nv20/nv20_miptree.c | 1 - src/gallium/drivers/nv30/nv30_clear.c | 1 - src/gallium/drivers/nv30/nv30_miptree.c | 1 - src/gallium/drivers/nv30/nv30_state_emit.c | 8 -------- src/gallium/drivers/nv40/nv40_clear.c | 1 - src/gallium/drivers/nv40/nv40_miptree.c | 1 - src/gallium/drivers/nv40/nv40_state_emit.c | 8 -------- src/gallium/drivers/nv50/nv50_clear.c | 2 -- src/gallium/drivers/nv50/nv50_miptree.c | 1 - src/gallium/drivers/nv50/nv50_state_validate.c | 7 ------- src/gallium/drivers/r300/r300_clear.c | 3 +-- src/gallium/drivers/r300/r300_texture.c | 1 - src/gallium/drivers/softpipe/sp_clear.c | 2 -- src/gallium/drivers/softpipe/sp_setup.c | 10 ---------- src/gallium/drivers/trace/tr_state.c | 2 -- src/gallium/include/pipe/p_defines.h | 8 -------- src/gallium/include/pipe/p_state.h | 2 -- src/gallium/state_trackers/egl/egl_surface.c | 2 -- src/mesa/state_tracker/st_cb_clear.c | 17 ---------------- src/mesa/state_tracker/st_framebuffer.c | 26 ------------------------- src/mesa/state_tracker/st_public.h | 1 - 28 files changed, 1 insertion(+), 131 deletions(-) diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c index edc06747ac1..34be5f3dc7d 100644 --- a/src/gallium/drivers/cell/ppu/cell_clear.c +++ b/src/gallium/drivers/cell/ppu/cell_clear.c @@ -101,17 +101,4 @@ cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps, clr->surface = surfIndex; clr->value = clearValue; } - - /* Technically, the surface's contents are now known and cleared, - * so we could set the status to PIPE_SURFACE_STATUS_CLEAR. But - * it turns out it's quite painful to recognize when any particular - * surface goes from PIPE_SURFACE_STATUS_CLEAR to - * PIPE_SURFACE_STATUS_DEFINED (i.e. with known contents), because - * the drawing commands could be operating on numerous draw buffers, - * which we'd have to iterate through to set all their stati... - * For now, we cheat a bit and set the surface's status to DEFINED - * right here. Later we should revisit this and set the status to - * CLEAR here, and find a better place to set the status to DEFINED. - */ - ps->status = PIPE_SURFACE_STATUS_DEFINED; } diff --git a/src/gallium/drivers/i915simple/i915_clear.c b/src/gallium/drivers/i915simple/i915_clear.c index 8a2d3ca43f1..cde69daacc0 100644 --- a/src/gallium/drivers/i915simple/i915_clear.c +++ b/src/gallium/drivers/i915simple/i915_clear.c @@ -44,5 +44,4 @@ i915_clear(struct pipe_context *pipe, struct pipe_surface *ps, unsigned clearValue) { pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); - ps->status = PIPE_SURFACE_STATUS_DEFINED; } diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c index 39aca9f8173..ca8e87af8d1 100644 --- a/src/gallium/drivers/i915simple/i915_texture.c +++ b/src/gallium/drivers/i915simple/i915_texture.c @@ -677,7 +677,6 @@ i915_get_tex_surface(struct pipe_screen *screen, ps->height = pt->height[level]; ps->offset = offset; ps->usage = flags; - ps->status = PIPE_SURFACE_STATUS_DEFINED; } return ps; } @@ -725,14 +724,6 @@ i915_init_texture_functions(struct i915_context *i915) static void i915_tex_surface_destroy(struct pipe_surface *surf) { - /* This really should not be possible, but it's actually - * happening quite a bit... Will fix. - */ - if (surf->status == PIPE_SURFACE_STATUS_CLEAR) { - debug_printf("XXX destroying a surface with pending clears...\n"); - assert(0); - } - pipe_texture_reference(&surf->texture, NULL); FREE(surf); } diff --git a/src/gallium/drivers/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c index c921c0d38be..f44bd17451b 100644 --- a/src/gallium/drivers/i965simple/brw_tex_layout.c +++ b/src/gallium/drivers/i965simple/brw_tex_layout.c @@ -363,7 +363,6 @@ brw_get_tex_surface_screen(struct pipe_screen *screen, ps->nblocksy = pt->nblocksy[level]; ps->stride = tex->stride; ps->offset = offset; - ps->status = PIPE_SURFACE_STATUS_DEFINED; } return ps; } diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c index 85dc017fbc4..4da833c25e8 100644 --- a/src/gallium/drivers/nv04/nv04_miptree.c +++ b/src/gallium/drivers/nv04/nv04_miptree.c @@ -122,7 +122,6 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, ns->base.width = pt->width[level]; ns->base.height = pt->height[level]; ns->base.usage = flags; - ns->base.status = PIPE_SURFACE_STATUS_DEFINED; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; ns->base.level = level; diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c index bb3a1c0f19e..34e3c2ebd77 100644 --- a/src/gallium/drivers/nv10/nv10_miptree.c +++ b/src/gallium/drivers/nv10/nv10_miptree.c @@ -136,7 +136,6 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt, ns->base.width = pt->width[level]; ns->base.height = pt->height[level]; ns->base.usage = flags; - ns->base.status = PIPE_SURFACE_STATUS_DEFINED; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; ns->base.level = level; diff --git a/src/gallium/drivers/nv20/nv20_clear.c b/src/gallium/drivers/nv20/nv20_clear.c index 29f4afd87c9..81b6f3e78ac 100644 --- a/src/gallium/drivers/nv20/nv20_clear.c +++ b/src/gallium/drivers/nv20/nv20_clear.c @@ -9,5 +9,4 @@ nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps, unsigned clearValue) { pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); - ps->status = PIPE_SURFACE_STATUS_CLEAR; } diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c index b2f29aff8d2..185fbf53e0f 100644 --- a/src/gallium/drivers/nv20/nv20_miptree.c +++ b/src/gallium/drivers/nv20/nv20_miptree.c @@ -170,7 +170,6 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt, ns->base.width = pt->width[level]; ns->base.height = pt->height[level]; ns->base.usage = flags; - ns->base.status = PIPE_SURFACE_STATUS_DEFINED; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; ns->base.level = level; diff --git a/src/gallium/drivers/nv30/nv30_clear.c b/src/gallium/drivers/nv30/nv30_clear.c index 8c3ca204d58..71f413588ee 100644 --- a/src/gallium/drivers/nv30/nv30_clear.c +++ b/src/gallium/drivers/nv30/nv30_clear.c @@ -9,5 +9,4 @@ nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps, unsigned clearValue) { pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); - ps->status = PIPE_SURFACE_STATUS_CLEAR; } diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index d6dc621c9ee..7f8054de733 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -177,7 +177,6 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, ns->base.width = pt->width[level]; ns->base.height = pt->height[level]; ns->base.usage = flags; - ns->base.status = PIPE_SURFACE_STATUS_DEFINED; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; ns->base.level = level; diff --git a/src/gallium/drivers/nv30/nv30_state_emit.c b/src/gallium/drivers/nv30/nv30_state_emit.c index f77b08ff695..c18be20a327 100644 --- a/src/gallium/drivers/nv30/nv30_state_emit.c +++ b/src/gallium/drivers/nv30/nv30_state_emit.c @@ -21,14 +21,6 @@ static void nv30_state_do_validate(struct nv30_context *nv30, struct nv30_state_entry **states) { - const struct pipe_framebuffer_state *fb = &nv30->framebuffer; - unsigned i; - - for (i = 0; i < fb->nr_cbufs; i++) - fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED; - if (fb->zsbuf) - fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED; - while (*states) { struct nv30_state_entry *e = *states; diff --git a/src/gallium/drivers/nv40/nv40_clear.c b/src/gallium/drivers/nv40/nv40_clear.c index 59efd620e32..2c4e8f01fda 100644 --- a/src/gallium/drivers/nv40/nv40_clear.c +++ b/src/gallium/drivers/nv40/nv40_clear.c @@ -9,5 +9,4 @@ nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps, unsigned clearValue) { pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); - ps->status = PIPE_SURFACE_STATUS_CLEAR; } diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c index abadca8c933..5a201ccf458 100644 --- a/src/gallium/drivers/nv40/nv40_miptree.c +++ b/src/gallium/drivers/nv40/nv40_miptree.c @@ -176,7 +176,6 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, ns->base.width = pt->width[level]; ns->base.height = pt->height[level]; ns->base.usage = flags; - ns->base.status = PIPE_SURFACE_STATUS_DEFINED; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; ns->base.level = level; diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c index ce859def108..10aae298328 100644 --- a/src/gallium/drivers/nv40/nv40_state_emit.c +++ b/src/gallium/drivers/nv40/nv40_state_emit.c @@ -38,14 +38,6 @@ static void nv40_state_do_validate(struct nv40_context *nv40, struct nv40_state_entry **states) { - const struct pipe_framebuffer_state *fb = &nv40->framebuffer; - unsigned i; - - for (i = 0; i < fb->nr_cbufs; i++) - fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED; - if (fb->zsbuf) - fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED; - while (*states) { struct nv40_state_entry *e = *states; diff --git a/src/gallium/drivers/nv50/nv50_clear.c b/src/gallium/drivers/nv50/nv50_clear.c index f9bc3b53caa..db44a9da0e3 100644 --- a/src/gallium/drivers/nv50/nv50_clear.c +++ b/src/gallium/drivers/nv50/nv50_clear.c @@ -86,7 +86,5 @@ nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps, pipe->set_framebuffer_state(pipe, &s_fb); pipe->set_scissor_state(pipe, &s_sc); nv50->dirty |= dirty; - - ps->status = PIPE_SURFACE_STATUS_CLEAR; } diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index dc4688ccdc4..f79a7ca86c9 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -163,7 +163,6 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, ps->width = pt->width[level]; ps->height = pt->height[level]; ps->usage = flags; - ps->status = PIPE_SURFACE_STATUS_DEFINED; pipe_reference_init(&ps->reference, 1); ps->face = face; ps->level = level; diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 85098a78a25..fc6157dbd09 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -178,17 +178,10 @@ nv50_state_emit(struct nv50_context *nv50) boolean nv50_state_validate(struct nv50_context *nv50) { - const struct pipe_framebuffer_state *fb = &nv50->framebuffer; struct nouveau_grobj *tesla = nv50->screen->tesla; struct nouveau_stateobj *so; unsigned i; - for (i = 0; i < fb->nr_cbufs; i++) - fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED; - - if (fb->zsbuf) - fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED; - if (nv50->dirty & NV50_NEW_FRAMEBUFFER) nv50_state_validate_fb(nv50); diff --git a/src/gallium/drivers/r300/r300_clear.c b/src/gallium/drivers/r300/r300_clear.c index fd28437aaa4..8506ed29424 100644 --- a/src/gallium/drivers/r300/r300_clear.c +++ b/src/gallium/drivers/r300/r300_clear.c @@ -29,5 +29,4 @@ void r300_clear(struct pipe_context* pipe, unsigned color) { pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color); - ps->status = PIPE_SURFACE_STATUS_DEFINED; -} \ No newline at end of file +} diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 6cdea3d2854..fe91f4e1844 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -147,7 +147,6 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen, surface->height = texture->height[level]; surface->offset = offset; surface->usage = flags; - surface->status = PIPE_SURFACE_STATUS_DEFINED; } return surface; diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c index ad108ec446d..a60c6c4c16f 100644 --- a/src/gallium/drivers/softpipe/sp_clear.c +++ b/src/gallium/drivers/softpipe/sp_clear.c @@ -79,7 +79,6 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps, if (ps == sp_tile_cache_get_surface(softpipe->zsbuf_cache)) { sp_tile_cache_clear(softpipe->zsbuf_cache, clearValue); - softpipe->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_CLEAR; #if TILE_CLEAR_OPTIMIZATION return; #endif @@ -96,7 +95,6 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps, cv = clearValue; } sp_tile_cache_clear(softpipe->cbuf_cache[i], cv); - softpipe->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_CLEAR; } } diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index 96cb09b9051..711343abe67 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -1489,16 +1489,6 @@ void setup_prepare( struct setup_context *setup ) softpipe_update_derived(sp); } - /* Mark surfaces as defined now */ - for (i = 0; i < sp->framebuffer.nr_cbufs; i++){ - if (sp->framebuffer.cbufs[i]) { - sp->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED; - } - } - if (sp->framebuffer.zsbuf) { - sp->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_DEFINED; - } - /* Note: nr_attrs is only used for debugging (vertex printing) */ setup->quad.nr_attrs = draw_num_vs_outputs(sp->draw); diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c index f9fbe9aee79..a9570c1aebd 100644 --- a/src/gallium/drivers/trace/tr_state.c +++ b/src/gallium/drivers/trace/tr_state.c @@ -406,8 +406,6 @@ void trace_dump_surface(const struct pipe_surface *state) trace_dump_reference(&state->reference); trace_dump_member(format, state, format); - trace_dump_member(uint, state, status); - trace_dump_member(uint, state, clear_value); trace_dump_member(uint, state, width); trace_dump_member(uint, state, height); diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 52d443970b0..8e4f253359a 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -185,14 +185,6 @@ enum pipe_texture_target { #define PIPE_SURFACE_LAYOUT_LINEAR 0 -/** - * Surface status - */ -#define PIPE_SURFACE_STATUS_UNDEFINED 0 -#define PIPE_SURFACE_STATUS_DEFINED 1 -#define PIPE_SURFACE_STATUS_CLEAR 2 - - /** * Transfer object usage flags */ diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 9c7baa3d92e..705ae68ec65 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -281,8 +281,6 @@ struct pipe_surface { struct pipe_reference reference; enum pipe_format format; /**< PIPE_FORMAT_x */ - unsigned status; /**< PIPE_SURFACE_STATUS_x */ - unsigned clear_value; /**< XXX may be temporary */ unsigned width; /**< logical width in pixels */ unsigned height; /**< logical height in pixels */ unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */ diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index ca545b12e68..489aa8d9af5 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -406,8 +406,6 @@ drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw) surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL); /* TODO stuff here */ } - - st_notify_swapbuffers_complete(surf->stfb); } return EGL_TRUE; diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index dd9ba2881f9..020684b4e14 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -291,11 +291,6 @@ clear_with_quad(GLcontext *ctx, static INLINE GLboolean check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { - const struct st_renderbuffer *strb = st_renderbuffer(rb); - - if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED) - return FALSE; - if (ctx->Scissor.Enabled) return TRUE; @@ -312,14 +307,10 @@ check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) static INLINE GLboolean check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { - const struct st_renderbuffer *strb = st_renderbuffer(rb); const GLuint stencilMax = (1 << rb->StencilBits) - 1; GLboolean maskStencil = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; - if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED) - return FALSE; - if (ctx->Scissor.Enabled) return TRUE; @@ -339,14 +330,10 @@ check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) const struct st_renderbuffer *strb = st_renderbuffer(rb); const GLboolean isDS = is_depth_stencil_format(strb->surface->format); - if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED) - return FALSE; - if (ctx->Scissor.Enabled) return TRUE; if (isDS && - strb->surface->status == PIPE_SURFACE_STATUS_DEFINED && ctx->DrawBuffer->Visual.stencilBits > 0) return TRUE; @@ -366,9 +353,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) const GLboolean maskStencil = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; - if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED) - return FALSE; - if (maskStencil) return TRUE; @@ -381,7 +365,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) * current state. */ if (isDS && - strb->surface->status == PIPE_SURFACE_STATUS_DEFINED && ctx->DrawBuffer->Visual.depthBits > 0) return TRUE; diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 06fec20eeec..daaad65ccaf 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -293,32 +293,6 @@ st_notify_swapbuffers(struct st_framebuffer *stfb) } -/** - * Quick hack - allows the winsys to inform the driver that surface - * states are now undefined after a glXSwapBuffers or similar. - */ -void -st_notify_swapbuffers_complete(struct st_framebuffer *stfb) -{ - GET_CURRENT_CONTEXT(ctx); - - if (ctx && ctx->DrawBuffer == &stfb->Base) { - struct st_renderbuffer *strb; - - /* Mark back color buffers as undefined */ - strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_LEFT]. - Renderbuffer); - if (strb && strb->surface) - strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED; - - strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_RIGHT]. - Renderbuffer); - if (strb && strb->surface) - strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED; - } -} - - void *st_framebuffer_private( struct st_framebuffer *stfb ) { return stfb->Private; diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h index 414218bb589..030314372f9 100644 --- a/src/mesa/state_tracker/st_public.h +++ b/src/mesa/state_tracker/st_public.h @@ -100,7 +100,6 @@ void st_flush( struct st_context *st, uint pipeFlushFlags, void st_finish( struct st_context *st ); void st_notify_swapbuffers(struct st_framebuffer *stfb); -void st_notify_swapbuffers_complete(struct st_framebuffer *stfb); int st_set_teximage(struct pipe_texture *pt, int target); -- cgit v1.2.3 From 6af3be43091eff32793bb722cd483fe3ca435954 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 26 Mar 2009 12:07:06 +0100 Subject: python: Fix tri sample. --- src/gallium/state_trackers/python/samples/tri.py | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index ae065c5b9ae..9581b307bf5 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -67,6 +67,8 @@ def test(dev): width = 255 height = 255 + minz = 0.0 + maxz = 0.0 # disabled blending/masking blend = Blend() @@ -85,23 +87,21 @@ def test(dev): rasterizer = Rasterizer() rasterizer.front_winding = PIPE_WINDING_CW rasterizer.cull_mode = PIPE_WINDING_NONE - rasterizer.bypass_clipping = 1 rasterizer.scissor = 1 - #rasterizer.bypass_vs = 1 ctx.set_rasterizer(rasterizer) - # viewport (identity, we setup vertices in wincoords) + # viewport viewport = Viewport() scale = FloatArray(4) - scale[0] = 1.0 - scale[1] = 1.0 - scale[2] = 1.0 + scale[0] = width / 2.0 + scale[1] = -height / 2.0 + scale[2] = (maxz - minz) / 2.0 scale[3] = 1.0 viewport.scale = scale translate = FloatArray(4) - translate[0] = 0.0 - translate[1] = 0.0 - translate[2] = 0.0 + translate[0] = width / 2.0 + translate[1] = height / 2.0 + translate[2] = (maxz - minz) / 2.0 translate[3] = 0.0 viewport.translate = translate ctx.set_viewport(viewport) @@ -173,24 +173,24 @@ def test(dev): nattrs = 2 verts = FloatArray(nverts * nattrs * 4) - verts[ 0] = 128.0 # x1 - verts[ 1] = 32.0 # y1 + verts[ 0] = 0.0 # x1 + verts[ 1] = 0.8 # y1 verts[ 2] = 0.0 # z1 verts[ 3] = 1.0 # w1 verts[ 4] = 1.0 # r1 verts[ 5] = 0.0 # g1 verts[ 6] = 0.0 # b1 verts[ 7] = 1.0 # a1 - verts[ 8] = 32.0 # x2 - verts[ 9] = 224.0 # y2 + verts[ 8] = -0.8 # x2 + verts[ 9] = -0.8 # y2 verts[10] = 0.0 # z2 verts[11] = 1.0 # w2 verts[12] = 0.0 # r2 verts[13] = 1.0 # g2 verts[14] = 0.0 # b2 verts[15] = 1.0 # a2 - verts[16] = 224.0 # x3 - verts[17] = 224.0 # y3 + verts[16] = 0.8 # x3 + verts[17] = -0.8 # y3 verts[18] = 0.0 # z3 verts[19] = 1.0 # w3 verts[20] = 0.0 # r3 -- cgit v1.2.3 From f4520277e1a5113146fb99e831d515ba7f74c1f8 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Mar 2009 10:47:25 +0000 Subject: python: Transfer only the requested tile. --- src/gallium/state_trackers/python/p_texture.i | 50 ++++++++++----------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index e53369cc56c..de03f8f446c 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -106,11 +106,9 @@ $self->level, $self->zslice, PIPE_TRANSFER_READ, - 0, 0, - $self->width, - $self->height); + x, y, w, h); if(transfer) { - pipe_get_tile_raw(transfer, x, y, w, h, raw, stride); + pipe_get_tile_raw(transfer, 0, 0, w, h, raw, stride); screen->tex_transfer_destroy(transfer); } } @@ -126,11 +124,9 @@ $self->level, $self->zslice, PIPE_TRANSFER_WRITE, - 0, 0, - $self->width, - $self->height); + x, y, w, h); if(transfer) { - pipe_put_tile_raw(transfer, x, y, w, h, raw, stride); + pipe_put_tile_raw(transfer, 0, 0, w, h, raw, stride); screen->tex_transfer_destroy(transfer); } } @@ -146,11 +142,9 @@ $self->level, $self->zslice, PIPE_TRANSFER_READ, - 0, 0, - $self->width, - $self->height); + x, y, w, h); if(transfer) { - pipe_get_tile_rgba(transfer, x, y, w, h, rgba); + pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba); screen->tex_transfer_destroy(transfer); } } @@ -166,11 +160,9 @@ $self->level, $self->zslice, PIPE_TRANSFER_WRITE, - 0, 0, - $self->width, - $self->height); + x, y, w, h); if(transfer) { - pipe_put_tile_rgba(transfer, x, y, w, h, rgba); + pipe_put_tile_rgba(transfer, 0, 0, w, h, rgba); screen->tex_transfer_destroy(transfer); } } @@ -209,12 +201,12 @@ $self->level, $self->zslice, PIPE_TRANSFER_READ, - 0, 0, - $self->width, - $self->height); + x, y + j, + w, + 1); if(transfer) { pipe_get_tile_rgba(transfer, - x, y + j, w, 1, + 0, 0, w, 1, rgba); for(i = 0; i < w; ++i) for(k = 0; k <4; ++k) @@ -237,11 +229,9 @@ $self->level, $self->zslice, PIPE_TRANSFER_READ, - 0, 0, - $self->width, - $self->height); + x, y, w, h); if(transfer) { - pipe_get_tile_z(transfer, x, y, w, h, z); + pipe_get_tile_z(transfer, 0, 0, w, h, z); screen->tex_transfer_destroy(transfer); } } @@ -257,11 +247,9 @@ $self->level, $self->zslice, PIPE_TRANSFER_WRITE, - 0, 0, - $self->width, - $self->height); + x, y, w, h); if(transfer) { - pipe_put_tile_z(transfer, x, y, w, h, z); + pipe_put_tile_z(transfer, 0, 0, w, h, z); screen->tex_transfer_destroy(transfer); } } @@ -291,15 +279,13 @@ $self->level, $self->zslice, PIPE_TRANSFER_WRITE, - 0, 0, - $self->width, - $self->height); + x, y, w, h); if(!transfer) { FREE(rgba2); return ~0; } - pipe_get_tile_rgba(transfer, x, y, w, h, rgba2); + pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba2); screen->tex_transfer_destroy(transfer); p1 = rgba; -- cgit v1.2.3 From ca9d2044a2390267477f1e7118b16f21f2557dd3 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Mar 2009 10:54:48 +0000 Subject: python: Use pipe_buffer_read/write. --- src/gallium/state_trackers/python/p_texture.i | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index de03f8f446c..4648af691d1 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -327,7 +327,6 @@ struct st_buffer { void read(char **STRING, int *LENGTH) { struct pipe_screen *screen = $self->st_dev->screen; - const char *map; assert(p_atomic_read(&$self->buffer->reference.count) > 0); @@ -336,18 +335,13 @@ struct st_buffer { if(!*STRING) return; - map = pipe_buffer_map(screen, $self->buffer, PIPE_BUFFER_USAGE_CPU_READ); - if(map) { - memcpy(*STRING, map, $self->buffer->size); - pipe_buffer_unmap(screen, $self->buffer); - } + pipe_buffer_read(screen, $self->buffer, 0, $self->buffer->size, STRING); } %cstring_input_binary(const char *STRING, unsigned LENGTH); void write(const char *STRING, unsigned LENGTH, unsigned offset = 0) { struct pipe_screen *screen = $self->st_dev->screen; - char *map; assert(p_atomic_read(&$self->buffer->reference.count) > 0); @@ -361,10 +355,6 @@ struct st_buffer { return; } - map = pipe_buffer_map(screen, $self->buffer, PIPE_BUFFER_USAGE_CPU_WRITE); - if(map) { - memcpy(map + offset, STRING, LENGTH); - pipe_buffer_unmap(screen, $self->buffer); - } + pipe_buffer_write(screen, $self->buffer, offset, LENGTH, STRING); } }; -- cgit v1.2.3 From d18c2ee3d5a1d0352a6f8d48aa067e8983dd5878 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Mar 2009 11:19:15 +0000 Subject: python: Drop st_buffer. It adds nothing, now that pipe_buffer has a pointer to the screen. --- src/gallium/state_trackers/python/gallium.i | 2 +- src/gallium/state_trackers/python/p_context.i | 16 +++++----- src/gallium/state_trackers/python/p_device.i | 4 +-- src/gallium/state_trackers/python/p_texture.i | 44 ++++++++++++++------------- src/gallium/state_trackers/python/st_device.c | 34 --------------------- src/gallium/state_trackers/python/st_device.h | 14 --------- 6 files changed, 34 insertions(+), 80 deletions(-) diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i index 79e68de1df8..8b43c1721ef 100644 --- a/src/gallium/state_trackers/python/gallium.i +++ b/src/gallium/state_trackers/python/gallium.i @@ -72,7 +72,7 @@ %rename(Context) st_context; %rename(Texture) pipe_texture; %rename(Surface) pipe_surface; -%rename(Buffer) st_buffer; +%rename(Buffer) pipe_buffer; %rename(BlendColor) pipe_blend_color; %rename(Blend) pipe_blend_state; diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 178ab0e24ef..05f3f222035 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -116,11 +116,11 @@ struct st_context { } void set_constant_buffer(unsigned shader, unsigned index, - struct st_buffer *buffer ) + struct pipe_buffer *buffer ) { struct pipe_constant_buffer state; memset(&state, 0, sizeof(state)); - state.buffer = buffer ? buffer->buffer : NULL; + state.buffer = buffer; $self->pipe->set_constant_buffer($self->pipe, shader, index, &state); } @@ -154,7 +154,7 @@ struct st_context { unsigned stride, unsigned max_index, unsigned buffer_offset, - struct st_buffer *buffer) + struct pipe_buffer *buffer) { unsigned i; struct pipe_vertex_buffer state; @@ -163,7 +163,7 @@ struct st_context { state.stride = stride; state.max_index = max_index; state.buffer_offset = buffer_offset; - state.buffer = buffer ? buffer->buffer : NULL; + state.buffer = buffer; memcpy(&$self->vertex_buffers[index], &state, sizeof(state)); @@ -198,22 +198,22 @@ struct st_context { $self->pipe->draw_arrays($self->pipe, mode, start, count); } - void draw_elements( struct st_buffer *indexBuffer, + void draw_elements( struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned mode, unsigned start, unsigned count) { $self->pipe->draw_elements($self->pipe, - indexBuffer->buffer, + indexBuffer, indexSize, mode, start, count); } - void draw_range_elements( struct st_buffer *indexBuffer, + void draw_range_elements( struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned minIndex, unsigned maxIndex, unsigned mode, unsigned start, unsigned count) { $self->pipe->draw_range_elements($self->pipe, - indexBuffer->buffer, + indexBuffer, indexSize, minIndex, maxIndex, mode, start, count); } diff --git a/src/gallium/state_trackers/python/p_device.i b/src/gallium/state_trackers/python/p_device.i index 84fd2e4349b..f16fe5b0ff7 100644 --- a/src/gallium/state_trackers/python/p_device.i +++ b/src/gallium/state_trackers/python/p_device.i @@ -122,9 +122,9 @@ struct st_device { return $self->screen->texture_create($self->screen, &templat); } - struct st_buffer * + struct pipe_buffer * buffer_create(unsigned size, unsigned alignment = 0, unsigned usage = 0) { - return st_buffer_create($self, alignment, usage, size); + return pipe_buffer_create($self->screen, alignment, usage, size); } }; diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 4648af691d1..63c63db9ebe 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -35,11 +35,11 @@ %nodefaultctor pipe_texture; %nodefaultctor pipe_surface; -%nodefaultctor st_buffer; +%nodefaultctor pipe_buffer; %nodefaultdtor pipe_texture; %nodefaultdtor pipe_surface; -%nodefaultdtor st_buffer; +%nodefaultdtor pipe_buffer; %ignore pipe_texture::screen; @@ -308,53 +308,55 @@ }; -struct st_buffer { -}; +/* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */ +%rename(read) pipe_buffer_read_; +%rename(write) pipe_buffer_write_; -%extend st_buffer { +%extend pipe_buffer { - ~st_buffer() { - st_buffer_destroy($self); + ~pipe_buffer() { + struct pipe_buffer *ptr = $self; + pipe_buffer_reference(&ptr, NULL); } unsigned __len__(void) { - assert(p_atomic_read(&$self->buffer->reference.count) > 0); - return $self->buffer->size; + assert(p_atomic_read(&$self->reference.count) > 0); + return $self->size; } %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1)); - void read(char **STRING, int *LENGTH) + void read_(char **STRING, int *LENGTH) { - struct pipe_screen *screen = $self->st_dev->screen; + struct pipe_screen *screen = $self->screen; - assert(p_atomic_read(&$self->buffer->reference.count) > 0); + assert(p_atomic_read(&$self->reference.count) > 0); - *LENGTH = $self->buffer->size; - *STRING = (char *) malloc($self->buffer->size); + *LENGTH = $self->size; + *STRING = (char *) malloc($self->size); if(!*STRING) return; - pipe_buffer_read(screen, $self->buffer, 0, $self->buffer->size, STRING); + pipe_buffer_read(screen, $self, 0, $self->size, STRING); } %cstring_input_binary(const char *STRING, unsigned LENGTH); - void write(const char *STRING, unsigned LENGTH, unsigned offset = 0) + void write_(const char *STRING, unsigned LENGTH, unsigned offset = 0) { - struct pipe_screen *screen = $self->st_dev->screen; + struct pipe_screen *screen = $self->screen; - assert(p_atomic_read(&$self->buffer->reference.count) > 0); + assert(p_atomic_read(&$self->reference.count) > 0); - if(offset > $self->buffer->size) { + if(offset > $self->size) { PyErr_SetString(PyExc_ValueError, "offset must be smaller than buffer size"); return; } - if(offset + LENGTH > $self->buffer->size) { + if(offset + LENGTH > $self->size) { PyErr_SetString(PyExc_ValueError, "data length must fit inside the buffer"); return; } - pipe_buffer_write(screen, $self->buffer, offset, LENGTH, STRING); + pipe_buffer_write(screen, $self, offset, LENGTH, STRING); } }; diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index 366d4eb19af..b4f8649d3bc 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -291,37 +291,3 @@ st_context_create(struct st_device *st_dev) return st_ctx; } - - -void -st_buffer_destroy(struct st_buffer *st_buf) -{ - if(st_buf) { - pipe_buffer_reference(&st_buf->buffer, NULL); - FREE(st_buf); - } -} - - -struct st_buffer * -st_buffer_create(struct st_device *st_dev, - unsigned alignment, unsigned usage, unsigned size) -{ - struct pipe_screen *screen = st_dev->screen; - struct st_buffer *st_buf; - - st_buf = CALLOC_STRUCT(st_buffer); - if(!st_buf) - return NULL; - - st_buf->st_dev = st_dev; - - st_buf->buffer = pipe_buffer_create(screen, alignment, usage, size); - if(!st_buf->buffer) { - st_buffer_destroy(st_buf); - return NULL; - } - - return st_buf; -} - diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h index 0641aff149f..d1bd8c31f4f 100644 --- a/src/gallium/state_trackers/python/st_device.h +++ b/src/gallium/state_trackers/python/st_device.h @@ -38,13 +38,6 @@ struct pipe_context; struct st_winsys; -struct st_buffer { - struct st_device *st_dev; - - struct pipe_buffer *buffer; -}; - - struct st_context { struct st_device *st_dev; @@ -78,13 +71,6 @@ struct st_device { }; -struct st_buffer * -st_buffer_create(struct st_device *st_dev, - unsigned alignment, unsigned usage, unsigned size); - -void -st_buffer_destroy(struct st_buffer *st_buf); - struct st_context * st_context_create(struct st_device *st_dev); -- cgit v1.2.3 From bb84ce71593d79bae9e8a5a8bdd4b2bd6aba2c87 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Mar 2009 11:29:59 +0000 Subject: python: Make swig bindings python independent. --- src/gallium/state_trackers/python/gallium.i | 3 +-- src/gallium/state_trackers/python/p_texture.i | 15 +++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i index 8b43c1721ef..4970819190e 100644 --- a/src/gallium/state_trackers/python/gallium.i +++ b/src/gallium/state_trackers/python/gallium.i @@ -37,7 +37,6 @@ %{ #include -#include #include "pipe/p_screen.h" #include "pipe/p_context.h" @@ -58,7 +57,7 @@ %} %include "typemaps.i" - +%include "exception.i" %include "cstring.i" %include "carrays.i" diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 63c63db9ebe..b03054adcce 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -347,16 +347,15 @@ assert(p_atomic_read(&$self->reference.count) > 0); - if(offset > $self->size) { - PyErr_SetString(PyExc_ValueError, "offset must be smaller than buffer size"); - return; - } + if(offset > $self->size) + SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size"); - if(offset + LENGTH > $self->size) { - PyErr_SetString(PyExc_ValueError, "data length must fit inside the buffer"); - return; - } + if(offset + LENGTH > $self->size) + SWIG_exception(SWIG_ValueError, "data length must fit inside the buffer"); pipe_buffer_write(screen, $self, offset, LENGTH, STRING); + +fail: + return; } }; -- cgit v1.2.3 From 7138cd700997a353bfa127495b3f11adeab68940 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Mar 2009 12:04:15 +0000 Subject: python: Fix the texture test. --- src/gallium/state_trackers/python/tests/texture.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/texture.py b/src/gallium/state_trackers/python/tests/texture.py index 8cec57e2a60..ce1c66720b4 100644 --- a/src/gallium/state_trackers/python/tests/texture.py +++ b/src/gallium/state_trackers/python/tests/texture.py @@ -168,26 +168,9 @@ class TextureTest(TestCase): rasterizer = Rasterizer() rasterizer.front_winding = PIPE_WINDING_CW rasterizer.cull_mode = PIPE_WINDING_NONE - rasterizer.bypass_clipping = 1 - #rasterizer.bypass_vs = 1 + rasterizer.bypass_vs_clip_and_viewport = 1 ctx.set_rasterizer(rasterizer) - # viewport (identity, we setup vertices in wincoords) - viewport = Viewport() - scale = FloatArray(4) - scale[0] = 1.0 - scale[1] = 1.0 - scale[2] = 1.0 - scale[3] = 1.0 - viewport.scale = scale - translate = FloatArray(4) - translate[0] = 0.0 - translate[1] = 0.0 - translate[2] = 0.0 - translate[3] = 0.0 - viewport.translate = translate - ctx.set_viewport(viewport) - # samplers sampler = Sampler() sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE -- cgit v1.2.3 From a2f52f500cdff2ffd5aec039cafaaa3bc2273595 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Mar 2009 12:11:27 +0000 Subject: python: Don't bypass vs/clip/viewport by default. --- src/gallium/state_trackers/python/st_device.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index b4f8649d3bc..8246b378ce0 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -192,10 +192,16 @@ st_context_create(struct st_device *st_dev) memset(&rasterizer, 0, sizeof(rasterizer)); rasterizer.front_winding = PIPE_WINDING_CW; rasterizer.cull_mode = PIPE_WINDING_NONE; - rasterizer.bypass_vs_clip_and_viewport = 1; cso_set_rasterizer(st_ctx->cso, &rasterizer); } + /* clip */ + { + struct pipe_clip_state clip; + memset(&clip, 0, sizeof(clip)); + st_ctx->pipe->set_clip_state(st_ctx->pipe, &clip); + } + /* identity viewport */ { struct pipe_viewport_state viewport; -- cgit v1.2.3 From 3673189326e348eb91e354017703fdfd9d6d8184 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Mar 2009 08:40:07 -0600 Subject: tgsi: pass zero vector to texture sampler for 1D case instead of NULL Fixes segfault when sampling 1D textures. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index ba807e498f1..259877b500d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -123,6 +123,10 @@ #define UPDATE_EXEC_MASK(MACH) \ MACH->ExecMask = MACH->CondMask & MACH->LoopMask & MACH->ContMask & MACH->FuncMask + +static const union tgsi_exec_channel ZeroVec = + { { 0.0, 0.0, 0.0, 0.0 } }; + /** * Initialize machine state by expanding tokens to full instructions, * allocating temporary storage, setting up constants, etc. @@ -1643,7 +1647,7 @@ exec_tex(struct tgsi_exec_machine *mach, lodBias = 0.0; fetch_texel(mach->Samplers[unit], - &r[0], NULL, NULL, lodBias, /* S, T, P, BIAS */ + &r[0], &ZeroVec, &ZeroVec, lodBias, /* S, T, P, BIAS */ &r[0], &r[1], &r[2], &r[3]); /* R, G, B, A */ break; -- cgit v1.2.3 From 2002e03a5232c54988161cb629966bdce19d35de Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Mar 2009 08:52:56 -0600 Subject: st: init the default texture to (0,0,0,1) The default texture is used when a sampler uses an incomplete texture. This change fixes the piglit fp-incomplete test. --- src/mesa/state_tracker/st_cb_texture.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 311d812ccfb..d353241a7eb 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1471,9 +1471,19 @@ st_get_default_texture(struct st_context *st) GLubyte pixels[16][16][4]; struct gl_texture_object *texObj; struct gl_texture_image *texImg; + GLuint i, j; - /* init image to gray */ - memset(pixels, 127, sizeof(pixels)); + /* The ARB_fragment_program spec says (0,0,0,1) should be returned + * when attempting to sample incomplete textures. + */ + for (i = 0; i < 16; i++) { + for (j = 0; j < 16; j++) { + pixels[i][j][0] = 0; + pixels[i][j][1] = 0; + pixels[i][j][2] = 0; + pixels[i][j][3] = 255; + } + } texObj = st->ctx->Driver.NewTextureObject(st->ctx, 0, target); -- cgit v1.2.3 From c97e5e1fc157ca5876241ee16c520d924535b4f0 Mon Sep 17 00:00:00 2001 From: Carl-Johan Kjellander Date: Thu, 26 Mar 2009 19:20:11 +0000 Subject: egl: Fix newline typo in Makefiles --- src/egl/drivers/dri/Makefile | 3 ++- src/egl/drivers/glx/Makefile | 3 ++- src/egl/drivers/xdri/Makefile | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/egl/drivers/dri/Makefile b/src/egl/drivers/dri/Makefile index be2f9b6bea3..4041d5c906a 100644 --- a/src/egl/drivers/dri/Makefile +++ b/src/egl/drivers/dri/Makefile @@ -48,7 +48,8 @@ $(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS) -major 1 -minor 0 \ -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS) -install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) +install: + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) $(TOP)/$(LIB_DIR)/libEGLdri.so $(DESTDIR)$(INSTALL_LIB_DIR) clean: diff --git a/src/egl/drivers/glx/Makefile b/src/egl/drivers/glx/Makefile index 090a230ca34..5f041a268f1 100644 --- a/src/egl/drivers/glx/Makefile +++ b/src/egl/drivers/glx/Makefile @@ -56,7 +56,8 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS) -install $(TOP)/$(LIB_DIR) \ $(OBJECTS) $(DRM_LIB) $(MISC_LIBS) -install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) +install: + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR) clean: diff --git a/src/egl/drivers/xdri/Makefile b/src/egl/drivers/xdri/Makefile index db4b7100027..eb83867b718 100644 --- a/src/egl/drivers/xdri/Makefile +++ b/src/egl/drivers/xdri/Makefile @@ -52,7 +52,8 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS) -install $(TOP)/$(LIB_DIR) \ $(OBJECTS) $(DRM_LIB) $(MISC_LIBS) -install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) +install: + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR) clean: -- cgit v1.2.3 From ec30d1b2e5738264ca2ab2ce23d9fce2b9c7a2ce Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 27 Mar 2009 19:13:21 +0000 Subject: mesa: Use the python executable from sys.executable. From Ramesh Dharan --- src/gallium/auxiliary/indices/SConscript | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/indices/SConscript b/src/gallium/auxiliary/indices/SConscript index e5f7ee94845..712e215534f 100644 --- a/src/gallium/auxiliary/indices/SConscript +++ b/src/gallium/auxiliary/indices/SConscript @@ -1,17 +1,19 @@ Import('*') +from sys import executable as python_cmd + env.CodeGenerate( target = 'u_indices_gen.c', script = 'u_indices_gen.py', source = [], - command = 'python $SCRIPT > $TARGET' + command = python_cmd + ' $SCRIPT > $TARGET' ) env.CodeGenerate( target = 'u_unfilled_gen.c', script = 'u_unfilled_gen.py', source = [], - command = 'python $SCRIPT > $TARGET' + command = python_cmd + ' $SCRIPT > $TARGET' ) indices = env.ConvenienceLibrary( -- cgit v1.2.3 From aa91f05f9de28511f352ac1d0ce754c19539e38f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 25 Mar 2009 07:25:06 -0700 Subject: r300-gallium: Use CMP for MOV on r300. Doesn't quite fix problems, though. :c --- src/gallium/drivers/r300/r300_state_shader.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index e83d007ba20..7cbb41ffdb9 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -119,15 +119,15 @@ static const struct r300_fragment_shader r300_passthrough_fragment_shader = { .shader.stack_size = 1, .instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) | - R300_RGB_SWIZB(R300_ALU_ARGC_ONE) | + R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) | R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) | - R300_ALU_OUTC_MAD, + 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_ONE) | + R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) | R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) | - R300_ALU_OUTA_MAD, + 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, }; -- cgit v1.2.3 From 2431a027c197c7172d6769eb616d4301cc6a0bca Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 25 Mar 2009 21:26:02 -0700 Subject: r300-gallium: Add some surface_copy. --- src/gallium/drivers/r300/r300_emit.c | 2 +- src/gallium/drivers/r300/r300_emit.h | 2 + src/gallium/drivers/r300/r300_reg.h | 3 + src/gallium/drivers/r300/r300_state_invariant.c | 17 ---- src/gallium/drivers/r300/r300_state_shader.h | 54 +++++++++++++ src/gallium/drivers/r300/r300_surface.c | 101 ++++++++++++++++++++++-- src/gallium/drivers/r300/r300_surface.h | 29 +++++++ 7 files changed, 184 insertions(+), 24 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 16455e48ce8..a2e9cca39ba 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -343,7 +343,7 @@ void r300_emit_viewport_state(struct r300_context* r300, END_CS; } -static void r300_flush_textures(struct r300_context* r300) +void r300_flush_textures(struct r300_context* r300) { CS_LOCALS(r300); diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 0bc1f90e6ab..9d92b090ace 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -67,6 +67,8 @@ void r300_emit_vertex_format_state(struct r300_context* r300); void r300_emit_viewport_state(struct r300_context* r300, struct r300_viewport_state* viewport); +void r300_flush_textures(struct r300_context* r300); + /* Emit all dirty state. */ void r300_emit_dirty_state(struct r300_context* r300); diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 3fe45e13932..c9a195a6ce4 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1191,6 +1191,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_RS_INST_COUNT_MASK 0x0000000f # define R300_RS_TX_OFFSET_SHIFT 5 # define R300_RS_TX_OFFSET_MASK 0x000000e0 +# define R300_RS_TX_OFFSET(x) ((x) << 5) /* gap */ @@ -1434,6 +1435,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_MAX_ANISO_8_TO_1 (3 << 21) # define R300_TX_MAX_ANISO_16_TO_1 (4 << 21) # define R300_TX_MAX_ANISO_MASK (7 << 21) +# define R300_TX_WRAP_S(x) ((x) << 0) +# define R300_TX_WRAP_T(x) ((x) << 3) #define R300_TX_FILTER1_0 0x4440 # define R300_CHROMA_KEY_MODE_DISABLE 0 diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index e1837b63801..3705ff98db5 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -141,28 +141,11 @@ void r300_emit_invariant_state(struct r300_context* r300) OUT_CS_REG(R300_ZB_DEPTHCLEARVALUE, 0x00000000); OUT_CS_REG(R300_ZB_HIZ_OFFSET, 0x00000000); OUT_CS_REG(R300_ZB_HIZ_PITCH, 0x00000000); - if (caps->has_tcl) { - OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, - (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) | - ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) | - R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT)); - } else { - OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, - (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) | - ((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) | - R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT)); - } - OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0, - (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) | - (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT)); OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1); OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405); OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F); /* Vertex size. */ OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8); - OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0, 0x00000003); - OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x00000000); - OUT_CS_REG(R300_TX_ENABLE, 0x0); /* XXX */ OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa); diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index 7cbb41ffdb9..3c5f036d2ae 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -158,4 +158,58 @@ static const struct r500_fragment_shader r500_passthrough_fragment_shader = { R500_ALU_RGBA_A_SWIZ_0, }; +static const struct r300_fragment_shader r300_texture_fragment_shader = { + /* XXX This is the emission code. TODO: decode + OUT_CS_REG(R300_US_CONFIG, 0); + OUT_CS_REG(R300_US_CODE_OFFSET, 0x0); + OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0); + OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0); + OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0); + OUT_CS_REG(R300_US_CODE_ADDR_3, 0x400000); +*/ + .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 const struct r500_fragment_shader r500_texture_fragment_shader = { + .shader.stack_size = 0, + .instruction_count = 1, + .instructions[0].inst0 = R500_INST_TYPE_OUT | + R500_INST_TEX_SEM_WAIT | R500_INST_LAST | + R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK | + R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP, + .instructions[0].inst1 = + R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST | + R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST, + .instructions[0].inst2 = + R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST | + R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST, + .instructions[0].inst3 = + R500_ALU_RGB_SEL_A_SRC0 | R500_ALU_RGB_R_SWIZ_A_R | + R500_ALU_RGB_G_SWIZ_A_G | R500_ALU_RGB_B_SWIZ_A_B | + R500_ALU_RGB_SEL_B_SRC0 | R500_ALU_RGB_R_SWIZ_B_R | + R500_ALU_RGB_B_SWIZ_B_G | R500_ALU_RGB_G_SWIZ_B_B, + .instructions[0].inst4 = + R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A, + .instructions[0].inst5 = + R500_ALU_RGBA_OP_CMP | R500_ALU_RGBA_R_SWIZ_0 | + R500_ALU_RGBA_G_SWIZ_0 | R500_ALU_RGBA_B_SWIZ_0 | + R500_ALU_RGBA_A_SWIZ_0, +}; + #endif /* R300_STATE_SHADER_H */ diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index db18975a10f..96b63986ea7 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -113,7 +113,32 @@ static void r300_surface_fill(struct pipe_context* pipe, r300_emit_rs_block_state(r300, &r300_rs_block_clear_state); } - BEGIN_CS(21); + BEGIN_CS(31); + + /* VAP stream control, mapping from input memory to PVS/RS memory */ + if (caps->has_tcl) { + OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, + (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) | + ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) | + R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT)); + } else { + OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, + (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) | + ((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) | + R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT)); + } + OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0, + (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) | + (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT)); + + /* VAP format controls */ + OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0, + R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT | + R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT); + OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x0); + + /* Disable textures */ + OUT_CS_REG(R300_TX_ENABLE, 0x0); /* Viewport setup */ OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6); @@ -132,7 +157,7 @@ static void r300_surface_fill(struct pipe_context* pipe, /* Packet3 with our point vertex */ OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8); OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING | - (1 << R300_PRIM_NUM_VERTICES_SHIFT)); + (1 << R300_PRIM_NUM_VERTICES_SHIFT)); OUT_CS_32F(w / 2.0); OUT_CS_32F(h / 2.0); /* XXX this should be the depth value to clear to */ @@ -163,6 +188,7 @@ static void r300_surface_copy(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); CS_LOCALS(r300); + struct r300_capabilities* caps = r300_screen(pipe->screen)->caps; struct r300_texture* srctex = (struct r300_texture*)src->texture; struct r300_texture* desttex = (struct r300_texture*)dest->texture; @@ -171,14 +197,77 @@ static void r300_surface_copy(struct pipe_context* pipe, " dimensions %dx%d (pixel pitch %d)\n", src, srcx, srcy, dest, destx, desty, w, h, pixpitch); - /* if ((srctex == desttex) && + if ((srctex == desttex) && ((destx < srcx + w) || (srcx < destx + w)) && - ((desty < srcy + h) || (srcy < destx + h))) { */ - if (TRUE) { + ((desty < srcy + h) || (srcy < desty + h))) { debug_printf("r300: Falling back on surface_copy\n"); - return util_surface_copy(pipe, FALSE, dest, destx, desty, src, + util_surface_copy(pipe, FALSE, dest, destx, desty, src, srcx, srcy, w, h); } + + r300_emit_sampler(r300, &r300_sampler_copy_state, 0); + r300_emit_texture(r300, srctex, 0); + r300_flush_textures(r300); + + /* 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); + } else { + r300_emit_fragment_shader(r300, &r300_texture_fragment_shader); + r300_emit_rs_block_state(r300, &r300_rs_block_copy_state); + } + + /* VAP stream control, mapping from input memory to PVS/RS memory */ + if (caps->has_tcl) { + OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, + (R300_DATA_TYPE_FLOAT_2 << R300_DATA_TYPE_0_SHIFT) | + ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) | + R300_DATA_TYPE_FLOAT_2) << R300_DATA_TYPE_1_SHIFT)); + } else { + OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, + (R300_DATA_TYPE_FLOAT_2 << R300_DATA_TYPE_0_SHIFT) | + ((R300_LAST_VEC | (6 << R300_DST_VEC_LOC_SHIFT) | + R300_DATA_TYPE_FLOAT_2) << R300_DATA_TYPE_1_SHIFT)); + } + OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0, + (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) | + (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT)); + + /* VAP format controls */ + OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0, + R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT); + /* Two components of texture 0 */ + OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x2); + + /* Packet3 with our texcoords */ + OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8); + OUT_CS(R300_PRIM_TYPE_QUADS | R300_PRIM_WALK_RING | + (4 << R300_PRIM_NUM_VERTICES_SHIFT)); + /* (x , y ) */ + OUT_CS_32F((float)destx); + OUT_CS_32F((float)desty); + OUT_CS_32F((float)srcx); + OUT_CS_32F((float)srcy); + /* (x , y + h) */ + OUT_CS_32F((float)destx); + OUT_CS_32F((float)(desty + h)); + OUT_CS_32F((float)srcx); + OUT_CS_32F((float)(srcy + h)); + /* (x + w, y + h) */ + OUT_CS_32F((float)(destx + w)); + OUT_CS_32F((float)(desty + h)); + OUT_CS_32F((float)(srcx + w)); + OUT_CS_32F((float)(srcy + h)); + /* (x + w, y ) */ + OUT_CS_32F((float)(destx + w)); + OUT_CS_32F((float)desty); + OUT_CS_32F((float)(srcx + w)); + OUT_CS_32F((float)srcy); + + OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA); + + r300->dirty_hw++; } void r300_init_surface_functions(struct r300_context* r300) diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h index b75b3ab84cf..465b8476edf 100644 --- a/src/gallium/drivers/r300/r300_surface.h +++ b/src/gallium/drivers/r300/r300_surface.h @@ -91,4 +91,33 @@ const struct r300_rs_block r500_rs_block_clear_state = { .inst_count = 0, }; +/* The following state is used for surface_copy only. */ + +const struct r300_rs_block r300_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) | + R500_RS_SEL_Q(R300_RS_SEL_K1), + .inst[0] = R300_RS_INST_COL_CN_WRITE, + .count = R300_IT_COUNT(2) | R300_IC_COUNT(0) | R300_HIRES_EN, + .inst_count = R300_RS_TX_OFFSET(6), +}; + +const struct r300_rs_block r500_rs_block_copy_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) | + R500_RS_SEL_Q(R500_RS_IP_PTR_K1), + .inst[0] = R500_RS_INST_COL_CN_WRITE, + .count = R300_IT_COUNT(2) | R300_IC_COUNT(0) | R300_HIRES_EN, + .inst_count = R300_RS_TX_OFFSET(6), +}; + +const struct r300_sampler_state r300_sampler_copy_state = { + .filter0 = R300_TX_WRAP_S(R300_TX_CLAMP) | + R300_TX_WRAP_T(R300_TX_CLAMP) | + R300_TX_MAG_FILTER_NEAREST | + R300_TX_MIN_FILTER_NEAREST, +}; + #endif /* R300_SURFACE_H */ -- cgit v1.2.3 From e0a55dc9dae39384c18dd275081c24b7dce14eeb Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 27 Mar 2009 19:50:15 +0000 Subject: mesa: Support Z24S8 wherever S8Z24 is supported. --- src/mesa/state_tracker/st_cb_drawpixels.c | 21 +++++++++++++++++++++ src/mesa/state_tracker/st_cb_readpixels.c | 27 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 821ea67ce46..f9f139ff073 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -686,6 +686,17 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, } } break; + case PIPE_FORMAT_Z24S8_UNORM: + { + uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); + GLint k; + for (k = 0; k < spanWidth; k++) { + uint p = dest[k]; + p = (p & 0xffffff00) | (values[k] & 0xff); + dest[k] = p; + } + } + break; default: assert(0); } @@ -821,6 +832,16 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, } } break; + case PIPE_FORMAT_Z24S8_UNORM: + { + uint *dst4 = (uint *) dst; + int j; + for (j = 0; j < width; j++) { + *dst4 = (*dst4 & 0xffffff00) | (src[j] & 0xff); + dst4++; + } + } + break; case PIPE_FORMAT_S8_UNORM: memcpy(dst, src, width); break; diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 2a4beccd90e..ce7a8cda4e8 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -420,6 +420,33 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } } } + else if (trans->format == PIPE_FORMAT_Z24S8_UNORM || + trans->format == PIPE_FORMAT_Z24X8_UNORM) { + if (format == GL_DEPTH_COMPONENT) { + for (i = 0; i < height; i++) { + GLuint ztemp[MAX_WIDTH]; + GLfloat zfloat[MAX_WIDTH]; + const double scale = 1.0 / ((1 << 24) - 1); + pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0); + y += yStep; + for (j = 0; j < width; j++) { + zfloat[j] = (float) (scale * ((ztemp[j] >> 8) & 0xffffff)); + } + _mesa_pack_depth_span(ctx, width, dst, type, + zfloat, &clippedPacking); + dst += dstStride; + } + } + else { + /* untested, but simple: */ + assert(format == GL_DEPTH_STENCIL_EXT); + for (i = 0; i < height; i++) { + pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0); + y += yStep; + dst += dstStride; + } + } + } else if (trans->format == PIPE_FORMAT_Z16_UNORM) { for (i = 0; i < height; i++) { GLushort ztemp[MAX_WIDTH]; -- cgit v1.2.3 From a7900748106a9ad339a4552ca944f2fa30486cfc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 27 Mar 2009 20:23:16 +0000 Subject: util: Support Z24S8/Z24X8. --- src/gallium/auxiliary/util/u_tile.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index d31ca9c029e..f0a5a339eb3 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -957,6 +957,7 @@ pipe_tile_raw_to_rgba(enum pipe_format format, s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; case PIPE_FORMAT_Z32_FLOAT: @@ -1069,6 +1070,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, /*s8z24_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/ break; case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: /*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/ break; default: @@ -1198,6 +1200,20 @@ pipe_put_tile_z(struct pipe_transfer *pt, } } break; + case PIPE_FORMAT_Z24S8_UNORM: + 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 += pt->stride/4; + ptrc += srcStride; + } + } + break; case PIPE_FORMAT_Z16_UNORM: { ushort *pDest = (ushort *) (map + y * pt->stride + x*2); -- cgit v1.2.3 From c03000b73e49b858d6bf256114d28c8e9d7a2802 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 27 Mar 2009 21:38:54 +0000 Subject: wgl: Remove unused cruft. --- src/gallium/state_trackers/wgl/shared/stw_context.c | 4 ---- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 10 ---------- src/gallium/state_trackers/wgl/shared/stw_framebuffer.h | 5 ----- 3 files changed, 19 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 89df8b0a2a0..82aabe0a7ee 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -317,10 +317,6 @@ stw_make_current( fb = framebuffer_create( hdc, visual, width, height ); if (fb == NULL) return FALSE; - - fb->dib_hDC = CreateCompatibleDC( hdc ); - fb->hbmDIB = NULL; - fb->pbPixels = NULL; } if (ctx && fb) { diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 024c9ad36af..2f0d8cbc318 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -44,16 +44,6 @@ framebuffer_resize( GLuint width, GLuint height ) { - if (fb->hbmDIB == NULL || fb->stfb->Base.Width != width || fb->stfb->Base.Height != height) { - if (fb->hbmDIB) - DeleteObject( fb->hbmDIB ); - - fb->hbmDIB = CreateCompatibleBitmap( - fb->hDC, - width, - height ); - } - st_resize_framebuffer( fb->stfb, width, height ); } diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h index 2e16e421f2c..5abdf189970 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h @@ -36,12 +36,7 @@ struct stw_framebuffer { struct st_framebuffer *stfb; HDC hDC; - int pixelformat; BYTE cColorBits; - HDC dib_hDC; - HBITMAP hbmDIB; - HBITMAP hOldBitmap; - PBYTE pbPixels; HWND hWnd; WNDPROC WndProc; struct stw_framebuffer *next; -- cgit v1.2.3 From aa011836c2778d242c75547c3f64435a055a86ff Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 27 Mar 2009 21:43:24 +0000 Subject: wgl: Don't flush surface if it is NULL. Just a quick fix to prevent segfaults with glean. --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 2f0d8cbc318..4641884f950 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -225,11 +225,14 @@ stw_swap_buffers( */ st_notify_swapbuffers( fb->stfb ); - st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surf ); - - stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen, - surf, - hdc ); + if(st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surf )) { + stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen, + surf, + hdc ); + } + else { + /* FIXME: this shouldn't happen, but does on glean */ + } return TRUE; } -- cgit v1.2.3 From fd83289dbf747b4d2e0849f77c796323e5517f0b Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 2 Feb 2009 17:27:47 +0100 Subject: fix various small intel blitter issues use color format constants instead of magic numbers remove handling of cpp 0 or 3 (neither is possible) in various places don't misconfigure 8 bit surface blits as rgb565 --- src/mesa/drivers/dri/intel/intel_blit.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 4e033082b4d..4ae9b118a3d 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -98,11 +98,11 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, ASSERT(src->cpp == dst->cpp); if (cpp == 2) { - BR13 = (0xCC << 16) | (1 << 24); + BR13 = (0xCC << 16) | BR13_565; CMD = XY_SRC_COPY_BLT_CMD; } else { - BR13 = (0xCC << 16) | (1 << 24) | (1 << 25); + BR13 = (0xCC << 16) | BR13_8888; CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; } @@ -194,13 +194,15 @@ intelEmitFillBlit(struct intel_context *intel, switch (cpp) { case 1: + BR13 = (0xF0 << 16); + CMD = XY_COLOR_BLT_CMD; + break; case 2: - case 3: - BR13 = (0xF0 << 16) | (1 << 24); + BR13 = (0xF0 << 16) | BR13_565; CMD = XY_COLOR_BLT_CMD; break; case 4: - BR13 = (0xF0 << 16) | (1 << 24) | (1 << 25); + BR13 = (0xF0 << 16) | BR13_8888; CMD = XY_COLOR_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; break; default: @@ -335,12 +337,11 @@ intelEmitCopyBlit(struct intel_context *intel, CMD = XY_SRC_COPY_BLT_CMD; break; case 2: - case 3: - BR13 |= (1 << 24); + BR13 |= BR13_565; CMD = XY_SRC_COPY_BLT_CMD; break; case 4: - BR13 |= (1 << 24) | (1 << 25); + BR13 |= BR13_8888; CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; break; default: @@ -510,7 +511,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) /* Setup the blit command */ if (cpp == 4) { - BR13 |= (1 << 24) | (1 << 25); + BR13 |= BR13_8888; if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) { if (clearMask & BUFFER_BIT_DEPTH) CMD |= XY_BLT_WRITE_RGB; @@ -523,8 +524,8 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) } } else { - ASSERT(cpp == 2 || cpp == 0); - BR13 |= (1 << 24); + ASSERT(cpp == 2); + BR13 |= BR13_565; } #ifndef I915 -- cgit v1.2.3 From 0d9a715ceafb47872696214dea7983302323cfe1 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 27 Mar 2009 15:47:30 +0100 Subject: gl: update glext.h to version 48 --- include/GL/glext.h | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/include/GL/glext.h b/include/GL/glext.h index b24142934e9..1f0c20a9491 100644 --- a/include/GL/glext.h +++ b/include/GL/glext.h @@ -1327,6 +1327,7 @@ extern "C" { #endif #ifndef GL_ARB_instanced_arrays +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE #endif #ifndef GL_ARB_map_buffer_range @@ -1382,6 +1383,51 @@ extern "C" { #define GL_VERTEX_ARRAY_BINDING 0x85B5 #endif +#ifndef GL_ARB_uniform_buffer_object +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX_ARB 0xFFFFFFFFu +#endif + +#ifndef GL_ARB_compatibility +/* ARB_compatibility just defines tokens from core 3.0 */ +#endif + +#ifndef GL_ARB_copy_buffer +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#endif + #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif @@ -5341,6 +5387,38 @@ typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); #endif +#ifndef GL_ARB_uniform_buffer_object +#define GL_ARB_uniform_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetUniformIndices (GLuint, GLsizei, const GLchar* *, GLuint *); +GLAPI void APIENTRY glGetActiveUniformsiv (GLuint, GLsizei, const GLuint *, GLenum, GLint *); +GLAPI void APIENTRY glGetActiveUniformName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint, const GLchar *); +GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glUniformBlockBinding (GLuint, GLuint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#endif + +#ifndef GL_ARB_compatibility +#define GL_ARB_compatibility 1 +#endif + +#ifndef GL_ARB_copy_buffer +#define GL_ARB_copy_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyBufferSubData (GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif + #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #endif -- cgit v1.2.3 From a9bf5b5ccac2a75f1a2470d4910361e65b2d8eab Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 27 Mar 2009 17:51:10 +0100 Subject: gl: add new OGL 3.1 enums to glext.h This is just temporary until the upstream source is updated. --- include/GL/glext.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/GL/glext.h b/include/GL/glext.h index 1f0c20a9491..41149c935a9 100644 --- a/include/GL/glext.h +++ b/include/GL/glext.h @@ -716,6 +716,24 @@ extern "C" { /* reuse GL_VERTEX_ARRAY_BINDING */ #endif +#ifndef GL_VERSION_3_1 +#define GL_RED_SNORM 0x8F90 +#define GL_RG_SNORM 0x8F91 +#define GL_RGB_SNORM 0x8F92 +#define GL_RGBA_SNORM 0x8F93 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +#endif + #ifndef GL_ARB_multitexture #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 -- cgit v1.2.3 From c6a6cc191813e8343a17b028146a34f193a6ce44 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 27 Mar 2009 19:39:52 +0100 Subject: mesa: add new signed rgba texture format This is a (partial) backport of the signed texture format support in OGL 3.1. Since it wasn't promoted from an existing extension roll our own. --- docs/MESA_texture_signed_rgba.spec | 214 ++++++++++++++++++++++++++++++ docs/extensions.html | 1 + src/mesa/glapi/gl_API.xml | 6 + src/mesa/main/colortab.c | 2 +- src/mesa/main/convolve.c | 6 +- src/mesa/main/extensions.c | 1 + src/mesa/main/histogram.c | 2 +- src/mesa/main/image.c | 17 +-- src/mesa/main/image.h | 2 +- src/mesa/main/macros.h | 22 +++ src/mesa/main/mipmap.c | 111 ++++++++++++++-- src/mesa/main/mtypes.h | 1 + src/mesa/main/texformat.c | 44 +++++- src/mesa/main/texformat.h | 4 +- src/mesa/main/texformat_tmp.h | 22 +++ src/mesa/main/teximage.c | 13 ++ src/mesa/main/texstore.c | 127 +++++++++++++++++- src/mesa/main/texstore.h | 1 + src/mesa/state_tracker/st_cb_readpixels.c | 2 +- src/mesa/swrast/s_readpix.c | 4 +- 20 files changed, 557 insertions(+), 45 deletions(-) create mode 100644 docs/MESA_texture_signed_rgba.spec diff --git a/docs/MESA_texture_signed_rgba.spec b/docs/MESA_texture_signed_rgba.spec new file mode 100644 index 00000000000..49c8e9e5dd4 --- /dev/null +++ b/docs/MESA_texture_signed_rgba.spec @@ -0,0 +1,214 @@ +Name + + MESA_texture_signed_rgba + +Name Strings + + GL_MESA_texture_signed_rgba + +Contact + + + +Notice + + + +IP Status + + No known IP issues + +Status + + + +Version + + 0.3, 2009-03-24 + +Number + + Not assigned ? + +Dependencies + + Written based on the wording of the OpenGL 2.0 specification. + + This extension trivially interacts with ARB_texture_float. + This extension shares some language with ARB_texture_compression_rgtc + but does not depend on it. + +Overview + + OpenGL prior to 3.1 does not support any signed texture formats. + ARB_texture_compression_rgtc introduces some compressed red and + red_green signed formats but no uncompressed ones, which might + still be useful. NV_texture_shader adds signed texture formats, + but also a lot of functionality which has been superceded by fragment + shaders. + It is usually possible to get the same functionality + using a unsigned format by doing scale and bias in a shader, but this + is undesirable since modern hardware has direct support for this. + This extension adds a signed 4-channel texture format by backporting + the relevant features from OpenGL 3.1, as a means to support this in + OpenGL implementations only supporting older versions. + +Issues + + 1) What should this extension be called? + + RESOLVED: MESA_texture_signed_rgba seems reasonable. + The rgba part is there because only 4 channel format is supported. + + + 2) Should the full set of signed formats (alpha, luminance, rgb, etc.) + be supported? + + RESOLVED: NO. To keep this extension simple, only add the most + universal format, rgba. alpha/luminance can't be trivially supported + since OpenGL 3.1 does not support them any longer, and there is some + implied dependency on ARB_texture_rg for red/red_green formats so + avoid all this. Likewise, only 8 bits per channel is supported. + + + 3) Should this extension use new enums for the texture formats? + + RESOLVED: NO. Same enums as those used in OpenGL 3.1. + + + 4) How are signed integer values mapped to floating-point values? + + RESOLVED: Same as described in issue 5) of + ARB_texture_compression_rgtc (quote): + A signed 8-bit two's complement value X is computed to + a floating-point value Xf with the formula: + + { X / 127.0, X > -128 + Xf = { + { -1.0, X == -128 + + This conversion means -1, 0, and +1 are all exactly representable, + however -128 and -127 both map to -1.0. Mapping -128 to -1.0 + avoids the numerical awkwardness of have a representable value + slightly more negative than -1.0. + + This conversion is intentionally NOT the "byte" conversion listed + in Table 2.9 for component conversions. That conversion says: + + Xf = (2*X + 1) / 255.0 + + The Table 2.9 conversion is incapable of exactly representing + zero. + + (Difference to ARB_texture_compression_rgtc): + This is the same mapping as OpenGL 3.1 uses. + This is also different to what NV_texture_shader used. + The above mapping should be considered the reference, but there + is some leeway so other mappings are allowed for implementations which + cannot do this. Particulary the mapping given in NV_texture_shader or + the standard OpenGL byte/float mapping is considered acceptable too, as + might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by + 127 (that is, uses different scale factors for negative and positive + numbers). + Also, it is ok to store incoming GL_BYTE user data as-is, without + converting to GL_FLOAT (using the standard OpenGL float/byte mapping) + and converting back (using the mapping described here). + Other than those subtle issues there are no other non-standard + conversions used, so when using for instance CopyTexImage2D with + a framebuffer clamped to [0,1] all converted numbers will be in the range + [0, 127] (and not scaled and biased). + + + 5) How will signed components resulting from RGBA8_SNORM texture + fetches interact with fragment coloring? + + RESOLVED: Same as described in issue 6) of + ARB_texture_compression_rgtc (quote): + The specification language for this extension is silent + about clamping behavior leaving this to the core specification + and other extensions. The clamping or lack of clamping is left + to the core specification and other extensions. + + For assembly program extensions supporting texture fetches + (ARB_fragment_program, NV_fragment_program, NV_vertex_program3, + etc.) or the OpenGL Shading Language, these signed formats will + appear as expected with unclamped signed components as a result + of a texture fetch instruction. + + If ARB_color_buffer_float is supported, its clamping controls + will apply. + + NV_texture_shader extension, if supported, adds support for + fixed-point textures with signed components and relaxed the + fixed-function texture environment clamping appropriately. If the + NV_texture_shader extension is supported, its specified behavior + for the texture environment applies where intermediate values + are clamped to [-1,1] unless stated otherwise as in the case + of explicitly clamped to [0,1] for GL_COMBINE. or clamping the + linear interpolation weight to [0,1] for GL_DECAL and GL_BLEND. + + Otherwise, the conventional core texture environment clamps + incoming, intermediate, and output color components to [0,1]. + + This implies that the conventional texture environment + functionality of unextended OpenGL 1.5 or OpenGL 2.0 without + using GLSL (and with none of the extensions referred to above) + is unable to make proper use of the signed texture formats added + by this extension because the conventional texture environment + requires texture source colors to be clamped to [0,1]. Texture + filtering of these signed formats would be still signed, but + negative values generated post-filtering would be clamped to + zero by the core texture environment functionality. The + expectation is clearly that this extension would be co-implemented + with one of the previously referred to extensions or used with + GLSL for the new signed formats to be useful. + + + 6) Should the RGBA_SNORM tokens also be accepted by CopyTexImage + functions? + + RESOLVED: YES. + + + 7) What to do with GetTexParameter if ARB_texture_float is supported, + in particular what datatype should this return for TEXTURE_RED_TYPE_ARB, + TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB, TEXTURE_ALPHA_TYPE_ARB? + + RESOLVED: ARB_texture_float states type is either NONE, + UNSIGNED_NORMALIZED_ARB, or FLOAT. This extension adds a new enum, + SIGNED_NORMALIZED, which will be returned accordingly. This is the + same behaviour as in OpenGL 3.1. + + +New Tokens + + + Accepted by the parameter of + TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, and CopyTexImage2D: + + RGBA_SNORM 0x8F93 + RGBA8_SNORM 0x8F97 + + Returned by the parameter of GetTexLevelParameter: + + SIGNED_NORMALIZED 0x8F9C + + +Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization): + + -- Section 3.8.1, Texture Image Specification + + Add to Table 3.16 (page 154): Sized internal formats + + Sized Base R G B A L I D + Internal Format Internal Format bits bits bits bits bits bits bits + --------------- --------------- ---- ---- ---- ---- ---- ---- ---- + RGBA8_SNORM RGBA 8 8 8 8 0 0 0 + + +Dependencies on ARB_texture_float extension: + + If ARB_texture_float is supported, GetTexParameter queries with + of TEXTURE_RED_TYPE_ARB, TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB or + TEXTURE_ALPHA_TYPE_ARB return SIGNED_NORMALIZED if + the base internal format is RGBA_SNORM. diff --git a/docs/extensions.html b/docs/extensions.html index dbb8ebadaf2..91ed20e5ceb 100644 --- a/docs/extensions.html +++ b/docs/extensions.html @@ -24,6 +24,7 @@ The specifications follow.
  • MESA_resize_buffers.spec
  • MESA_set_3dfx_mode.spec
  • MESA_sprite_point.spec (obsolete) +
  • MESA_texture_signed_rgba.spec
  • MESA_trace.spec (obsolete)
  • MESA_window_pos.spec
  • MESA_ycbcr_texture.spec diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index cc3e3ae6bff..ef774f2e608 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -12326,6 +12326,12 @@ + + + + + + diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index bd9cf438b4f..b05c0513aa6 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -718,7 +718,7 @@ _mesa_GetColorTable( GLenum target, GLenum format, } _mesa_pack_rgba_span_float(ctx, table->Size, rgba, - format, type, data, &ctx->Pack, 0x0); + format, type, data, &ctx->Pack, 0x0, GL_FALSE); if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index 814c6a0a5a6..63b652bf705 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -626,7 +626,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, row, 0); GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + row * filter->Width * 4); _mesa_pack_rgba_span_float(ctx, filter->Width, src, - format, type, dst, &ctx->Pack, 0x0); + format, type, dst, &ctx->Pack, 0x0, GL_FALSE); } if (ctx->Pack.BufferObj->Name) { @@ -836,7 +836,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, format, type, 0); _mesa_pack_rgba_span_float(ctx, filter->Width, (GLfloat (*)[4]) filter->Filter, - format, type, dst, &ctx->Pack, 0x0); + format, type, dst, &ctx->Pack, 0x0, GL_FALSE); } /* Column filter */ @@ -845,7 +845,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, format, type, 0); GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + colStart); _mesa_pack_rgba_span_float(ctx, filter->Height, src, - format, type, dst, &ctx->Pack, 0x0); + format, type, dst, &ctx->Pack, 0x0, GL_FALSE); } (void) span; /* unused at this time */ diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 2d2bf517843..147d923e64f 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -150,6 +150,7 @@ static const struct { { OFF, "GL_MESA_packed_depth_stencil", F(MESA_packed_depth_stencil) }, { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, { OFF, "GL_MESA_texture_array", F(MESA_texture_array) }, + { OFF, "GL_MESA_texture_signed_rgba", F(MESA_texture_signed_rgba) }, { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, { ON, "GL_MESA_window_pos", F(ARB_window_pos) }, { OFF, "GL_NV_blend_square", F(NV_blend_square) }, diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index 905c1ad8301..febf8d99c45 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -684,7 +684,7 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F); minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F); _mesa_pack_rgba_span_float(ctx, 2, minmax, - format, type, values, &ctx->Pack, 0x0); + format, type, values, &ctx->Pack, 0x0, GL_FALSE); } if (ctx->Pack.BufferObj->Name) { diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index fa3149d56da..44972ae8e2c 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1686,24 +1686,13 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, - GLbitfield transferOps) + GLbitfield transferOps, GLboolean noClamp) { GLfloat luminance[MAX_WIDTH]; const GLint comps = _mesa_components_in_format(dstFormat); GLuint i; - /* clamping only applies to colors, not the dudv values, but still need - it if converting to unsigned values (which doesn't make much sense) */ - if (dstFormat == GL_DUDV_ATI || dstFormat == GL_DU8DV8_ATI) { - switch (dstType) { - case GL_UNSIGNED_BYTE: - case GL_UNSIGNED_SHORT: - case GL_UNSIGNED_INT: - transferOps |= IMAGE_CLAMP_BIT; - break; - /* actually might want clamp to [-1,1] otherwise but shouldn't matter? */ - } - } - else if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) { + + if ((!noClamp) && (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE)) { /* need to clamp to [0, 1] */ transferOps |= IMAGE_CLAMP_BIT; } diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h index b26c27e5a8a..fb7a5c0e903 100644 --- a/src/mesa/main/image.h +++ b/src/mesa/main/image.h @@ -178,7 +178,7 @@ extern void _mesa_pack_rgba_span_float( GLcontext *ctx, GLuint n, GLfloat rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, - GLbitfield transferOps ); + GLbitfield transferOps, GLboolean noClamp ); extern void diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index bfd740870ec..01d59dd42da 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -54,12 +54,20 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #define FLOAT_TO_BYTE(X) ( (((GLint) (255.0F * (X))) - 1) / 2 ) +/** 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)) + +/** 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)) ) + + /** Convert GLushort in [0,65535] to GLfloat in [0.0,1.0] */ #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)) + /** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */ #define SHORT_TO_FLOAT(S) ((2.0F * (S) + 1.0F) * (1.0F/65535.0F)) @@ -67,6 +75,13 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #define FLOAT_TO_SHORT(X) ( (((GLint) (65535.0F * (X))) - 1) / 2 ) +/** 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)) + +/** 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)) @@ -85,6 +100,13 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #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)) + +/** 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 BYTE_TO_UBYTE(b) ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b))) #define SHORT_TO_UBYTE(s) ((GLubyte) ((s) < 0 ? 0 : (GLubyte) ((s) >> 7))) #define USHORT_TO_UBYTE(s) ((GLubyte) ((s) >> 8)) diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 4a79430c34d..7001211a131 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -86,6 +86,21 @@ bytes_per_pixel(GLenum datatype, GLuint comps) rowD[j][e], rowD[k][e]); \ } while(0) +#define FILTER_SUM_3D_SIGNED(Aj, Ak, Bj, Bk, Cj, Ck, Dj, Dk) \ + (Aj + Ak \ + + Bj + Bk \ + + Cj + Ck \ + + Dj + Dk \ + + 4) / 8 + +#define FILTER_3D_SIGNED(e) \ + do { \ + dst[i][e] = FILTER_SUM_3D_SIGNED(rowA[j][e], rowA[k][e], \ + rowB[j][e], rowB[k][e], \ + rowC[j][e], rowC[k][e], \ + rowD[j][e], rowD[k][e]); \ + } while(0) + #define FILTER_F_3D(e) \ do { \ dst[i][e] = (rowA[j][e] + rowA[k][e] \ @@ -180,6 +195,53 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, } } + if (datatype == GL_BYTE && comps == 4) { + GLuint i, j, k; + const GLbyte(*rowA)[4] = (const GLbyte(*)[4]) srcRowA; + const GLbyte(*rowB)[4] = (const GLbyte(*)[4]) srcRowB; + GLbyte(*dst)[4] = (GLbyte(*)[4]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; + dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4; + } + } + else if (datatype == GL_BYTE && comps == 3) { + GLuint i, j, k; + const GLbyte(*rowA)[3] = (const GLbyte(*)[3]) srcRowA; + const GLbyte(*rowB)[3] = (const GLbyte(*)[3]) srcRowB; + GLbyte(*dst)[3] = (GLbyte(*)[3]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; + } + } + else if (datatype == GL_BYTE && comps == 2) { + GLuint i, j, k; + const GLbyte(*rowA)[2] = (const GLbyte(*)[2]) srcRowA; + const GLbyte(*rowB)[2] = (const GLbyte(*)[2]) srcRowB; + GLbyte(*dst)[2] = (GLbyte(*)[2]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + } + } + else if (datatype == GL_BYTE && comps == 1) { + GLuint i, j, k; + const GLbyte *rowA = (const GLbyte *) srcRowA; + const GLbyte *rowB = (const GLbyte *) srcRowB; + GLbyte *dst = (GLbyte *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; + } + } + else if (datatype == GL_UNSIGNED_SHORT && comps == 4) { GLuint i, j, k; const GLushort(*rowA)[4] = (const GLushort(*)[4]) srcRowA; @@ -470,17 +532,6 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, dst[i] = (blue << 5) | (green << 2) | red; } } - else if (datatype == GL_BYTE && comps == 2) { - GLuint i, j, k; - const GLbyte(*rowA)[2] = (const GLbyte(*)[2]) srcRowA; - const GLbyte(*rowB)[2] = (const GLbyte(*)[2]) srcRowB; - GLbyte(*dst)[2] = (GLbyte(*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2; - dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2; - } - } else { _mesa_problem(NULL, "bad format in do_row()"); } @@ -555,6 +606,44 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth, FILTER_3D(0); } } + if ((datatype == GL_BYTE) && (comps == 4)) { + DECLARE_ROW_POINTERS(GLbyte, 4); + + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + FILTER_3D_SIGNED(0); + FILTER_3D_SIGNED(1); + FILTER_3D_SIGNED(2); + FILTER_3D_SIGNED(3); + } + } + else if ((datatype == GL_BYTE) && (comps == 3)) { + DECLARE_ROW_POINTERS(GLbyte, 3); + + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + FILTER_3D_SIGNED(0); + FILTER_3D_SIGNED(1); + FILTER_3D_SIGNED(2); + } + } + else if ((datatype == GL_BYTE) && (comps == 2)) { + DECLARE_ROW_POINTERS(GLbyte, 2); + + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + FILTER_3D_SIGNED(0); + FILTER_3D_SIGNED(1); + } + } + else if ((datatype == GL_BYTE) && (comps == 1)) { + DECLARE_ROW_POINTERS(GLbyte, 1); + + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + FILTER_3D_SIGNED(0); + } + } else if ((datatype == GL_UNSIGNED_SHORT) && (comps == 4)) { DECLARE_ROW_POINTERS(GLushort, 4); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 52930094545..a5d3be3543d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2503,6 +2503,7 @@ struct gl_extensions GLboolean MESA_resize_buffers; GLboolean MESA_ycbcr_texture; GLboolean MESA_texture_array; + GLboolean MESA_texture_signed_rgba; GLboolean NV_blend_square; GLboolean NV_fragment_program; GLboolean NV_light_max_exponent; diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index c372b49398a..0ceaaf3ecec 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -699,9 +699,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = { const struct gl_texture_format _mesa_texformat_dudv8 = { MESA_FORMAT_DUDV8, /* MesaFormat */ GL_DUDV_ATI, /* BaseFormat */ - /* FIXME: spec doesn't say since that parameter didn't exist then, - but this should be something like SIGNED_NORMALIZED */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + GL_SIGNED_NORMALIZED, /* DataType */ /* maybe should add dudvBits field, but spec seems to be lacking the ability to query with GetTexLevelParameter anyway */ 0, /* RedBits */ @@ -724,6 +722,30 @@ const struct gl_texture_format _mesa_texformat_dudv8 = { NULL /* StoreTexel */ }; +const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { + MESA_FORMAT_SIGNED_RGBA8888, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_SIGNED_NORMALIZED, /* DataType */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 4, /* TexelBytes */ + _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_signed_rgba8888, /* FetchTexel1Df */ + fetch_texel_2d_signed_rgba8888, /* FetchTexel2Df */ + fetch_texel_3d_signed_rgba8888, /* FetchTexel3Df */ + store_texel_signed_rgba8888 /* StoreTexel */ +}; + /*@}*/ @@ -1671,6 +1693,17 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, } } + if (ctx->Extensions.MESA_texture_signed_rgba) { + switch (internalFormat) { + case GL_RGBA_SNORM: + case GL_RGBA8_SNORM: + return &_mesa_texformat_signed_rgba8888; + default: + ; /* fallthrough */ + } + } + + #if FEATURE_EXT_texture_sRGB if (ctx->Extensions.EXT_texture_sRGB) { switch (internalFormat) { @@ -1820,6 +1853,11 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, *comps = 2; return; + case MESA_FORMAT_SIGNED_RGBA8888: + *datatype = GL_BYTE; + *comps = 4; + return; + #if FEATURE_EXT_texture_sRGB case MESA_FORMAT_SRGB8: *datatype = GL_UNSIGNED_BYTE; diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 7fa70ad4fee..3a08339adfd 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -168,7 +168,8 @@ enum _format { * \name Signed fixed point texture formats. */ /*@{*/ - MESA_FORMAT_DUDV8 + MESA_FORMAT_DUDV8, + MESA_FORMAT_SIGNED_RGBA8888 /*@}*/ }; @@ -219,6 +220,7 @@ extern const struct gl_texture_format _mesa_texformat_intensity_float16; /** Signed fixed point texture formats */ /*@{*/ extern const struct gl_texture_format _mesa_texformat_dudv8; +extern const struct gl_texture_format _mesa_texformat_signed_rgba8888; /*@}*/ /** \name Assorted hardware-friendly formats */ diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 0f6a172ef00..604b1a744cb 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1321,6 +1321,28 @@ static void FETCH(dudv8)(const struct gl_texture_image *texImage, texel[ACOMP] = 0; } +/* MESA_FORMAT_SIGNED_ARGB8888 ***********************************************/ + +static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s >> 24) ); + texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff ); + texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 8) & 0xff ); + texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s ) & 0xff ); +} + +#if DIM == 3 +static void store_texel_signed_rgba8888(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLbyte *rgba = (const GLbyte *) texel; + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); +} +#endif + /* MESA_FORMAT_YCBCR *********************************************************/ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 4f297738df1..8c03c36c753 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -349,6 +349,15 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) } } + if (ctx->Extensions.MESA_texture_signed_rgba) { + switch (internalFormat) { + case GL_RGBA_SNORM: + case GL_RGBA8_SNORM: + return GL_RGBA; + default: + ; /* fallthrough */ + } + } if (ctx->Extensions.EXT_packed_depth_stencil) { switch (internalFormat) { @@ -502,6 +511,10 @@ _mesa_is_color_format(GLenum format) case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: #endif /* FEATURE_EXT_texture_sRGB */ return GL_TRUE; + /* signed texture formats */ + case GL_RGBA_SNORM: + case GL_RGBA8_SNORM: + return GL_TRUE; case GL_YCBCR_MESA: /* not considered to be RGB */ /* fall-through */ default: diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index cc3c6958c7d..785fb506220 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -417,7 +417,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, (GLfloat (*)[4]) src, logicalBaseFormat, GL_FLOAT, dst, &ctx->DefaultPacking, - postConvTransferOps); + postConvTransferOps, GL_FALSE); src += convWidth * 4; dst += convWidth * logComponents; } @@ -798,6 +798,7 @@ static const GLubyte * type_mapping( GLenum srcType ) { switch (srcType) { + case GL_BYTE: case GL_UNSIGNED_BYTE: return map_identity; case GL_UNSIGNED_INT_8_8_8_8: @@ -819,6 +820,7 @@ byteswap_mapping( GLboolean swapBytes, return map_identity; switch (srcType) { + case GL_BYTE: case GL_UNSIGNED_BYTE: return map_identity; case GL_UNSIGNED_INT_8_8_8_8: @@ -2561,6 +2563,99 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) return GL_TRUE; } +/** + * Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV. + */ +GLboolean +_mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) +{ + const GLboolean littleEndian = _mesa_little_endian(); + + ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888); + ASSERT(dstFormat->TexelBytes == 4); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_signed_rgba8888 && + baseInternalFormat == GL_RGBA && + ((srcFormat == GL_RGBA && srcType == GL_BYTE && !littleEndian) || + (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && littleEndian))) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else if (!ctx->_ImageTransferState && + (srcType == GL_BYTE) && + can_swizzle(baseInternalFormat) && + can_swizzle(srcFormat)) { + + GLubyte dstmap[4]; + + /* dstmap - how to swizzle from RGBA to dst format: + */ + if (littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) { + dstmap[3] = 0; + dstmap[2] = 1; + dstmap[1] = 2; + dstmap[0] = 3; + } + else { + dstmap[3] = 3; + dstmap[2] = 2; + dstmap[1] = 1; + dstmap[0] = 0; + } + + _mesa_swizzle_ubyte_image(ctx, dims, + srcFormat, + srcType, + baseInternalFormat, + dstmap, 4, + dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcAddr, + srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *srcRow = tempImage; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + for (row = 0; row < srcHeight; row++) { + GLuint *dstUI = (GLuint *) dstRow; + if (dstFormat == &_mesa_texformat_signed_rgba8888) { + for (col = 0; col < srcWidth; col++) { + dstUI[col] = PACK_COLOR_8888( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]), + FLOAT_TO_BYTE_TEX(srcRow[GCOMP]), + FLOAT_TO_BYTE_TEX(srcRow[BCOMP]), + FLOAT_TO_BYTE_TEX(srcRow[ACOMP]) ); + srcRow += 4; + } + } + dstRow += dstRowStride; + } + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} /** * Store a combined depth/stencil texture image. @@ -3820,6 +3915,21 @@ linear_to_nonlinear(GLfloat cl) #endif /* FEATURE_EXT_texture_sRGB */ +static INLINE GLboolean +type_with_negative_values(GLenum type) +{ + switch (type) { + case GL_BYTE: + case GL_SHORT: + case GL_INT: + case GL_FLOAT: + case GL_HALF_FLOAT_ARB: + return GL_TRUE; + default: + return GL_FALSE; + } +} + /** * This is the software fallback for Driver.GetTexImage(). * All error checking will have been done before this routine is called. @@ -3962,7 +4072,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, } _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, type, dest, - &ctx->Pack, transferOps /*image xfer ops*/); + &ctx->Pack, transferOps, GL_TRUE); } #endif /* FEATURE_EXT_texture_sRGB */ else { @@ -3971,10 +4081,13 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, GLint col; GLbitfield transferOps = 0x0; - if (type == GL_FLOAT && texImage->TexFormat->BaseFormat != GL_DUDV_ATI && - ((ctx->Color.ClampReadColor == GL_TRUE) || - (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB && - texImage->TexFormat->DataType != GL_FLOAT))) + /* clamp does not apply to GetTexImage (final conversion)? + Looks like we need clamp though when going from format containing + negative values to unsigned format */ + + if (!type_with_negative_values(type) && + (texImage->TexFormat->DataType == GL_FLOAT || + texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED)) transferOps |= IMAGE_CLAMP_BIT; for (col = 0; col < width; col++) { @@ -4001,7 +4114,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, } _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, type, dest, - &ctx->Pack, transferOps /*image xfer ops*/); + &ctx->Pack, transferOps, GL_TRUE); } /* format */ } /* row */ } /* img */ diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index c9e639be4e0..91cb64f377a 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -79,6 +79,7 @@ extern GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS); #endif extern GLboolean _mesa_texstore_dudv8(TEXSTORE_PARAMS); +extern GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS); extern GLchan * _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index ce7a8cda4e8..c11973cdb3d 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -486,7 +486,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, df += dfStride; if (!dfStride) { _mesa_pack_rgba_span_float(ctx, width, temp, format, type, dst, - &clippedPacking, transferOps); + &clippedPacking, transferOps, GL_FALSE); dst += dstStride; } } diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index e901fc6b5dc..524ac4ee219 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -396,7 +396,7 @@ read_rgba_pixels( GLcontext *ctx, format, type, row, 0); _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) src, format, type, dest, packing, - transferOps & IMAGE_POST_CONVOLUTION_BITS); + transferOps & IMAGE_POST_CONVOLUTION_BITS, GL_FALSE); src += width * 4; } _mesa_free(convImage); @@ -441,7 +441,7 @@ read_rgba_pixels( GLcontext *ctx, /* pack the row of RGBA pixels into user's buffer */ _mesa_pack_rgba_span_float(ctx, width, rgba, format, type, dst, - packing, transferOps); + packing, transferOps, GL_FALSE); dst += dstStride; } -- cgit v1.2.3 From 05330b9cf32788a233e7d6a3d352d4828a4afa2f Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 27 Mar 2009 21:52:07 +0100 Subject: glapi: remove a couple accidental GL_ prefixes --- src/mesa/glapi/gl_API.xml | 48 +++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index ef774f2e608..4b66793e1cf 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -5039,7 +5039,7 @@ - + @@ -5684,29 +5684,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 7d00ba195c4d8f58eec8e2ab553225a7e17ad656 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 28 Mar 2009 02:03:35 +0100 Subject: glapi regenerate --- src/mesa/main/enums.c | 6023 +++++++++++++++++++++++++------------------------ 1 file changed, 3015 insertions(+), 3008 deletions(-) diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index e63a04e915d..c077bc0a89a 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -120,6 +120,7 @@ LONGSTRING static const char enum_string_table[] = "GL_BLEND_EQUATION_ALPHA\0" "GL_BLEND_EQUATION_ALPHA_EXT\0" "GL_BLEND_EQUATION_EXT\0" + "GL_BLEND_EQUATION_RGB\0" "GL_BLEND_EQUATION_RGB_EXT\0" "GL_BLEND_SRC\0" "GL_BLEND_SRC_ALPHA\0" @@ -297,6 +298,10 @@ LONGSTRING static const char enum_string_table[] = "GL_COMPRESSED_RGB_ARB\0" "GL_COMPRESSED_RGB_FXT1_3DFX\0" "GL_COMPRESSED_RGB_S3TC_DXT1_EXT\0" + "GL_COMPRESSED_SLUMINANCE\0" + "GL_COMPRESSED_SLUMINANCE_ALPHA\0" + "GL_COMPRESSED_SRGB\0" + "GL_COMPRESSED_SRGB_ALPHA\0" "GL_COMPRESSED_TEXTURE_FORMATS\0" "GL_CONSTANT\0" "GL_CONSTANT_ALPHA\0" @@ -355,6 +360,7 @@ LONGSTRING static const char enum_string_table[] = "GL_CURRENT_RASTER_INDEX\0" "GL_CURRENT_RASTER_POSITION\0" "GL_CURRENT_RASTER_POSITION_VALID\0" + "GL_CURRENT_RASTER_SECONDARY_COLOR\0" "GL_CURRENT_RASTER_TEXTURE_COORDS\0" "GL_CURRENT_SECONDARY_COLOR\0" "GL_CURRENT_TEXTURE_COORDS\0" @@ -510,10 +516,16 @@ LONGSTRING static const char enum_string_table[] = "GL_FLOAT\0" "GL_FLOAT_MAT2\0" "GL_FLOAT_MAT2_ARB\0" + "GL_FLOAT_MAT2x3\0" + "GL_FLOAT_MAT2x4\0" "GL_FLOAT_MAT3\0" "GL_FLOAT_MAT3_ARB\0" + "GL_FLOAT_MAT3x2\0" + "GL_FLOAT_MAT3x4\0" "GL_FLOAT_MAT4\0" "GL_FLOAT_MAT4_ARB\0" + "GL_FLOAT_MAT4x2\0" + "GL_FLOAT_MAT4x3\0" "GL_FLOAT_VEC2\0" "GL_FLOAT_VEC2_ARB\0" "GL_FLOAT_VEC3\0" @@ -607,30 +619,6 @@ LONGSTRING static const char enum_string_table[] = "GL_GENERATE_MIPMAP_HINT_SGIS\0" "GL_GENERATE_MIPMAP_SGIS\0" "GL_GEQUAL\0" - "GL_GL_BLEND_EQUATION_RGB\0" - "GL_GL_COMPRESSED_SLUMINANCE\0" - "GL_GL_COMPRESSED_SLUMINANCE_ALPHA\0" - "GL_GL_COMPRESSED_SRGB\0" - "GL_GL_COMPRESSED_SRGB_ALPHA\0" - "GL_GL_CURRENT_RASTER_SECONDARY_COLOR\0" - "GL_GL_FLOAT_MAT2x3\0" - "GL_GL_FLOAT_MAT2x4\0" - "GL_GL_FLOAT_MAT3x2\0" - "GL_GL_FLOAT_MAT3x4\0" - "GL_GL_FLOAT_MAT4x2\0" - "GL_GL_FLOAT_MAT4x3\0" - "GL_GL_PIXEL_PACK_BUFFER\0" - "GL_GL_PIXEL_PACK_BUFFER_BINDING\0" - "GL_GL_PIXEL_UNPACK_BUFFER\0" - "GL_GL_PIXEL_UNPACK_BUFFER_BINDING\0" - "GL_GL_SLUMINANCE\0" - "GL_GL_SLUMINANCE8\0" - "GL_GL_SLUMINANCE8_ALPHA8\0" - "GL_GL_SLUMINANCE_ALPHA\0" - "GL_GL_SRGB\0" - "GL_GL_SRGB8\0" - "GL_GL_SRGB8_ALPHA8\0" - "GL_GL_SRGB_ALPHA\0" "GL_GREATER\0" "GL_GREEN\0" "GL_GREEN_BIAS\0" @@ -1152,8 +1140,12 @@ LONGSTRING static const char enum_string_table[] = "GL_PIXEL_MAP_S_TO_S\0" "GL_PIXEL_MAP_S_TO_S_SIZE\0" "GL_PIXEL_MODE_BIT\0" + "GL_PIXEL_PACK_BUFFER\0" + "GL_PIXEL_PACK_BUFFER_BINDING\0" "GL_PIXEL_PACK_BUFFER_BINDING_EXT\0" "GL_PIXEL_PACK_BUFFER_EXT\0" + "GL_PIXEL_UNPACK_BUFFER\0" + "GL_PIXEL_UNPACK_BUFFER_BINDING\0" "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT\0" "GL_PIXEL_UNPACK_BUFFER_EXT\0" "GL_POINT\0" @@ -1385,9 +1377,11 @@ LONGSTRING static const char enum_string_table[] = "GL_RGBA4_S3TC\0" "GL_RGBA8\0" "GL_RGBA8_EXT\0" + "GL_RGBA8_SNORM\0" "GL_RGBA_DXT5_S3TC\0" "GL_RGBA_MODE\0" "GL_RGBA_S3TC\0" + "GL_RGBA_SNORM\0" "GL_RGB_S3TC\0" "GL_RGB_SCALE\0" "GL_RGB_SCALE_ARB\0" @@ -1444,9 +1438,14 @@ LONGSTRING static const char enum_string_table[] = "GL_SHARED_TEXTURE_PALETTE_EXT\0" "GL_SHININESS\0" "GL_SHORT\0" + "GL_SIGNED_NORMALIZED\0" "GL_SINGLE_COLOR\0" "GL_SINGLE_COLOR_EXT\0" "GL_SLICE_ACCUM_SUN\0" + "GL_SLUMINANCE\0" + "GL_SLUMINANCE8\0" + "GL_SLUMINANCE8_ALPHA8\0" + "GL_SLUMINANCE_ALPHA\0" "GL_SMOOTH\0" "GL_SMOOTH_LINE_WIDTH_GRANULARITY\0" "GL_SMOOTH_LINE_WIDTH_RANGE\0" @@ -1487,6 +1486,9 @@ LONGSTRING static const char enum_string_table[] = "GL_SRC_ALPHA_SATURATE\0" "GL_SRC_COLOR\0" "GL_SRGB\0" + "GL_SRGB8\0" + "GL_SRGB8_ALPHA8\0" + "GL_SRGB_ALPHA\0" "GL_STACK_OVERFLOW\0" "GL_STACK_UNDERFLOW\0" "GL_STATIC_COPY\0" @@ -1856,7 +1858,7 @@ LONGSTRING static const char enum_string_table[] = "GL_ZOOM_Y\0" ; -static const enum_elt all_enums[1818] = +static const enum_elt all_enums[1820] = { { 0, 0x00000600 }, /* GL_2D */ { 6, 0x00001407 }, /* GL_2_BYTES */ @@ -1942,3059 +1944,3064 @@ static const enum_elt all_enums[1818] = { 1320, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA */ { 1344, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_EXT */ { 1372, 0x00008009 }, /* GL_BLEND_EQUATION_EXT */ - { 1394, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */ - { 1420, 0x00000BE1 }, /* GL_BLEND_SRC */ - { 1433, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */ - { 1452, 0x000080C9 }, /* GL_BLEND_SRC_RGB */ - { 1469, 0x00001905 }, /* GL_BLUE */ - { 1477, 0x00000D1B }, /* GL_BLUE_BIAS */ - { 1490, 0x00000D54 }, /* GL_BLUE_BITS */ - { 1503, 0x00000D1A }, /* GL_BLUE_SCALE */ - { 1517, 0x00008B56 }, /* GL_BOOL */ - { 1525, 0x00008B56 }, /* GL_BOOL_ARB */ - { 1537, 0x00008B57 }, /* GL_BOOL_VEC2 */ - { 1550, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */ - { 1567, 0x00008B58 }, /* GL_BOOL_VEC3 */ - { 1580, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */ - { 1597, 0x00008B59 }, /* GL_BOOL_VEC4 */ - { 1610, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */ - { 1627, 0x000088BB }, /* GL_BUFFER_ACCESS */ - { 1644, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */ - { 1665, 0x000088BC }, /* GL_BUFFER_MAPPED */ - { 1682, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */ - { 1703, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */ - { 1725, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */ - { 1751, 0x00008764 }, /* GL_BUFFER_SIZE */ - { 1766, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */ - { 1785, 0x00008765 }, /* GL_BUFFER_USAGE */ - { 1801, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */ - { 1821, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */ - { 1840, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */ - { 1866, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */ - { 1889, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ - { 1917, 0x0000877C }, /* GL_BUMP_TARGET_ATI */ - { 1936, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */ - { 1958, 0x00001400 }, /* GL_BYTE */ - { 1966, 0x00002A24 }, /* GL_C3F_V3F */ - { 1977, 0x00002A26 }, /* GL_C4F_N3F_V3F */ - { 1992, 0x00002A22 }, /* GL_C4UB_V2F */ - { 2004, 0x00002A23 }, /* GL_C4UB_V3F */ - { 2016, 0x00000901 }, /* GL_CCW */ - { 2023, 0x00002900 }, /* GL_CLAMP */ - { 2032, 0x0000812D }, /* GL_CLAMP_TO_BORDER */ - { 2051, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */ - { 2074, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */ - { 2098, 0x0000812F }, /* GL_CLAMP_TO_EDGE */ - { 2115, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */ - { 2137, 0x00001500 }, /* GL_CLEAR */ - { 2146, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */ - { 2171, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */ - { 2200, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */ - { 2226, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ - { 2255, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */ - { 2281, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */ - { 2308, 0x00003000 }, /* GL_CLIP_PLANE0 */ - { 2323, 0x00003001 }, /* GL_CLIP_PLANE1 */ - { 2338, 0x00003002 }, /* GL_CLIP_PLANE2 */ - { 2353, 0x00003003 }, /* GL_CLIP_PLANE3 */ - { 2368, 0x00003004 }, /* GL_CLIP_PLANE4 */ - { 2383, 0x00003005 }, /* GL_CLIP_PLANE5 */ - { 2398, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - { 2431, 0x00000A00 }, /* GL_COEFF */ - { 2440, 0x00001800 }, /* GL_COLOR */ - { 2449, 0x00008076 }, /* GL_COLOR_ARRAY */ - { 2464, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - { 2494, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 2528, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */ - { 2551, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */ - { 2571, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */ - { 2593, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */ - { 2613, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */ - { 2634, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */ - { 2659, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */ - { 2680, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */ - { 2702, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */ - { 2728, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */ - { 2750, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */ - { 2776, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */ - { 2798, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */ - { 2824, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */ - { 2846, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */ - { 2872, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */ - { 2894, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */ - { 2920, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */ - { 2942, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */ - { 2968, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */ - { 2993, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */ - { 3014, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */ - { 3039, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */ - { 3060, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */ - { 3085, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */ - { 3106, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */ - { 3131, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */ - { 3152, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */ - { 3177, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */ - { 3198, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */ - { 3223, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */ - { 3244, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */ - { 3269, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */ - { 3290, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */ - { 3315, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */ - { 3336, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */ - { 3361, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */ - { 3381, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */ - { 3402, 0x00001900 }, /* GL_COLOR_INDEX */ - { 3417, 0x00001603 }, /* GL_COLOR_INDEXES */ - { 3434, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */ - { 3452, 0x00000B57 }, /* GL_COLOR_MATERIAL */ - { 3470, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */ - { 3493, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */ - { 3521, 0x000080B1 }, /* GL_COLOR_MATRIX */ - { 3537, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */ - { 3557, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */ - { 3585, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 3617, 0x00008458 }, /* GL_COLOR_SUM */ - { 3630, 0x00008458 }, /* GL_COLOR_SUM_ARB */ - { 3647, 0x000080D0 }, /* GL_COLOR_TABLE */ - { 3662, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */ - { 3688, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */ - { 3718, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */ - { 3748, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */ - { 3768, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */ - { 3792, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */ - { 3817, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */ - { 3846, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */ - { 3875, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */ - { 3897, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */ - { 3923, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */ - { 3949, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */ - { 3975, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */ - { 4005, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */ - { 4035, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */ - { 4065, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */ - { 4099, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */ - { 4133, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ - { 4163, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */ - { 4197, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */ - { 4231, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */ - { 4255, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */ - { 4283, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */ - { 4311, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */ - { 4332, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */ - { 4357, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */ - { 4378, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */ - { 4403, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */ - { 4428, 0x00000C23 }, /* GL_COLOR_WRITEMASK */ - { 4447, 0x00008570 }, /* GL_COMBINE */ - { 4458, 0x00008503 }, /* GL_COMBINE4 */ - { 4470, 0x00008572 }, /* GL_COMBINE_ALPHA */ - { 4487, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */ - { 4508, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */ - { 4529, 0x00008570 }, /* GL_COMBINE_ARB */ - { 4544, 0x00008570 }, /* GL_COMBINE_EXT */ - { 4559, 0x00008571 }, /* GL_COMBINE_RGB */ - { 4574, 0x00008571 }, /* GL_COMBINE_RGB_ARB */ - { 4593, 0x00008571 }, /* GL_COMBINE_RGB_EXT */ - { 4612, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */ - { 4648, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */ - { 4672, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */ - { 4700, 0x00001300 }, /* GL_COMPILE */ - { 4711, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */ - { 4734, 0x00008B81 }, /* GL_COMPILE_STATUS */ - { 4752, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */ - { 4772, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */ - { 4796, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */ - { 4820, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */ - { 4848, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */ - { 4872, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */ - { 4902, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */ - { 4936, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */ - { 4964, 0x000084ED }, /* GL_COMPRESSED_RGB */ - { 4982, 0x000084EE }, /* GL_COMPRESSED_RGBA */ - { 5001, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */ - { 5024, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - { 5053, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ - { 5086, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ - { 5119, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - { 5152, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */ - { 5174, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */ - { 5202, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ - { 5234, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */ - { 5264, 0x00008576 }, /* GL_CONSTANT */ - { 5276, 0x00008003 }, /* GL_CONSTANT_ALPHA */ - { 5294, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */ - { 5316, 0x00008576 }, /* GL_CONSTANT_ARB */ - { 5332, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */ - { 5356, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */ - { 5378, 0x00008001 }, /* GL_CONSTANT_COLOR */ - { 5396, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */ - { 5418, 0x00008576 }, /* GL_CONSTANT_EXT */ - { 5434, 0x00008010 }, /* GL_CONVOLUTION_1D */ - { 5452, 0x00008011 }, /* GL_CONVOLUTION_2D */ - { 5470, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */ - { 5498, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */ - { 5529, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */ - { 5556, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */ - { 5587, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */ - { 5614, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */ - { 5645, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */ - { 5673, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */ - { 5705, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */ - { 5727, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */ - { 5753, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */ - { 5775, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */ - { 5801, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */ - { 5822, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */ - { 5847, 0x00008862 }, /* GL_COORD_REPLACE */ - { 5864, 0x00008862 }, /* GL_COORD_REPLACE_ARB */ - { 5885, 0x00008862 }, /* GL_COORD_REPLACE_NV */ - { 5905, 0x00001503 }, /* GL_COPY */ - { 5913, 0x0000150C }, /* GL_COPY_INVERTED */ - { 5930, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */ - { 5950, 0x00000B44 }, /* GL_CULL_FACE */ - { 5963, 0x00000B45 }, /* GL_CULL_FACE_MODE */ - { 5981, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ - { 6000, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - { 6032, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ - { 6067, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ - { 6088, 0x00000001 }, /* GL_CURRENT_BIT */ - { 6103, 0x00000B00 }, /* GL_CURRENT_COLOR */ - { 6120, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ - { 6141, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ - { 6167, 0x00000B01 }, /* GL_CURRENT_INDEX */ - { 6184, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ - { 6206, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ - { 6234, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ - { 6255, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ - { 6289, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ - { 6322, 0x00000B02 }, /* GL_CURRENT_NORMAL */ - { 6340, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - { 6370, 0x00008B8D }, /* GL_CURRENT_PROGRAM */ - { 6389, 0x00008865 }, /* GL_CURRENT_QUERY */ - { 6406, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ - { 6427, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ - { 6451, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ - { 6478, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ - { 6502, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ - { 6529, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ - { 6562, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ - { 6595, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ - { 6622, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ - { 6648, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */ - { 6673, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ - { 6702, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ - { 6724, 0x00000900 }, /* GL_CW */ - { 6730, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */ - { 6751, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */ - { 6772, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */ - { 6792, 0x00002101 }, /* GL_DECAL */ - { 6801, 0x00001E03 }, /* GL_DECR */ - { 6809, 0x00008508 }, /* GL_DECR_WRAP */ - { 6822, 0x00008508 }, /* GL_DECR_WRAP_EXT */ - { 6839, 0x00008B80 }, /* GL_DELETE_STATUS */ - { 6856, 0x00001801 }, /* GL_DEPTH */ - { 6865, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */ - { 6885, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ - { 6905, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ - { 6929, 0x00000D1F }, /* GL_DEPTH_BIAS */ - { 6943, 0x00000D56 }, /* GL_DEPTH_BITS */ - { 6957, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ - { 6977, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ - { 7002, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ - { 7022, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ - { 7040, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ - { 7061, 0x00001902 }, /* GL_DEPTH_COMPONENT */ - { 7080, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ - { 7101, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ - { 7126, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ - { 7152, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ - { 7173, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ - { 7198, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ - { 7224, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ - { 7245, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ - { 7270, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ - { 7296, 0x00000B74 }, /* GL_DEPTH_FUNC */ - { 7310, 0x00000B70 }, /* GL_DEPTH_RANGE */ - { 7325, 0x00000D1E }, /* GL_DEPTH_SCALE */ - { 7340, 0x000084F9 }, /* GL_DEPTH_STENCIL */ - { 7357, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ - { 7385, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ - { 7405, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - { 7433, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - { 7461, 0x00000B71 }, /* GL_DEPTH_TEST */ - { 7475, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ - { 7497, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ - { 7523, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ - { 7542, 0x00001201 }, /* GL_DIFFUSE */ - { 7553, 0x00000BD0 }, /* GL_DITHER */ - { 7563, 0x00000A02 }, /* GL_DOMAIN */ - { 7573, 0x00001100 }, /* GL_DONT_CARE */ - { 7586, 0x000086AE }, /* GL_DOT3_RGB */ - { 7598, 0x000086AF }, /* GL_DOT3_RGBA */ - { 7611, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ - { 7628, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ - { 7645, 0x000086AE }, /* GL_DOT3_RGB_ARB */ - { 7661, 0x00008740 }, /* GL_DOT3_RGB_EXT */ - { 7677, 0x0000140A }, /* GL_DOUBLE */ - { 7687, 0x00000C32 }, /* GL_DOUBLEBUFFER */ - { 7703, 0x00000C01 }, /* GL_DRAW_BUFFER */ - { 7718, 0x00008825 }, /* GL_DRAW_BUFFER0 */ - { 7734, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ - { 7754, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ - { 7774, 0x00008826 }, /* GL_DRAW_BUFFER1 */ - { 7790, 0x0000882F }, /* GL_DRAW_BUFFER10 */ - { 7807, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ - { 7828, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ - { 7849, 0x00008830 }, /* GL_DRAW_BUFFER11 */ - { 7866, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ - { 7887, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ - { 7908, 0x00008831 }, /* GL_DRAW_BUFFER12 */ - { 7925, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ - { 7946, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ - { 7967, 0x00008832 }, /* GL_DRAW_BUFFER13 */ - { 7984, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ - { 8005, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ - { 8026, 0x00008833 }, /* GL_DRAW_BUFFER14 */ - { 8043, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ - { 8064, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ - { 8085, 0x00008834 }, /* GL_DRAW_BUFFER15 */ - { 8102, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ - { 8123, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ - { 8144, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ - { 8164, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ - { 8184, 0x00008827 }, /* GL_DRAW_BUFFER2 */ - { 8200, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ - { 8220, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ - { 8240, 0x00008828 }, /* GL_DRAW_BUFFER3 */ - { 8256, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ - { 8276, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ - { 8296, 0x00008829 }, /* GL_DRAW_BUFFER4 */ - { 8312, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ - { 8332, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ - { 8352, 0x0000882A }, /* GL_DRAW_BUFFER5 */ - { 8368, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ - { 8388, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ - { 8408, 0x0000882B }, /* GL_DRAW_BUFFER6 */ - { 8424, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ - { 8444, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ - { 8464, 0x0000882C }, /* GL_DRAW_BUFFER7 */ - { 8480, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ - { 8500, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ - { 8520, 0x0000882D }, /* GL_DRAW_BUFFER8 */ - { 8536, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ - { 8556, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ - { 8576, 0x0000882E }, /* GL_DRAW_BUFFER9 */ - { 8592, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ - { 8612, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ - { 8632, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ - { 8652, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - { 8684, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ - { 8708, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ - { 8728, 0x00000304 }, /* GL_DST_ALPHA */ - { 8741, 0x00000306 }, /* GL_DST_COLOR */ - { 8754, 0x0000877A }, /* GL_DU8DV8_ATI */ - { 8768, 0x00008779 }, /* GL_DUDV_ATI */ - { 8780, 0x000088EA }, /* GL_DYNAMIC_COPY */ - { 8796, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ - { 8816, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ - { 8832, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ - { 8852, 0x000088E9 }, /* GL_DYNAMIC_READ */ - { 8868, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ - { 8888, 0x00000B43 }, /* GL_EDGE_FLAG */ - { 8901, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ - { 8920, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - { 8954, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ - { 8992, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ - { 9019, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - { 9045, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ - { 9069, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - { 9101, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ - { 9137, 0x00001600 }, /* GL_EMISSION */ - { 9149, 0x00002000 }, /* GL_ENABLE_BIT */ - { 9163, 0x00000202 }, /* GL_EQUAL */ - { 9172, 0x00001509 }, /* GL_EQUIV */ - { 9181, 0x00010000 }, /* GL_EVAL_BIT */ - { 9193, 0x00000800 }, /* GL_EXP */ - { 9200, 0x00000801 }, /* GL_EXP2 */ - { 9208, 0x00001F03 }, /* GL_EXTENSIONS */ - { 9222, 0x00002400 }, /* GL_EYE_LINEAR */ - { 9236, 0x00002502 }, /* GL_EYE_PLANE */ - { 9249, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ - { 9274, 0x0000855B }, /* GL_EYE_RADIAL_NV */ - { 9291, 0x00000000 }, /* GL_FALSE */ - { 9300, 0x00001101 }, /* GL_FASTEST */ - { 9311, 0x00001C01 }, /* GL_FEEDBACK */ - { 9323, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ - { 9350, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ - { 9374, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ - { 9398, 0x00001B02 }, /* GL_FILL */ - { 9406, 0x00001D00 }, /* GL_FLAT */ - { 9414, 0x00001406 }, /* GL_FLOAT */ - { 9423, 0x00008B5A }, /* GL_FLOAT_MAT2 */ - { 9437, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ - { 9455, 0x00008B5B }, /* GL_FLOAT_MAT3 */ - { 9469, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ - { 9487, 0x00008B5C }, /* GL_FLOAT_MAT4 */ - { 9501, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ - { 9519, 0x00008B50 }, /* GL_FLOAT_VEC2 */ - { 9533, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ - { 9551, 0x00008B51 }, /* GL_FLOAT_VEC3 */ - { 9565, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ - { 9583, 0x00008B52 }, /* GL_FLOAT_VEC4 */ - { 9597, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ - { 9615, 0x00000B60 }, /* GL_FOG */ - { 9622, 0x00000080 }, /* GL_FOG_BIT */ - { 9633, 0x00000B66 }, /* GL_FOG_COLOR */ - { 9646, 0x00008451 }, /* GL_FOG_COORD */ - { 9659, 0x00008451 }, /* GL_FOG_COORDINATE */ - { 9677, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ - { 9701, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - { 9740, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ - { 9783, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - { 9815, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - { 9846, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - { 9875, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ - { 9900, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ - { 9919, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ - { 9953, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ - { 9980, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ - { 10006, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ - { 10030, 0x00008450 }, /* GL_FOG_COORD_SRC */ - { 10047, 0x00000B62 }, /* GL_FOG_DENSITY */ - { 10062, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ - { 10086, 0x00000B64 }, /* GL_FOG_END */ - { 10097, 0x00000C54 }, /* GL_FOG_HINT */ - { 10109, 0x00000B61 }, /* GL_FOG_INDEX */ - { 10122, 0x00000B65 }, /* GL_FOG_MODE */ - { 10134, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ - { 10153, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ - { 10178, 0x00000B63 }, /* GL_FOG_START */ - { 10191, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ - { 10209, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ - { 10233, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ - { 10252, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ - { 10275, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - { 10310, 0x00008D40 }, /* GL_FRAMEBUFFER */ - { 10325, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - { 10362, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - { 10398, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - { 10439, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - { 10480, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - { 10517, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - { 10554, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - { 10592, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ - { 10634, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - { 10672, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ - { 10714, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - { 10749, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - { 10788, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ - { 10837, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - { 10885, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ - { 10937, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - { 10977, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ - { 11021, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - { 11061, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ - { 11105, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ - { 11132, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ - { 11156, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ - { 11184, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ - { 11207, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ - { 11226, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - { 11263, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ - { 11304, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - { 11345, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - { 11387, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - { 11438, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - { 11476, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - { 11521, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ - { 11570, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - { 11608, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - { 11650, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - { 11682, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ - { 11707, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ - { 11734, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ - { 11765, 0x00000404 }, /* GL_FRONT */ - { 11774, 0x00000408 }, /* GL_FRONT_AND_BACK */ - { 11792, 0x00000B46 }, /* GL_FRONT_FACE */ - { 11806, 0x00000400 }, /* GL_FRONT_LEFT */ - { 11820, 0x00000401 }, /* GL_FRONT_RIGHT */ - { 11835, 0x00008006 }, /* GL_FUNC_ADD */ - { 11847, 0x00008006 }, /* GL_FUNC_ADD_EXT */ - { 11863, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ - { 11888, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ - { 11917, 0x0000800A }, /* GL_FUNC_SUBTRACT */ - { 11934, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ - { 11955, 0x00008191 }, /* GL_GENERATE_MIPMAP */ - { 11974, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ - { 11998, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ - { 12027, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ - { 12051, 0x00000206 }, /* GL_GEQUAL */ - { 12061, 0x00008009 }, /* GL_GL_BLEND_EQUATION_RGB */ - { 12086, 0x00008C4A }, /* GL_GL_COMPRESSED_SLUMINANCE */ - { 12114, 0x00008C4B }, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */ - { 12148, 0x00008C48 }, /* GL_GL_COMPRESSED_SRGB */ - { 12170, 0x00008C49 }, /* GL_GL_COMPRESSED_SRGB_ALPHA */ - { 12198, 0x0000845F }, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */ - { 12235, 0x00008B65 }, /* GL_GL_FLOAT_MAT2x3 */ - { 12254, 0x00008B66 }, /* GL_GL_FLOAT_MAT2x4 */ - { 12273, 0x00008B67 }, /* GL_GL_FLOAT_MAT3x2 */ - { 12292, 0x00008B68 }, /* GL_GL_FLOAT_MAT3x4 */ - { 12311, 0x00008B69 }, /* GL_GL_FLOAT_MAT4x2 */ - { 12330, 0x00008B6A }, /* GL_GL_FLOAT_MAT4x3 */ - { 12349, 0x000088EB }, /* GL_GL_PIXEL_PACK_BUFFER */ - { 12373, 0x000088ED }, /* GL_GL_PIXEL_PACK_BUFFER_BINDING */ - { 12405, 0x000088EC }, /* GL_GL_PIXEL_UNPACK_BUFFER */ - { 12431, 0x000088EF }, /* GL_GL_PIXEL_UNPACK_BUFFER_BINDING */ - { 12465, 0x00008C46 }, /* GL_GL_SLUMINANCE */ - { 12482, 0x00008C47 }, /* GL_GL_SLUMINANCE8 */ - { 12500, 0x00008C45 }, /* GL_GL_SLUMINANCE8_ALPHA8 */ - { 12525, 0x00008C44 }, /* GL_GL_SLUMINANCE_ALPHA */ - { 12548, 0x00008C40 }, /* GL_GL_SRGB */ - { 12559, 0x00008C41 }, /* GL_GL_SRGB8 */ - { 12571, 0x00008C43 }, /* GL_GL_SRGB8_ALPHA8 */ - { 12590, 0x00008C42 }, /* GL_GL_SRGB_ALPHA */ - { 12607, 0x00000204 }, /* GL_GREATER */ - { 12618, 0x00001904 }, /* GL_GREEN */ - { 12627, 0x00000D19 }, /* GL_GREEN_BIAS */ - { 12641, 0x00000D53 }, /* GL_GREEN_BITS */ - { 12655, 0x00000D18 }, /* GL_GREEN_SCALE */ - { 12670, 0x00008000 }, /* GL_HINT_BIT */ - { 12682, 0x00008024 }, /* GL_HISTOGRAM */ - { 12695, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ - { 12719, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ - { 12747, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ - { 12770, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ - { 12797, 0x00008024 }, /* GL_HISTOGRAM_EXT */ - { 12814, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ - { 12834, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ - { 12858, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ - { 12882, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ - { 12910, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - { 12938, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ - { 12970, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ - { 12992, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ - { 13018, 0x0000802D }, /* GL_HISTOGRAM_SINK */ - { 13036, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ - { 13058, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ - { 13077, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ - { 13100, 0x0000862A }, /* GL_IDENTITY_NV */ - { 13115, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ - { 13135, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - { 13175, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - { 13213, 0x00001E02 }, /* GL_INCR */ - { 13221, 0x00008507 }, /* GL_INCR_WRAP */ - { 13234, 0x00008507 }, /* GL_INCR_WRAP_EXT */ - { 13251, 0x00008222 }, /* GL_INDEX */ - { 13260, 0x00008077 }, /* GL_INDEX_ARRAY */ - { 13275, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - { 13305, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ - { 13339, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ - { 13362, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ - { 13384, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ - { 13404, 0x00000D51 }, /* GL_INDEX_BITS */ - { 13418, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ - { 13439, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ - { 13457, 0x00000C30 }, /* GL_INDEX_MODE */ - { 13471, 0x00000D13 }, /* GL_INDEX_OFFSET */ - { 13487, 0x00000D12 }, /* GL_INDEX_SHIFT */ - { 13502, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ - { 13521, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ - { 13540, 0x00001404 }, /* GL_INT */ - { 13547, 0x00008049 }, /* GL_INTENSITY */ - { 13560, 0x0000804C }, /* GL_INTENSITY12 */ - { 13575, 0x0000804C }, /* GL_INTENSITY12_EXT */ - { 13594, 0x0000804D }, /* GL_INTENSITY16 */ - { 13609, 0x0000804D }, /* GL_INTENSITY16_EXT */ - { 13628, 0x0000804A }, /* GL_INTENSITY4 */ - { 13642, 0x0000804A }, /* GL_INTENSITY4_EXT */ - { 13660, 0x0000804B }, /* GL_INTENSITY8 */ - { 13674, 0x0000804B }, /* GL_INTENSITY8_EXT */ - { 13692, 0x00008049 }, /* GL_INTENSITY_EXT */ - { 13709, 0x00008575 }, /* GL_INTERPOLATE */ - { 13724, 0x00008575 }, /* GL_INTERPOLATE_ARB */ - { 13743, 0x00008575 }, /* GL_INTERPOLATE_EXT */ - { 13762, 0x00008B53 }, /* GL_INT_VEC2 */ - { 13774, 0x00008B53 }, /* GL_INT_VEC2_ARB */ - { 13790, 0x00008B54 }, /* GL_INT_VEC3 */ - { 13802, 0x00008B54 }, /* GL_INT_VEC3_ARB */ - { 13818, 0x00008B55 }, /* GL_INT_VEC4 */ - { 13830, 0x00008B55 }, /* GL_INT_VEC4_ARB */ - { 13846, 0x00000500 }, /* GL_INVALID_ENUM */ - { 13862, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ - { 13895, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ - { 13932, 0x00000502 }, /* GL_INVALID_OPERATION */ - { 13953, 0x00000501 }, /* GL_INVALID_VALUE */ - { 13970, 0x0000862B }, /* GL_INVERSE_NV */ - { 13984, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ - { 14008, 0x0000150A }, /* GL_INVERT */ - { 14018, 0x00001E00 }, /* GL_KEEP */ - { 14026, 0x00000406 }, /* GL_LEFT */ - { 14034, 0x00000203 }, /* GL_LEQUAL */ - { 14044, 0x00000201 }, /* GL_LESS */ - { 14052, 0x00004000 }, /* GL_LIGHT0 */ - { 14062, 0x00004001 }, /* GL_LIGHT1 */ - { 14072, 0x00004002 }, /* GL_LIGHT2 */ - { 14082, 0x00004003 }, /* GL_LIGHT3 */ - { 14092, 0x00004004 }, /* GL_LIGHT4 */ - { 14102, 0x00004005 }, /* GL_LIGHT5 */ - { 14112, 0x00004006 }, /* GL_LIGHT6 */ - { 14122, 0x00004007 }, /* GL_LIGHT7 */ - { 14132, 0x00000B50 }, /* GL_LIGHTING */ - { 14144, 0x00000040 }, /* GL_LIGHTING_BIT */ - { 14160, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ - { 14183, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - { 14212, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ - { 14245, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - { 14273, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ - { 14297, 0x00001B01 }, /* GL_LINE */ - { 14305, 0x00002601 }, /* GL_LINEAR */ - { 14315, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ - { 14337, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - { 14367, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - { 14398, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ - { 14422, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ - { 14447, 0x00000001 }, /* GL_LINES */ - { 14456, 0x00000004 }, /* GL_LINE_BIT */ - { 14468, 0x00000002 }, /* GL_LINE_LOOP */ - { 14481, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ - { 14501, 0x00000B20 }, /* GL_LINE_SMOOTH */ - { 14516, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ - { 14536, 0x00000B24 }, /* GL_LINE_STIPPLE */ - { 14552, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ - { 14576, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ - { 14599, 0x00000003 }, /* GL_LINE_STRIP */ - { 14613, 0x00000702 }, /* GL_LINE_TOKEN */ - { 14627, 0x00000B21 }, /* GL_LINE_WIDTH */ - { 14641, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ - { 14667, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ - { 14687, 0x00008B82 }, /* GL_LINK_STATUS */ - { 14702, 0x00000B32 }, /* GL_LIST_BASE */ - { 14715, 0x00020000 }, /* GL_LIST_BIT */ - { 14727, 0x00000B33 }, /* GL_LIST_INDEX */ - { 14741, 0x00000B30 }, /* GL_LIST_MODE */ - { 14754, 0x00000101 }, /* GL_LOAD */ - { 14762, 0x00000BF1 }, /* GL_LOGIC_OP */ - { 14774, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ - { 14791, 0x00008CA1 }, /* GL_LOWER_LEFT */ - { 14805, 0x00001909 }, /* GL_LUMINANCE */ - { 14818, 0x00008041 }, /* GL_LUMINANCE12 */ - { 14833, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ - { 14856, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ - { 14883, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ - { 14905, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ - { 14931, 0x00008041 }, /* GL_LUMINANCE12_EXT */ - { 14950, 0x00008042 }, /* GL_LUMINANCE16 */ - { 14965, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ - { 14988, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ - { 15015, 0x00008042 }, /* GL_LUMINANCE16_EXT */ - { 15034, 0x0000803F }, /* GL_LUMINANCE4 */ - { 15048, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ - { 15069, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ - { 15094, 0x0000803F }, /* GL_LUMINANCE4_EXT */ - { 15112, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ - { 15133, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ - { 15158, 0x00008040 }, /* GL_LUMINANCE8 */ - { 15172, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ - { 15193, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ - { 15218, 0x00008040 }, /* GL_LUMINANCE8_EXT */ - { 15236, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ - { 15255, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ - { 15271, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ - { 15291, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ - { 15313, 0x00000D91 }, /* GL_MAP1_INDEX */ - { 15327, 0x00000D92 }, /* GL_MAP1_NORMAL */ - { 15342, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ - { 15366, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ - { 15390, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ - { 15414, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ - { 15438, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ - { 15455, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ - { 15472, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - { 15500, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - { 15529, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - { 15558, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - { 15587, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - { 15616, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - { 15645, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - { 15674, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - { 15702, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - { 15730, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - { 15758, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - { 15786, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - { 15814, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - { 15842, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - { 15870, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - { 15898, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - { 15926, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ - { 15942, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ - { 15962, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ - { 15984, 0x00000DB1 }, /* GL_MAP2_INDEX */ - { 15998, 0x00000DB2 }, /* GL_MAP2_NORMAL */ - { 16013, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ - { 16037, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ - { 16061, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ - { 16085, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ - { 16109, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ - { 16126, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ - { 16143, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - { 16171, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - { 16200, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - { 16229, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - { 16258, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - { 16287, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - { 16316, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - { 16345, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - { 16373, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - { 16401, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - { 16429, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - { 16457, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - { 16485, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - { 16513, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ - { 16541, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - { 16569, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - { 16597, 0x00000D10 }, /* GL_MAP_COLOR */ - { 16610, 0x00000D11 }, /* GL_MAP_STENCIL */ - { 16625, 0x000088C0 }, /* GL_MATRIX0_ARB */ - { 16640, 0x00008630 }, /* GL_MATRIX0_NV */ - { 16654, 0x000088CA }, /* GL_MATRIX10_ARB */ - { 16670, 0x000088CB }, /* GL_MATRIX11_ARB */ - { 16686, 0x000088CC }, /* GL_MATRIX12_ARB */ - { 16702, 0x000088CD }, /* GL_MATRIX13_ARB */ - { 16718, 0x000088CE }, /* GL_MATRIX14_ARB */ - { 16734, 0x000088CF }, /* GL_MATRIX15_ARB */ - { 16750, 0x000088D0 }, /* GL_MATRIX16_ARB */ - { 16766, 0x000088D1 }, /* GL_MATRIX17_ARB */ - { 16782, 0x000088D2 }, /* GL_MATRIX18_ARB */ - { 16798, 0x000088D3 }, /* GL_MATRIX19_ARB */ - { 16814, 0x000088C1 }, /* GL_MATRIX1_ARB */ - { 16829, 0x00008631 }, /* GL_MATRIX1_NV */ - { 16843, 0x000088D4 }, /* GL_MATRIX20_ARB */ - { 16859, 0x000088D5 }, /* GL_MATRIX21_ARB */ - { 16875, 0x000088D6 }, /* GL_MATRIX22_ARB */ - { 16891, 0x000088D7 }, /* GL_MATRIX23_ARB */ - { 16907, 0x000088D8 }, /* GL_MATRIX24_ARB */ - { 16923, 0x000088D9 }, /* GL_MATRIX25_ARB */ - { 16939, 0x000088DA }, /* GL_MATRIX26_ARB */ - { 16955, 0x000088DB }, /* GL_MATRIX27_ARB */ - { 16971, 0x000088DC }, /* GL_MATRIX28_ARB */ - { 16987, 0x000088DD }, /* GL_MATRIX29_ARB */ - { 17003, 0x000088C2 }, /* GL_MATRIX2_ARB */ - { 17018, 0x00008632 }, /* GL_MATRIX2_NV */ - { 17032, 0x000088DE }, /* GL_MATRIX30_ARB */ - { 17048, 0x000088DF }, /* GL_MATRIX31_ARB */ - { 17064, 0x000088C3 }, /* GL_MATRIX3_ARB */ - { 17079, 0x00008633 }, /* GL_MATRIX3_NV */ - { 17093, 0x000088C4 }, /* GL_MATRIX4_ARB */ - { 17108, 0x00008634 }, /* GL_MATRIX4_NV */ - { 17122, 0x000088C5 }, /* GL_MATRIX5_ARB */ - { 17137, 0x00008635 }, /* GL_MATRIX5_NV */ - { 17151, 0x000088C6 }, /* GL_MATRIX6_ARB */ - { 17166, 0x00008636 }, /* GL_MATRIX6_NV */ - { 17180, 0x000088C7 }, /* GL_MATRIX7_ARB */ - { 17195, 0x00008637 }, /* GL_MATRIX7_NV */ - { 17209, 0x000088C8 }, /* GL_MATRIX8_ARB */ - { 17224, 0x000088C9 }, /* GL_MATRIX9_ARB */ - { 17239, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ - { 17265, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - { 17299, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - { 17330, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - { 17363, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - { 17394, 0x00000BA0 }, /* GL_MATRIX_MODE */ - { 17409, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ - { 17431, 0x00008008 }, /* GL_MAX */ - { 17438, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ - { 17461, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - { 17493, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ - { 17519, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - { 17552, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - { 17578, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 17612, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ - { 17631, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ - { 17660, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - { 17692, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 17728, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - { 17764, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ - { 17804, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ - { 17830, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ - { 17860, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ - { 17885, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ - { 17914, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - { 17943, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ - { 17976, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ - { 17996, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ - { 18020, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ - { 18044, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ - { 18068, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ - { 18093, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ - { 18111, 0x00008008 }, /* GL_MAX_EXT */ - { 18122, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - { 18157, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ - { 18196, 0x00000D31 }, /* GL_MAX_LIGHTS */ - { 18210, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ - { 18230, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - { 18268, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - { 18297, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ - { 18321, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ - { 18349, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ - { 18372, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 18409, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 18445, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - { 18472, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - { 18501, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - { 18535, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - { 18571, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - { 18598, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - { 18630, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - { 18666, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - { 18695, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - { 18724, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ - { 18752, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - { 18790, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 18834, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 18877, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 18911, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 18950, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 18987, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 19025, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 19068, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 19111, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - { 19141, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - { 19172, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 19208, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 19244, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ - { 19274, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - { 19308, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ - { 19341, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ - { 19370, 0x00008D57 }, /* GL_MAX_SAMPLES */ - { 19385, 0x00008504 }, /* GL_MAX_SHININESS_NV */ - { 19405, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ - { 19429, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ - { 19451, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ - { 19477, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - { 19504, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ - { 19535, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ - { 19559, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - { 19593, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ - { 19613, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ - { 19640, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ - { 19661, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ - { 19686, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ - { 19711, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ - { 19746, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ - { 19768, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ - { 19794, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ - { 19816, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ - { 19842, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - { 19876, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ - { 19914, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - { 19947, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ - { 19984, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ - { 20008, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ - { 20029, 0x00008007 }, /* GL_MIN */ - { 20036, 0x0000802E }, /* GL_MINMAX */ - { 20046, 0x0000802E }, /* GL_MINMAX_EXT */ - { 20060, 0x0000802F }, /* GL_MINMAX_FORMAT */ - { 20077, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ - { 20098, 0x00008030 }, /* GL_MINMAX_SINK */ - { 20113, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ - { 20132, 0x00008007 }, /* GL_MIN_EXT */ - { 20143, 0x00008370 }, /* GL_MIRRORED_REPEAT */ - { 20162, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ - { 20185, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ - { 20208, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ - { 20228, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ - { 20248, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - { 20278, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ - { 20306, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - { 20334, 0x00001700 }, /* GL_MODELVIEW */ - { 20347, 0x00001700 }, /* GL_MODELVIEW0_ARB */ - { 20365, 0x0000872A }, /* GL_MODELVIEW10_ARB */ - { 20384, 0x0000872B }, /* GL_MODELVIEW11_ARB */ - { 20403, 0x0000872C }, /* GL_MODELVIEW12_ARB */ - { 20422, 0x0000872D }, /* GL_MODELVIEW13_ARB */ - { 20441, 0x0000872E }, /* GL_MODELVIEW14_ARB */ - { 20460, 0x0000872F }, /* GL_MODELVIEW15_ARB */ - { 20479, 0x00008730 }, /* GL_MODELVIEW16_ARB */ - { 20498, 0x00008731 }, /* GL_MODELVIEW17_ARB */ - { 20517, 0x00008732 }, /* GL_MODELVIEW18_ARB */ - { 20536, 0x00008733 }, /* GL_MODELVIEW19_ARB */ - { 20555, 0x0000850A }, /* GL_MODELVIEW1_ARB */ - { 20573, 0x00008734 }, /* GL_MODELVIEW20_ARB */ - { 20592, 0x00008735 }, /* GL_MODELVIEW21_ARB */ - { 20611, 0x00008736 }, /* GL_MODELVIEW22_ARB */ - { 20630, 0x00008737 }, /* GL_MODELVIEW23_ARB */ - { 20649, 0x00008738 }, /* GL_MODELVIEW24_ARB */ - { 20668, 0x00008739 }, /* GL_MODELVIEW25_ARB */ - { 20687, 0x0000873A }, /* GL_MODELVIEW26_ARB */ - { 20706, 0x0000873B }, /* GL_MODELVIEW27_ARB */ - { 20725, 0x0000873C }, /* GL_MODELVIEW28_ARB */ - { 20744, 0x0000873D }, /* GL_MODELVIEW29_ARB */ - { 20763, 0x00008722 }, /* GL_MODELVIEW2_ARB */ - { 20781, 0x0000873E }, /* GL_MODELVIEW30_ARB */ - { 20800, 0x0000873F }, /* GL_MODELVIEW31_ARB */ - { 20819, 0x00008723 }, /* GL_MODELVIEW3_ARB */ - { 20837, 0x00008724 }, /* GL_MODELVIEW4_ARB */ - { 20855, 0x00008725 }, /* GL_MODELVIEW5_ARB */ - { 20873, 0x00008726 }, /* GL_MODELVIEW6_ARB */ - { 20891, 0x00008727 }, /* GL_MODELVIEW7_ARB */ - { 20909, 0x00008728 }, /* GL_MODELVIEW8_ARB */ - { 20927, 0x00008729 }, /* GL_MODELVIEW9_ARB */ - { 20945, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ - { 20965, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ - { 20992, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ - { 21017, 0x00002100 }, /* GL_MODULATE */ - { 21029, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ - { 21049, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ - { 21076, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ - { 21101, 0x00000103 }, /* GL_MULT */ - { 21109, 0x0000809D }, /* GL_MULTISAMPLE */ - { 21124, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ - { 21144, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ - { 21163, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ - { 21182, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ - { 21206, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ - { 21229, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - { 21259, 0x00002A25 }, /* GL_N3F_V3F */ - { 21270, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ - { 21290, 0x0000150E }, /* GL_NAND */ - { 21298, 0x00002600 }, /* GL_NEAREST */ - { 21309, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - { 21340, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - { 21372, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ - { 21397, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ - { 21423, 0x00000200 }, /* GL_NEVER */ - { 21432, 0x00001102 }, /* GL_NICEST */ - { 21442, 0x00000000 }, /* GL_NONE */ - { 21450, 0x00001505 }, /* GL_NOOP */ - { 21458, 0x00001508 }, /* GL_NOR */ - { 21465, 0x00000BA1 }, /* GL_NORMALIZE */ - { 21478, 0x00008075 }, /* GL_NORMAL_ARRAY */ - { 21494, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - { 21525, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ - { 21560, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ - { 21584, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ - { 21607, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ - { 21628, 0x00008511 }, /* GL_NORMAL_MAP */ - { 21642, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ - { 21660, 0x00008511 }, /* GL_NORMAL_MAP_NV */ - { 21677, 0x00000205 }, /* GL_NOTEQUAL */ - { 21689, 0x00000000 }, /* GL_NO_ERROR */ - { 21701, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - { 21735, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ - { 21773, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ - { 21805, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ - { 21847, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ - { 21877, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ - { 21917, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ - { 21948, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ - { 21977, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ - { 22005, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ - { 22035, 0x00002401 }, /* GL_OBJECT_LINEAR */ - { 22052, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ - { 22078, 0x00002501 }, /* GL_OBJECT_PLANE */ - { 22094, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ - { 22129, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ - { 22151, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ - { 22170, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ - { 22200, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ - { 22221, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ - { 22249, 0x00000001 }, /* GL_ONE */ - { 22256, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ - { 22284, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ - { 22316, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ - { 22344, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ - { 22376, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ - { 22399, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ - { 22422, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ - { 22445, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ - { 22468, 0x00008598 }, /* GL_OPERAND0_ALPHA */ - { 22486, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ - { 22508, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ - { 22530, 0x00008590 }, /* GL_OPERAND0_RGB */ - { 22546, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ - { 22566, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ - { 22586, 0x00008599 }, /* GL_OPERAND1_ALPHA */ - { 22604, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ - { 22626, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ - { 22648, 0x00008591 }, /* GL_OPERAND1_RGB */ - { 22664, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ - { 22684, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ - { 22704, 0x0000859A }, /* GL_OPERAND2_ALPHA */ - { 22722, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ - { 22744, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ - { 22766, 0x00008592 }, /* GL_OPERAND2_RGB */ - { 22782, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ - { 22802, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ - { 22822, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ - { 22843, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ - { 22862, 0x00001507 }, /* GL_OR */ - { 22868, 0x00000A01 }, /* GL_ORDER */ - { 22877, 0x0000150D }, /* GL_OR_INVERTED */ - { 22892, 0x0000150B }, /* GL_OR_REVERSE */ - { 22906, 0x00000505 }, /* GL_OUT_OF_MEMORY */ - { 22923, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ - { 22941, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ - { 22962, 0x00008758 }, /* GL_PACK_INVERT_MESA */ - { 22982, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ - { 23000, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ - { 23019, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ - { 23039, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ - { 23059, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ - { 23077, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ - { 23096, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ - { 23121, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ - { 23145, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ - { 23166, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ - { 23188, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ - { 23210, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ - { 23235, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ - { 23259, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ - { 23280, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ - { 23302, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ - { 23324, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ - { 23346, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ - { 23377, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ - { 23397, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - { 23422, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ - { 23442, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - { 23467, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ - { 23487, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - { 23512, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ - { 23532, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - { 23557, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ - { 23577, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - { 23602, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ - { 23622, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - { 23647, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ - { 23667, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - { 23692, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ - { 23712, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - { 23737, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ - { 23757, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - { 23782, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ - { 23802, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - { 23827, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ - { 23845, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ - { 23878, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ - { 23903, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ - { 23938, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ - { 23965, 0x00001B00 }, /* GL_POINT */ - { 23974, 0x00000000 }, /* GL_POINTS */ - { 23984, 0x00000002 }, /* GL_POINT_BIT */ - { 23997, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ - { 24027, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ - { 24061, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ - { 24095, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ - { 24130, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ - { 24159, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ - { 24192, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ - { 24225, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ - { 24259, 0x00000B11 }, /* GL_POINT_SIZE */ - { 24273, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ - { 24299, 0x00008127 }, /* GL_POINT_SIZE_MAX */ - { 24317, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ - { 24339, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ - { 24361, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ - { 24384, 0x00008126 }, /* GL_POINT_SIZE_MIN */ - { 24402, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ - { 24424, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ - { 24446, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ - { 24469, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ - { 24489, 0x00000B10 }, /* GL_POINT_SMOOTH */ - { 24505, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ - { 24526, 0x00008861 }, /* GL_POINT_SPRITE */ - { 24542, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ - { 24562, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ - { 24591, 0x00008861 }, /* GL_POINT_SPRITE_NV */ - { 24610, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ - { 24636, 0x00000701 }, /* GL_POINT_TOKEN */ - { 24651, 0x00000009 }, /* GL_POLYGON */ - { 24662, 0x00000008 }, /* GL_POLYGON_BIT */ - { 24677, 0x00000B40 }, /* GL_POLYGON_MODE */ - { 24693, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ - { 24716, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ - { 24741, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ - { 24764, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ - { 24787, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ - { 24811, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ - { 24835, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ - { 24853, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ - { 24876, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ - { 24895, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ - { 24918, 0x00000703 }, /* GL_POLYGON_TOKEN */ - { 24935, 0x00001203 }, /* GL_POSITION */ - { 24947, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - { 24979, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ - { 25015, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - { 25048, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ - { 25085, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - { 25116, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ - { 25151, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - { 25183, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ - { 25219, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - { 25252, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - { 25284, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ - { 25320, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - { 25353, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ - { 25390, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - { 25420, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ - { 25454, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - { 25485, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ - { 25520, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - { 25551, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ - { 25586, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - { 25618, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ - { 25654, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - { 25684, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ - { 25718, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - { 25749, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ - { 25784, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - { 25816, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - { 25847, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ - { 25882, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - { 25914, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ - { 25950, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ - { 25979, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ - { 26012, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ - { 26042, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ - { 26076, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - { 26115, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - { 26148, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - { 26188, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - { 26222, 0x00008578 }, /* GL_PREVIOUS */ - { 26234, 0x00008578 }, /* GL_PREVIOUS_ARB */ - { 26250, 0x00008578 }, /* GL_PREVIOUS_EXT */ - { 26266, 0x00008577 }, /* GL_PRIMARY_COLOR */ - { 26283, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ - { 26304, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ - { 26325, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 26358, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 26390, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ - { 26413, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ - { 26436, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ - { 26466, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ - { 26495, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ - { 26523, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ - { 26545, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - { 26573, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - { 26601, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ - { 26623, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ - { 26644, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 26684, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 26723, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 26753, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 26788, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 26821, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 26855, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 26894, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 26933, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ - { 26955, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ - { 26981, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ - { 27005, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ - { 27028, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ - { 27050, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ - { 27071, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ - { 27092, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ - { 27119, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 27151, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 27183, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - { 27218, 0x00001701 }, /* GL_PROJECTION */ - { 27232, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ - { 27253, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ - { 27279, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ - { 27300, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ - { 27319, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ - { 27342, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - { 27381, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - { 27419, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ - { 27439, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - { 27469, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ - { 27493, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ - { 27513, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - { 27543, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ - { 27567, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ - { 27587, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - { 27620, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ - { 27646, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ - { 27676, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - { 27707, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ - { 27737, 0x00002003 }, /* GL_Q */ - { 27742, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ - { 27767, 0x00000007 }, /* GL_QUADS */ - { 27776, 0x00008614 }, /* GL_QUAD_MESH_SUN */ - { 27793, 0x00000008 }, /* GL_QUAD_STRIP */ - { 27807, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ - { 27829, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ - { 27855, 0x00008866 }, /* GL_QUERY_RESULT */ - { 27871, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ - { 27891, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ - { 27917, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ - { 27947, 0x00002002 }, /* GL_R */ - { 27952, 0x00002A10 }, /* GL_R3_G3_B2 */ - { 27964, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - { 27997, 0x00000C02 }, /* GL_READ_BUFFER */ - { 28012, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ - { 28032, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - { 28064, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ - { 28088, 0x000088B8 }, /* GL_READ_ONLY */ - { 28101, 0x000088B8 }, /* GL_READ_ONLY_ARB */ - { 28118, 0x000088BA }, /* GL_READ_WRITE */ - { 28132, 0x000088BA }, /* GL_READ_WRITE_ARB */ - { 28150, 0x00001903 }, /* GL_RED */ - { 28157, 0x00008016 }, /* GL_REDUCE */ - { 28167, 0x00008016 }, /* GL_REDUCE_EXT */ - { 28181, 0x00000D15 }, /* GL_RED_BIAS */ - { 28193, 0x00000D52 }, /* GL_RED_BITS */ - { 28205, 0x00000D14 }, /* GL_RED_SCALE */ - { 28218, 0x00008512 }, /* GL_REFLECTION_MAP */ - { 28236, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ - { 28258, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ - { 28279, 0x00001C00 }, /* GL_RENDER */ - { 28289, 0x00008D41 }, /* GL_RENDERBUFFER */ - { 28305, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ - { 28332, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ - { 28360, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ - { 28386, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ - { 28413, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ - { 28433, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ - { 28460, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ - { 28483, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ - { 28510, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - { 28542, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ - { 28578, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ - { 28603, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ - { 28627, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ - { 28656, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ - { 28678, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ - { 28704, 0x00001F01 }, /* GL_RENDERER */ - { 28716, 0x00000C40 }, /* GL_RENDER_MODE */ - { 28731, 0x00002901 }, /* GL_REPEAT */ - { 28741, 0x00001E01 }, /* GL_REPLACE */ - { 28752, 0x00008062 }, /* GL_REPLACE_EXT */ - { 28767, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ - { 28790, 0x0000803A }, /* GL_RESCALE_NORMAL */ - { 28808, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ - { 28830, 0x00000102 }, /* GL_RETURN */ - { 28840, 0x00001907 }, /* GL_RGB */ - { 28847, 0x00008052 }, /* GL_RGB10 */ - { 28856, 0x00008059 }, /* GL_RGB10_A2 */ - { 28868, 0x00008059 }, /* GL_RGB10_A2_EXT */ - { 28884, 0x00008052 }, /* GL_RGB10_EXT */ - { 28897, 0x00008053 }, /* GL_RGB12 */ - { 28906, 0x00008053 }, /* GL_RGB12_EXT */ - { 28919, 0x00008054 }, /* GL_RGB16 */ - { 28928, 0x00008054 }, /* GL_RGB16_EXT */ - { 28941, 0x0000804E }, /* GL_RGB2_EXT */ - { 28953, 0x0000804F }, /* GL_RGB4 */ - { 28961, 0x0000804F }, /* GL_RGB4_EXT */ - { 28973, 0x000083A1 }, /* GL_RGB4_S3TC */ - { 28986, 0x00008050 }, /* GL_RGB5 */ - { 28994, 0x00008057 }, /* GL_RGB5_A1 */ - { 29005, 0x00008057 }, /* GL_RGB5_A1_EXT */ - { 29020, 0x00008050 }, /* GL_RGB5_EXT */ - { 29032, 0x00008051 }, /* GL_RGB8 */ - { 29040, 0x00008051 }, /* GL_RGB8_EXT */ - { 29052, 0x00001908 }, /* GL_RGBA */ - { 29060, 0x0000805A }, /* GL_RGBA12 */ - { 29070, 0x0000805A }, /* GL_RGBA12_EXT */ - { 29084, 0x0000805B }, /* GL_RGBA16 */ - { 29094, 0x0000805B }, /* GL_RGBA16_EXT */ - { 29108, 0x00008055 }, /* GL_RGBA2 */ - { 29117, 0x00008055 }, /* GL_RGBA2_EXT */ - { 29130, 0x00008056 }, /* GL_RGBA4 */ - { 29139, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ - { 29158, 0x00008056 }, /* GL_RGBA4_EXT */ - { 29171, 0x000083A3 }, /* GL_RGBA4_S3TC */ - { 29185, 0x00008058 }, /* GL_RGBA8 */ - { 29194, 0x00008058 }, /* GL_RGBA8_EXT */ - { 29207, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ - { 29225, 0x00000C31 }, /* GL_RGBA_MODE */ - { 29238, 0x000083A2 }, /* GL_RGBA_S3TC */ - { 29251, 0x000083A0 }, /* GL_RGB_S3TC */ - { 29263, 0x00008573 }, /* GL_RGB_SCALE */ - { 29276, 0x00008573 }, /* GL_RGB_SCALE_ARB */ - { 29293, 0x00008573 }, /* GL_RGB_SCALE_EXT */ - { 29310, 0x00000407 }, /* GL_RIGHT */ - { 29319, 0x00002000 }, /* GL_S */ - { 29324, 0x00008B5D }, /* GL_SAMPLER_1D */ - { 29338, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ - { 29359, 0x00008B5E }, /* GL_SAMPLER_2D */ - { 29373, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ - { 29394, 0x00008B5F }, /* GL_SAMPLER_3D */ - { 29408, 0x00008B60 }, /* GL_SAMPLER_CUBE */ - { 29424, 0x000080A9 }, /* GL_SAMPLES */ - { 29435, 0x000086B4 }, /* GL_SAMPLES_3DFX */ - { 29451, 0x000080A9 }, /* GL_SAMPLES_ARB */ - { 29466, 0x00008914 }, /* GL_SAMPLES_PASSED */ - { 29484, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ - { 29506, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - { 29534, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ - { 29566, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ - { 29589, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ - { 29616, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ - { 29634, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ - { 29657, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ - { 29679, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ - { 29698, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ - { 29721, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ - { 29747, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ - { 29777, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ - { 29802, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ - { 29831, 0x00080000 }, /* GL_SCISSOR_BIT */ - { 29846, 0x00000C10 }, /* GL_SCISSOR_BOX */ - { 29861, 0x00000C11 }, /* GL_SCISSOR_TEST */ - { 29877, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ - { 29902, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - { 29942, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 29986, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - { 30019, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - { 30049, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - { 30081, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - { 30111, 0x00001C02 }, /* GL_SELECT */ - { 30121, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ - { 30149, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ - { 30174, 0x00008012 }, /* GL_SEPARABLE_2D */ - { 30190, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ - { 30217, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ - { 30248, 0x0000150F }, /* GL_SET */ - { 30255, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ - { 30276, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ - { 30300, 0x00008B4F }, /* GL_SHADER_TYPE */ - { 30315, 0x00000B54 }, /* GL_SHADE_MODEL */ - { 30330, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ - { 30358, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ - { 30381, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - { 30411, 0x00001601 }, /* GL_SHININESS */ - { 30424, 0x00001402 }, /* GL_SHORT */ - { 30433, 0x000081F9 }, /* GL_SINGLE_COLOR */ - { 30449, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ - { 30469, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ - { 30488, 0x00001D01 }, /* GL_SMOOTH */ - { 30498, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ - { 30531, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ - { 30558, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ - { 30591, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ - { 30618, 0x00008588 }, /* GL_SOURCE0_ALPHA */ - { 30635, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ - { 30656, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ - { 30677, 0x00008580 }, /* GL_SOURCE0_RGB */ - { 30692, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ - { 30711, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ - { 30730, 0x00008589 }, /* GL_SOURCE1_ALPHA */ - { 30747, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ - { 30768, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ - { 30789, 0x00008581 }, /* GL_SOURCE1_RGB */ - { 30804, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ - { 30823, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ - { 30842, 0x0000858A }, /* GL_SOURCE2_ALPHA */ - { 30859, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ - { 30880, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ - { 30901, 0x00008582 }, /* GL_SOURCE2_RGB */ - { 30916, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ - { 30935, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ - { 30954, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ - { 30974, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ - { 30992, 0x00001202 }, /* GL_SPECULAR */ - { 31004, 0x00002402 }, /* GL_SPHERE_MAP */ - { 31018, 0x00001206 }, /* GL_SPOT_CUTOFF */ - { 31033, 0x00001204 }, /* GL_SPOT_DIRECTION */ - { 31051, 0x00001205 }, /* GL_SPOT_EXPONENT */ - { 31068, 0x00008588 }, /* GL_SRC0_ALPHA */ - { 31082, 0x00008580 }, /* GL_SRC0_RGB */ - { 31094, 0x00008589 }, /* GL_SRC1_ALPHA */ - { 31108, 0x00008581 }, /* GL_SRC1_RGB */ - { 31120, 0x0000858A }, /* GL_SRC2_ALPHA */ - { 31134, 0x00008582 }, /* GL_SRC2_RGB */ - { 31146, 0x00000302 }, /* GL_SRC_ALPHA */ - { 31159, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ - { 31181, 0x00000300 }, /* GL_SRC_COLOR */ - { 31194, 0x00008C40 }, /* GL_SRGB */ - { 31202, 0x00000503 }, /* GL_STACK_OVERFLOW */ - { 31220, 0x00000504 }, /* GL_STACK_UNDERFLOW */ - { 31239, 0x000088E6 }, /* GL_STATIC_COPY */ - { 31254, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ - { 31273, 0x000088E4 }, /* GL_STATIC_DRAW */ - { 31288, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ - { 31307, 0x000088E5 }, /* GL_STATIC_READ */ - { 31322, 0x000088E5 }, /* GL_STATIC_READ_ARB */ - { 31341, 0x00001802 }, /* GL_STENCIL */ - { 31352, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ - { 31374, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ - { 31400, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ - { 31421, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ - { 31446, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ - { 31467, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ - { 31492, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - { 31524, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ - { 31560, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - { 31592, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ - { 31628, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ - { 31648, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ - { 31675, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ - { 31701, 0x00000D57 }, /* GL_STENCIL_BITS */ - { 31717, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ - { 31739, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ - { 31762, 0x00000B94 }, /* GL_STENCIL_FAIL */ - { 31778, 0x00000B92 }, /* GL_STENCIL_FUNC */ - { 31794, 0x00001901 }, /* GL_STENCIL_INDEX */ - { 31811, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ - { 31834, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ - { 31856, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ - { 31878, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ - { 31900, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ - { 31921, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ - { 31948, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ - { 31975, 0x00000B97 }, /* GL_STENCIL_REF */ - { 31990, 0x00000B90 }, /* GL_STENCIL_TEST */ - { 32006, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - { 32035, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ - { 32057, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ - { 32078, 0x00000C33 }, /* GL_STEREO */ - { 32088, 0x000088E2 }, /* GL_STREAM_COPY */ - { 32103, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ - { 32122, 0x000088E0 }, /* GL_STREAM_DRAW */ - { 32137, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ - { 32156, 0x000088E1 }, /* GL_STREAM_READ */ - { 32171, 0x000088E1 }, /* GL_STREAM_READ_ARB */ - { 32190, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ - { 32207, 0x000084E7 }, /* GL_SUBTRACT */ - { 32219, 0x000084E7 }, /* GL_SUBTRACT_ARB */ - { 32235, 0x00002001 }, /* GL_T */ - { 32240, 0x00002A2A }, /* GL_T2F_C3F_V3F */ - { 32255, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ - { 32274, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ - { 32290, 0x00002A2B }, /* GL_T2F_N3F_V3F */ - { 32305, 0x00002A27 }, /* GL_T2F_V3F */ - { 32316, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ - { 32335, 0x00002A28 }, /* GL_T4F_V4F */ - { 32346, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ - { 32369, 0x00001702 }, /* GL_TEXTURE */ - { 32380, 0x000084C0 }, /* GL_TEXTURE0 */ - { 32392, 0x000084C0 }, /* GL_TEXTURE0_ARB */ - { 32408, 0x000084C1 }, /* GL_TEXTURE1 */ - { 32420, 0x000084CA }, /* GL_TEXTURE10 */ - { 32433, 0x000084CA }, /* GL_TEXTURE10_ARB */ - { 32450, 0x000084CB }, /* GL_TEXTURE11 */ - { 32463, 0x000084CB }, /* GL_TEXTURE11_ARB */ - { 32480, 0x000084CC }, /* GL_TEXTURE12 */ - { 32493, 0x000084CC }, /* GL_TEXTURE12_ARB */ - { 32510, 0x000084CD }, /* GL_TEXTURE13 */ - { 32523, 0x000084CD }, /* GL_TEXTURE13_ARB */ - { 32540, 0x000084CE }, /* GL_TEXTURE14 */ - { 32553, 0x000084CE }, /* GL_TEXTURE14_ARB */ - { 32570, 0x000084CF }, /* GL_TEXTURE15 */ - { 32583, 0x000084CF }, /* GL_TEXTURE15_ARB */ - { 32600, 0x000084D0 }, /* GL_TEXTURE16 */ - { 32613, 0x000084D0 }, /* GL_TEXTURE16_ARB */ - { 32630, 0x000084D1 }, /* GL_TEXTURE17 */ - { 32643, 0x000084D1 }, /* GL_TEXTURE17_ARB */ - { 32660, 0x000084D2 }, /* GL_TEXTURE18 */ - { 32673, 0x000084D2 }, /* GL_TEXTURE18_ARB */ - { 32690, 0x000084D3 }, /* GL_TEXTURE19 */ - { 32703, 0x000084D3 }, /* GL_TEXTURE19_ARB */ - { 32720, 0x000084C1 }, /* GL_TEXTURE1_ARB */ - { 32736, 0x000084C2 }, /* GL_TEXTURE2 */ - { 32748, 0x000084D4 }, /* GL_TEXTURE20 */ - { 32761, 0x000084D4 }, /* GL_TEXTURE20_ARB */ - { 32778, 0x000084D5 }, /* GL_TEXTURE21 */ - { 32791, 0x000084D5 }, /* GL_TEXTURE21_ARB */ - { 32808, 0x000084D6 }, /* GL_TEXTURE22 */ - { 32821, 0x000084D6 }, /* GL_TEXTURE22_ARB */ - { 32838, 0x000084D7 }, /* GL_TEXTURE23 */ - { 32851, 0x000084D7 }, /* GL_TEXTURE23_ARB */ - { 32868, 0x000084D8 }, /* GL_TEXTURE24 */ - { 32881, 0x000084D8 }, /* GL_TEXTURE24_ARB */ - { 32898, 0x000084D9 }, /* GL_TEXTURE25 */ - { 32911, 0x000084D9 }, /* GL_TEXTURE25_ARB */ - { 32928, 0x000084DA }, /* GL_TEXTURE26 */ - { 32941, 0x000084DA }, /* GL_TEXTURE26_ARB */ - { 32958, 0x000084DB }, /* GL_TEXTURE27 */ - { 32971, 0x000084DB }, /* GL_TEXTURE27_ARB */ - { 32988, 0x000084DC }, /* GL_TEXTURE28 */ - { 33001, 0x000084DC }, /* GL_TEXTURE28_ARB */ - { 33018, 0x000084DD }, /* GL_TEXTURE29 */ - { 33031, 0x000084DD }, /* GL_TEXTURE29_ARB */ - { 33048, 0x000084C2 }, /* GL_TEXTURE2_ARB */ - { 33064, 0x000084C3 }, /* GL_TEXTURE3 */ - { 33076, 0x000084DE }, /* GL_TEXTURE30 */ - { 33089, 0x000084DE }, /* GL_TEXTURE30_ARB */ - { 33106, 0x000084DF }, /* GL_TEXTURE31 */ - { 33119, 0x000084DF }, /* GL_TEXTURE31_ARB */ - { 33136, 0x000084C3 }, /* GL_TEXTURE3_ARB */ - { 33152, 0x000084C4 }, /* GL_TEXTURE4 */ - { 33164, 0x000084C4 }, /* GL_TEXTURE4_ARB */ - { 33180, 0x000084C5 }, /* GL_TEXTURE5 */ - { 33192, 0x000084C5 }, /* GL_TEXTURE5_ARB */ - { 33208, 0x000084C6 }, /* GL_TEXTURE6 */ - { 33220, 0x000084C6 }, /* GL_TEXTURE6_ARB */ - { 33236, 0x000084C7 }, /* GL_TEXTURE7 */ - { 33248, 0x000084C7 }, /* GL_TEXTURE7_ARB */ - { 33264, 0x000084C8 }, /* GL_TEXTURE8 */ - { 33276, 0x000084C8 }, /* GL_TEXTURE8_ARB */ - { 33292, 0x000084C9 }, /* GL_TEXTURE9 */ - { 33304, 0x000084C9 }, /* GL_TEXTURE9_ARB */ - { 33320, 0x00000DE0 }, /* GL_TEXTURE_1D */ - { 33334, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ - { 33358, 0x00000DE1 }, /* GL_TEXTURE_2D */ - { 33372, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ - { 33396, 0x0000806F }, /* GL_TEXTURE_3D */ - { 33410, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ - { 33432, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ - { 33458, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ - { 33480, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ - { 33502, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - { 33534, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ - { 33556, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - { 33588, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ - { 33610, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ - { 33638, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ - { 33670, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - { 33703, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ - { 33735, 0x00040000 }, /* GL_TEXTURE_BIT */ - { 33750, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ - { 33771, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ - { 33796, 0x00001005 }, /* GL_TEXTURE_BORDER */ - { 33814, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ - { 33838, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - { 33869, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - { 33899, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - { 33929, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - { 33964, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - { 33995, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 34033, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ - { 34060, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - { 34092, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - { 34126, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ - { 34150, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ - { 34178, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ - { 34202, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ - { 34230, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - { 34263, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ - { 34287, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ - { 34309, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ - { 34331, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ - { 34357, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ - { 34391, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - { 34424, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ - { 34461, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ - { 34489, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ - { 34521, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ - { 34544, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - { 34582, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ - { 34624, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - { 34655, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - { 34683, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - { 34713, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - { 34741, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ - { 34761, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ - { 34785, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - { 34816, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ - { 34851, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - { 34882, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ - { 34917, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - { 34948, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ - { 34983, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - { 35014, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ - { 35049, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - { 35080, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ - { 35115, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - { 35146, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ - { 35181, 0x00008071 }, /* GL_TEXTURE_DEPTH */ - { 35198, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ - { 35220, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ - { 35246, 0x00002300 }, /* GL_TEXTURE_ENV */ - { 35261, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ - { 35282, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ - { 35302, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ - { 35328, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ - { 35348, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ - { 35365, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ - { 35382, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ - { 35399, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ - { 35416, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ - { 35441, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ - { 35463, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ - { 35489, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ - { 35507, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ - { 35533, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ - { 35559, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ - { 35589, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ - { 35616, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ - { 35641, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ - { 35661, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ - { 35685, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - { 35712, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - { 35739, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - { 35766, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ - { 35792, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ - { 35822, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ - { 35844, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ - { 35862, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - { 35892, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - { 35920, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - { 35948, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - { 35976, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ - { 35997, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ - { 36016, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ - { 36038, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ - { 36057, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ - { 36077, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ - { 36102, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ - { 36126, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ - { 36146, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ - { 36170, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ - { 36190, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ - { 36213, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ - { 36237, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ - { 36262, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - { 36296, 0x00001000 }, /* GL_TEXTURE_WIDTH */ - { 36313, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ - { 36331, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ - { 36349, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ - { 36367, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ - { 36387, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ - { 36406, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - { 36435, 0x00001000 }, /* GL_TRANSFORM_BIT */ - { 36452, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ - { 36478, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ - { 36508, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - { 36540, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - { 36570, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ - { 36604, 0x0000862C }, /* GL_TRANSPOSE_NV */ - { 36620, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - { 36651, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ - { 36686, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - { 36714, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ - { 36746, 0x00000004 }, /* GL_TRIANGLES */ - { 36759, 0x00000006 }, /* GL_TRIANGLE_FAN */ - { 36775, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ - { 36796, 0x00000005 }, /* GL_TRIANGLE_STRIP */ - { 36814, 0x00000001 }, /* GL_TRUE */ - { 36822, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ - { 36842, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ - { 36865, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ - { 36885, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ - { 36906, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ - { 36928, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ - { 36950, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ - { 36970, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ - { 36991, 0x00001401 }, /* GL_UNSIGNED_BYTE */ - { 37008, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - { 37035, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ - { 37058, 0x00001405 }, /* GL_UNSIGNED_INT */ - { 37074, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ - { 37101, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ - { 37122, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ - { 37146, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - { 37177, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ - { 37201, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - { 37229, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ - { 37252, 0x00001403 }, /* GL_UNSIGNED_SHORT */ - { 37270, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - { 37300, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - { 37326, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - { 37356, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - { 37382, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ - { 37406, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - { 37434, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - { 37462, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ - { 37489, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - { 37521, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ - { 37552, 0x00008CA2 }, /* GL_UPPER_LEFT */ - { 37566, 0x00002A20 }, /* GL_V2F */ - { 37573, 0x00002A21 }, /* GL_V3F */ - { 37580, 0x00008B83 }, /* GL_VALIDATE_STATUS */ - { 37599, 0x00001F00 }, /* GL_VENDOR */ - { 37609, 0x00001F02 }, /* GL_VERSION */ - { 37620, 0x00008074 }, /* GL_VERTEX_ARRAY */ - { 37636, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - { 37666, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - { 37697, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ - { 37732, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ - { 37756, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ - { 37777, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ - { 37800, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ - { 37821, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - { 37848, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - { 37876, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - { 37904, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - { 37932, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - { 37960, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - { 37988, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - { 38016, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - { 38043, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - { 38070, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - { 38097, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - { 38124, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - { 38151, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - { 38178, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - { 38205, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - { 38232, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - { 38259, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - { 38297, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ - { 38339, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - { 38370, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ - { 38405, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - { 38439, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ - { 38477, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - { 38508, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ - { 38543, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - { 38571, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ - { 38603, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - { 38633, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ - { 38667, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - { 38695, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ - { 38727, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ - { 38747, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ - { 38769, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ - { 38798, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ - { 38819, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - { 38848, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ - { 38881, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - { 38913, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - { 38940, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ - { 38971, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - { 39001, 0x00008B31 }, /* GL_VERTEX_SHADER */ - { 39018, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ - { 39039, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ - { 39066, 0x00000BA2 }, /* GL_VIEWPORT */ - { 39078, 0x00000800 }, /* GL_VIEWPORT_BIT */ - { 39094, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ - { 39114, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - { 39145, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ - { 39180, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - { 39208, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - { 39233, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - { 39260, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - { 39285, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ - { 39309, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ - { 39328, 0x000088B9 }, /* GL_WRITE_ONLY */ - { 39342, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ - { 39360, 0x00001506 }, /* GL_XOR */ - { 39367, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ - { 39386, 0x00008757 }, /* GL_YCBCR_MESA */ - { 39400, 0x00000000 }, /* GL_ZERO */ - { 39408, 0x00000D16 }, /* GL_ZOOM_X */ - { 39418, 0x00000D17 }, /* GL_ZOOM_Y */ + { 1394, 0x00008009 }, /* GL_BLEND_EQUATION_RGB */ + { 1416, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */ + { 1442, 0x00000BE1 }, /* GL_BLEND_SRC */ + { 1455, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */ + { 1474, 0x000080C9 }, /* GL_BLEND_SRC_RGB */ + { 1491, 0x00001905 }, /* GL_BLUE */ + { 1499, 0x00000D1B }, /* GL_BLUE_BIAS */ + { 1512, 0x00000D54 }, /* GL_BLUE_BITS */ + { 1525, 0x00000D1A }, /* GL_BLUE_SCALE */ + { 1539, 0x00008B56 }, /* GL_BOOL */ + { 1547, 0x00008B56 }, /* GL_BOOL_ARB */ + { 1559, 0x00008B57 }, /* GL_BOOL_VEC2 */ + { 1572, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */ + { 1589, 0x00008B58 }, /* GL_BOOL_VEC3 */ + { 1602, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */ + { 1619, 0x00008B59 }, /* GL_BOOL_VEC4 */ + { 1632, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */ + { 1649, 0x000088BB }, /* GL_BUFFER_ACCESS */ + { 1666, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */ + { 1687, 0x000088BC }, /* GL_BUFFER_MAPPED */ + { 1704, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */ + { 1725, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */ + { 1747, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */ + { 1773, 0x00008764 }, /* GL_BUFFER_SIZE */ + { 1788, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */ + { 1807, 0x00008765 }, /* GL_BUFFER_USAGE */ + { 1823, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */ + { 1843, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */ + { 1862, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */ + { 1888, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */ + { 1911, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ + { 1939, 0x0000877C }, /* GL_BUMP_TARGET_ATI */ + { 1958, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */ + { 1980, 0x00001400 }, /* GL_BYTE */ + { 1988, 0x00002A24 }, /* GL_C3F_V3F */ + { 1999, 0x00002A26 }, /* GL_C4F_N3F_V3F */ + { 2014, 0x00002A22 }, /* GL_C4UB_V2F */ + { 2026, 0x00002A23 }, /* GL_C4UB_V3F */ + { 2038, 0x00000901 }, /* GL_CCW */ + { 2045, 0x00002900 }, /* GL_CLAMP */ + { 2054, 0x0000812D }, /* GL_CLAMP_TO_BORDER */ + { 2073, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */ + { 2096, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */ + { 2120, 0x0000812F }, /* GL_CLAMP_TO_EDGE */ + { 2137, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */ + { 2159, 0x00001500 }, /* GL_CLEAR */ + { 2168, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */ + { 2193, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */ + { 2222, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */ + { 2248, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ + { 2277, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */ + { 2303, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */ + { 2330, 0x00003000 }, /* GL_CLIP_PLANE0 */ + { 2345, 0x00003001 }, /* GL_CLIP_PLANE1 */ + { 2360, 0x00003002 }, /* GL_CLIP_PLANE2 */ + { 2375, 0x00003003 }, /* GL_CLIP_PLANE3 */ + { 2390, 0x00003004 }, /* GL_CLIP_PLANE4 */ + { 2405, 0x00003005 }, /* GL_CLIP_PLANE5 */ + { 2420, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ + { 2453, 0x00000A00 }, /* GL_COEFF */ + { 2462, 0x00001800 }, /* GL_COLOR */ + { 2471, 0x00008076 }, /* GL_COLOR_ARRAY */ + { 2486, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */ + { 2516, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 2550, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */ + { 2573, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */ + { 2593, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */ + { 2615, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */ + { 2635, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */ + { 2656, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */ + { 2681, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */ + { 2702, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */ + { 2724, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */ + { 2750, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */ + { 2772, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */ + { 2798, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */ + { 2820, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */ + { 2846, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */ + { 2868, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */ + { 2894, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */ + { 2916, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */ + { 2942, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */ + { 2964, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */ + { 2990, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */ + { 3015, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */ + { 3036, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */ + { 3061, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */ + { 3082, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */ + { 3107, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */ + { 3128, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */ + { 3153, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */ + { 3174, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */ + { 3199, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */ + { 3220, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */ + { 3245, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */ + { 3266, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */ + { 3291, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */ + { 3312, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */ + { 3337, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */ + { 3358, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */ + { 3383, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */ + { 3403, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */ + { 3424, 0x00001900 }, /* GL_COLOR_INDEX */ + { 3439, 0x00001603 }, /* GL_COLOR_INDEXES */ + { 3456, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */ + { 3474, 0x00000B57 }, /* GL_COLOR_MATERIAL */ + { 3492, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */ + { 3515, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */ + { 3543, 0x000080B1 }, /* GL_COLOR_MATRIX */ + { 3559, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */ + { 3579, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */ + { 3607, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 3639, 0x00008458 }, /* GL_COLOR_SUM */ + { 3652, 0x00008458 }, /* GL_COLOR_SUM_ARB */ + { 3669, 0x000080D0 }, /* GL_COLOR_TABLE */ + { 3684, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */ + { 3710, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */ + { 3740, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */ + { 3770, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */ + { 3790, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */ + { 3814, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */ + { 3839, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */ + { 3868, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */ + { 3897, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */ + { 3919, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */ + { 3945, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */ + { 3971, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */ + { 3997, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */ + { 4027, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */ + { 4057, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */ + { 4087, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */ + { 4121, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */ + { 4155, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ + { 4185, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */ + { 4219, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */ + { 4253, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */ + { 4277, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */ + { 4305, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */ + { 4333, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */ + { 4354, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */ + { 4379, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */ + { 4400, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */ + { 4425, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */ + { 4450, 0x00000C23 }, /* GL_COLOR_WRITEMASK */ + { 4469, 0x00008570 }, /* GL_COMBINE */ + { 4480, 0x00008503 }, /* GL_COMBINE4 */ + { 4492, 0x00008572 }, /* GL_COMBINE_ALPHA */ + { 4509, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */ + { 4530, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */ + { 4551, 0x00008570 }, /* GL_COMBINE_ARB */ + { 4566, 0x00008570 }, /* GL_COMBINE_EXT */ + { 4581, 0x00008571 }, /* GL_COMBINE_RGB */ + { 4596, 0x00008571 }, /* GL_COMBINE_RGB_ARB */ + { 4615, 0x00008571 }, /* GL_COMBINE_RGB_EXT */ + { 4634, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */ + { 4670, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */ + { 4694, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */ + { 4722, 0x00001300 }, /* GL_COMPILE */ + { 4733, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */ + { 4756, 0x00008B81 }, /* GL_COMPILE_STATUS */ + { 4774, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */ + { 4794, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */ + { 4818, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */ + { 4842, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */ + { 4870, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */ + { 4894, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */ + { 4924, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */ + { 4958, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */ + { 4986, 0x000084ED }, /* GL_COMPRESSED_RGB */ + { 5004, 0x000084EE }, /* GL_COMPRESSED_RGBA */ + { 5023, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */ + { 5046, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ + { 5075, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ + { 5108, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ + { 5141, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ + { 5174, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */ + { 5196, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */ + { 5224, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ + { 5256, 0x00008C4A }, /* GL_COMPRESSED_SLUMINANCE */ + { 5281, 0x00008C4B }, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ + { 5312, 0x00008C48 }, /* GL_COMPRESSED_SRGB */ + { 5331, 0x00008C49 }, /* GL_COMPRESSED_SRGB_ALPHA */ + { 5356, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */ + { 5386, 0x00008576 }, /* GL_CONSTANT */ + { 5398, 0x00008003 }, /* GL_CONSTANT_ALPHA */ + { 5416, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */ + { 5438, 0x00008576 }, /* GL_CONSTANT_ARB */ + { 5454, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */ + { 5478, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */ + { 5500, 0x00008001 }, /* GL_CONSTANT_COLOR */ + { 5518, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */ + { 5540, 0x00008576 }, /* GL_CONSTANT_EXT */ + { 5556, 0x00008010 }, /* GL_CONVOLUTION_1D */ + { 5574, 0x00008011 }, /* GL_CONVOLUTION_2D */ + { 5592, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */ + { 5620, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */ + { 5651, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */ + { 5678, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */ + { 5709, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */ + { 5736, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */ + { 5767, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */ + { 5795, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */ + { 5827, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */ + { 5849, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */ + { 5875, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */ + { 5897, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */ + { 5923, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */ + { 5944, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */ + { 5969, 0x00008862 }, /* GL_COORD_REPLACE */ + { 5986, 0x00008862 }, /* GL_COORD_REPLACE_ARB */ + { 6007, 0x00008862 }, /* GL_COORD_REPLACE_NV */ + { 6027, 0x00001503 }, /* GL_COPY */ + { 6035, 0x0000150C }, /* GL_COPY_INVERTED */ + { 6052, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */ + { 6072, 0x00000B44 }, /* GL_CULL_FACE */ + { 6085, 0x00000B45 }, /* GL_CULL_FACE_MODE */ + { 6103, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ + { 6122, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + { 6154, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + { 6189, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ + { 6210, 0x00000001 }, /* GL_CURRENT_BIT */ + { 6225, 0x00000B00 }, /* GL_CURRENT_COLOR */ + { 6242, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ + { 6263, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ + { 6289, 0x00000B01 }, /* GL_CURRENT_INDEX */ + { 6306, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ + { 6328, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ + { 6356, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ + { 6377, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + { 6411, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ + { 6444, 0x00000B02 }, /* GL_CURRENT_NORMAL */ + { 6462, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + { 6492, 0x00008B8D }, /* GL_CURRENT_PROGRAM */ + { 6511, 0x00008865 }, /* GL_CURRENT_QUERY */ + { 6528, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ + { 6549, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ + { 6573, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ + { 6600, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ + { 6624, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ + { 6651, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ + { 6684, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ + { 6718, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + { 6751, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ + { 6778, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ + { 6804, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */ + { 6829, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ + { 6858, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ + { 6880, 0x00000900 }, /* GL_CW */ + { 6886, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */ + { 6907, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */ + { 6928, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */ + { 6948, 0x00002101 }, /* GL_DECAL */ + { 6957, 0x00001E03 }, /* GL_DECR */ + { 6965, 0x00008508 }, /* GL_DECR_WRAP */ + { 6978, 0x00008508 }, /* GL_DECR_WRAP_EXT */ + { 6995, 0x00008B80 }, /* GL_DELETE_STATUS */ + { 7012, 0x00001801 }, /* GL_DEPTH */ + { 7021, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */ + { 7041, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ + { 7061, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ + { 7085, 0x00000D1F }, /* GL_DEPTH_BIAS */ + { 7099, 0x00000D56 }, /* GL_DEPTH_BITS */ + { 7113, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ + { 7133, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ + { 7158, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ + { 7178, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ + { 7196, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ + { 7217, 0x00001902 }, /* GL_DEPTH_COMPONENT */ + { 7236, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ + { 7257, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ + { 7282, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ + { 7308, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ + { 7329, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ + { 7354, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ + { 7380, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ + { 7401, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ + { 7426, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ + { 7452, 0x00000B74 }, /* GL_DEPTH_FUNC */ + { 7466, 0x00000B70 }, /* GL_DEPTH_RANGE */ + { 7481, 0x00000D1E }, /* GL_DEPTH_SCALE */ + { 7496, 0x000084F9 }, /* GL_DEPTH_STENCIL */ + { 7513, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ + { 7541, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ + { 7561, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + { 7589, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + { 7617, 0x00000B71 }, /* GL_DEPTH_TEST */ + { 7631, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ + { 7653, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ + { 7679, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ + { 7698, 0x00001201 }, /* GL_DIFFUSE */ + { 7709, 0x00000BD0 }, /* GL_DITHER */ + { 7719, 0x00000A02 }, /* GL_DOMAIN */ + { 7729, 0x00001100 }, /* GL_DONT_CARE */ + { 7742, 0x000086AE }, /* GL_DOT3_RGB */ + { 7754, 0x000086AF }, /* GL_DOT3_RGBA */ + { 7767, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ + { 7784, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ + { 7801, 0x000086AE }, /* GL_DOT3_RGB_ARB */ + { 7817, 0x00008740 }, /* GL_DOT3_RGB_EXT */ + { 7833, 0x0000140A }, /* GL_DOUBLE */ + { 7843, 0x00000C32 }, /* GL_DOUBLEBUFFER */ + { 7859, 0x00000C01 }, /* GL_DRAW_BUFFER */ + { 7874, 0x00008825 }, /* GL_DRAW_BUFFER0 */ + { 7890, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ + { 7910, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ + { 7930, 0x00008826 }, /* GL_DRAW_BUFFER1 */ + { 7946, 0x0000882F }, /* GL_DRAW_BUFFER10 */ + { 7963, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ + { 7984, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ + { 8005, 0x00008830 }, /* GL_DRAW_BUFFER11 */ + { 8022, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ + { 8043, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ + { 8064, 0x00008831 }, /* GL_DRAW_BUFFER12 */ + { 8081, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ + { 8102, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ + { 8123, 0x00008832 }, /* GL_DRAW_BUFFER13 */ + { 8140, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ + { 8161, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ + { 8182, 0x00008833 }, /* GL_DRAW_BUFFER14 */ + { 8199, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ + { 8220, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ + { 8241, 0x00008834 }, /* GL_DRAW_BUFFER15 */ + { 8258, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ + { 8279, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ + { 8300, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ + { 8320, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ + { 8340, 0x00008827 }, /* GL_DRAW_BUFFER2 */ + { 8356, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ + { 8376, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ + { 8396, 0x00008828 }, /* GL_DRAW_BUFFER3 */ + { 8412, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ + { 8432, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ + { 8452, 0x00008829 }, /* GL_DRAW_BUFFER4 */ + { 8468, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ + { 8488, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ + { 8508, 0x0000882A }, /* GL_DRAW_BUFFER5 */ + { 8524, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ + { 8544, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ + { 8564, 0x0000882B }, /* GL_DRAW_BUFFER6 */ + { 8580, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ + { 8600, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ + { 8620, 0x0000882C }, /* GL_DRAW_BUFFER7 */ + { 8636, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ + { 8656, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ + { 8676, 0x0000882D }, /* GL_DRAW_BUFFER8 */ + { 8692, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ + { 8712, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ + { 8732, 0x0000882E }, /* GL_DRAW_BUFFER9 */ + { 8748, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ + { 8768, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ + { 8788, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ + { 8808, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ + { 8840, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ + { 8864, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ + { 8884, 0x00000304 }, /* GL_DST_ALPHA */ + { 8897, 0x00000306 }, /* GL_DST_COLOR */ + { 8910, 0x0000877A }, /* GL_DU8DV8_ATI */ + { 8924, 0x00008779 }, /* GL_DUDV_ATI */ + { 8936, 0x000088EA }, /* GL_DYNAMIC_COPY */ + { 8952, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ + { 8972, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ + { 8988, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ + { 9008, 0x000088E9 }, /* GL_DYNAMIC_READ */ + { 9024, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ + { 9044, 0x00000B43 }, /* GL_EDGE_FLAG */ + { 9057, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ + { 9076, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + { 9110, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ + { 9148, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ + { 9175, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + { 9201, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ + { 9225, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + { 9257, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ + { 9293, 0x00001600 }, /* GL_EMISSION */ + { 9305, 0x00002000 }, /* GL_ENABLE_BIT */ + { 9319, 0x00000202 }, /* GL_EQUAL */ + { 9328, 0x00001509 }, /* GL_EQUIV */ + { 9337, 0x00010000 }, /* GL_EVAL_BIT */ + { 9349, 0x00000800 }, /* GL_EXP */ + { 9356, 0x00000801 }, /* GL_EXP2 */ + { 9364, 0x00001F03 }, /* GL_EXTENSIONS */ + { 9378, 0x00002400 }, /* GL_EYE_LINEAR */ + { 9392, 0x00002502 }, /* GL_EYE_PLANE */ + { 9405, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ + { 9430, 0x0000855B }, /* GL_EYE_RADIAL_NV */ + { 9447, 0x00000000 }, /* GL_FALSE */ + { 9456, 0x00001101 }, /* GL_FASTEST */ + { 9467, 0x00001C01 }, /* GL_FEEDBACK */ + { 9479, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ + { 9506, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ + { 9530, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ + { 9554, 0x00001B02 }, /* GL_FILL */ + { 9562, 0x00001D00 }, /* GL_FLAT */ + { 9570, 0x00001406 }, /* GL_FLOAT */ + { 9579, 0x00008B5A }, /* GL_FLOAT_MAT2 */ + { 9593, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ + { 9611, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ + { 9627, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ + { 9643, 0x00008B5B }, /* GL_FLOAT_MAT3 */ + { 9657, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ + { 9675, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ + { 9691, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ + { 9707, 0x00008B5C }, /* GL_FLOAT_MAT4 */ + { 9721, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ + { 9739, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ + { 9755, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ + { 9771, 0x00008B50 }, /* GL_FLOAT_VEC2 */ + { 9785, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ + { 9803, 0x00008B51 }, /* GL_FLOAT_VEC3 */ + { 9817, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ + { 9835, 0x00008B52 }, /* GL_FLOAT_VEC4 */ + { 9849, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ + { 9867, 0x00000B60 }, /* GL_FOG */ + { 9874, 0x00000080 }, /* GL_FOG_BIT */ + { 9885, 0x00000B66 }, /* GL_FOG_COLOR */ + { 9898, 0x00008451 }, /* GL_FOG_COORD */ + { 9911, 0x00008451 }, /* GL_FOG_COORDINATE */ + { 9929, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ + { 9953, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + { 9992, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ + { 10035, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + { 10067, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + { 10098, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + { 10127, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ + { 10152, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ + { 10171, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ + { 10205, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ + { 10232, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ + { 10258, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ + { 10282, 0x00008450 }, /* GL_FOG_COORD_SRC */ + { 10299, 0x00000B62 }, /* GL_FOG_DENSITY */ + { 10314, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ + { 10338, 0x00000B64 }, /* GL_FOG_END */ + { 10349, 0x00000C54 }, /* GL_FOG_HINT */ + { 10361, 0x00000B61 }, /* GL_FOG_INDEX */ + { 10374, 0x00000B65 }, /* GL_FOG_MODE */ + { 10386, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ + { 10405, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ + { 10430, 0x00000B63 }, /* GL_FOG_START */ + { 10443, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ + { 10461, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ + { 10485, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ + { 10504, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ + { 10527, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + { 10562, 0x00008D40 }, /* GL_FRAMEBUFFER */ + { 10577, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + { 10614, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + { 10650, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + { 10691, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + { 10732, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + { 10769, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + { 10806, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + { 10844, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ + { 10886, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + { 10924, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ + { 10966, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + { 11001, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + { 11040, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ + { 11089, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + { 11137, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ + { 11189, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + { 11229, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ + { 11273, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + { 11313, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ + { 11357, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ + { 11384, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ + { 11408, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ + { 11436, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ + { 11459, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ + { 11478, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + { 11515, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ + { 11556, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + { 11597, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + { 11639, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + { 11690, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + { 11728, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + { 11773, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ + { 11822, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + { 11860, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + { 11902, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + { 11934, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ + { 11959, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ + { 11986, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ + { 12017, 0x00000404 }, /* GL_FRONT */ + { 12026, 0x00000408 }, /* GL_FRONT_AND_BACK */ + { 12044, 0x00000B46 }, /* GL_FRONT_FACE */ + { 12058, 0x00000400 }, /* GL_FRONT_LEFT */ + { 12072, 0x00000401 }, /* GL_FRONT_RIGHT */ + { 12087, 0x00008006 }, /* GL_FUNC_ADD */ + { 12099, 0x00008006 }, /* GL_FUNC_ADD_EXT */ + { 12115, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ + { 12140, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ + { 12169, 0x0000800A }, /* GL_FUNC_SUBTRACT */ + { 12186, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ + { 12207, 0x00008191 }, /* GL_GENERATE_MIPMAP */ + { 12226, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ + { 12250, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ + { 12279, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ + { 12303, 0x00000206 }, /* GL_GEQUAL */ + { 12313, 0x00000204 }, /* GL_GREATER */ + { 12324, 0x00001904 }, /* GL_GREEN */ + { 12333, 0x00000D19 }, /* GL_GREEN_BIAS */ + { 12347, 0x00000D53 }, /* GL_GREEN_BITS */ + { 12361, 0x00000D18 }, /* GL_GREEN_SCALE */ + { 12376, 0x00008000 }, /* GL_HINT_BIT */ + { 12388, 0x00008024 }, /* GL_HISTOGRAM */ + { 12401, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ + { 12425, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ + { 12453, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ + { 12476, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ + { 12503, 0x00008024 }, /* GL_HISTOGRAM_EXT */ + { 12520, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ + { 12540, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ + { 12564, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ + { 12588, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ + { 12616, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + { 12644, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ + { 12676, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ + { 12698, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ + { 12724, 0x0000802D }, /* GL_HISTOGRAM_SINK */ + { 12742, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ + { 12764, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ + { 12783, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ + { 12806, 0x0000862A }, /* GL_IDENTITY_NV */ + { 12821, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ + { 12841, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + { 12881, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + { 12919, 0x00001E02 }, /* GL_INCR */ + { 12927, 0x00008507 }, /* GL_INCR_WRAP */ + { 12940, 0x00008507 }, /* GL_INCR_WRAP_EXT */ + { 12957, 0x00008222 }, /* GL_INDEX */ + { 12966, 0x00008077 }, /* GL_INDEX_ARRAY */ + { 12981, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + { 13011, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ + { 13045, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ + { 13068, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ + { 13090, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ + { 13110, 0x00000D51 }, /* GL_INDEX_BITS */ + { 13124, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ + { 13145, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ + { 13163, 0x00000C30 }, /* GL_INDEX_MODE */ + { 13177, 0x00000D13 }, /* GL_INDEX_OFFSET */ + { 13193, 0x00000D12 }, /* GL_INDEX_SHIFT */ + { 13208, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ + { 13227, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ + { 13246, 0x00001404 }, /* GL_INT */ + { 13253, 0x00008049 }, /* GL_INTENSITY */ + { 13266, 0x0000804C }, /* GL_INTENSITY12 */ + { 13281, 0x0000804C }, /* GL_INTENSITY12_EXT */ + { 13300, 0x0000804D }, /* GL_INTENSITY16 */ + { 13315, 0x0000804D }, /* GL_INTENSITY16_EXT */ + { 13334, 0x0000804A }, /* GL_INTENSITY4 */ + { 13348, 0x0000804A }, /* GL_INTENSITY4_EXT */ + { 13366, 0x0000804B }, /* GL_INTENSITY8 */ + { 13380, 0x0000804B }, /* GL_INTENSITY8_EXT */ + { 13398, 0x00008049 }, /* GL_INTENSITY_EXT */ + { 13415, 0x00008575 }, /* GL_INTERPOLATE */ + { 13430, 0x00008575 }, /* GL_INTERPOLATE_ARB */ + { 13449, 0x00008575 }, /* GL_INTERPOLATE_EXT */ + { 13468, 0x00008B53 }, /* GL_INT_VEC2 */ + { 13480, 0x00008B53 }, /* GL_INT_VEC2_ARB */ + { 13496, 0x00008B54 }, /* GL_INT_VEC3 */ + { 13508, 0x00008B54 }, /* GL_INT_VEC3_ARB */ + { 13524, 0x00008B55 }, /* GL_INT_VEC4 */ + { 13536, 0x00008B55 }, /* GL_INT_VEC4_ARB */ + { 13552, 0x00000500 }, /* GL_INVALID_ENUM */ + { 13568, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + { 13601, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ + { 13638, 0x00000502 }, /* GL_INVALID_OPERATION */ + { 13659, 0x00000501 }, /* GL_INVALID_VALUE */ + { 13676, 0x0000862B }, /* GL_INVERSE_NV */ + { 13690, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ + { 13714, 0x0000150A }, /* GL_INVERT */ + { 13724, 0x00001E00 }, /* GL_KEEP */ + { 13732, 0x00000406 }, /* GL_LEFT */ + { 13740, 0x00000203 }, /* GL_LEQUAL */ + { 13750, 0x00000201 }, /* GL_LESS */ + { 13758, 0x00004000 }, /* GL_LIGHT0 */ + { 13768, 0x00004001 }, /* GL_LIGHT1 */ + { 13778, 0x00004002 }, /* GL_LIGHT2 */ + { 13788, 0x00004003 }, /* GL_LIGHT3 */ + { 13798, 0x00004004 }, /* GL_LIGHT4 */ + { 13808, 0x00004005 }, /* GL_LIGHT5 */ + { 13818, 0x00004006 }, /* GL_LIGHT6 */ + { 13828, 0x00004007 }, /* GL_LIGHT7 */ + { 13838, 0x00000B50 }, /* GL_LIGHTING */ + { 13850, 0x00000040 }, /* GL_LIGHTING_BIT */ + { 13866, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ + { 13889, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + { 13918, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ + { 13951, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + { 13979, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ + { 14003, 0x00001B01 }, /* GL_LINE */ + { 14011, 0x00002601 }, /* GL_LINEAR */ + { 14021, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ + { 14043, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + { 14073, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + { 14104, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ + { 14128, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ + { 14153, 0x00000001 }, /* GL_LINES */ + { 14162, 0x00000004 }, /* GL_LINE_BIT */ + { 14174, 0x00000002 }, /* GL_LINE_LOOP */ + { 14187, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ + { 14207, 0x00000B20 }, /* GL_LINE_SMOOTH */ + { 14222, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ + { 14242, 0x00000B24 }, /* GL_LINE_STIPPLE */ + { 14258, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ + { 14282, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ + { 14305, 0x00000003 }, /* GL_LINE_STRIP */ + { 14319, 0x00000702 }, /* GL_LINE_TOKEN */ + { 14333, 0x00000B21 }, /* GL_LINE_WIDTH */ + { 14347, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ + { 14373, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ + { 14393, 0x00008B82 }, /* GL_LINK_STATUS */ + { 14408, 0x00000B32 }, /* GL_LIST_BASE */ + { 14421, 0x00020000 }, /* GL_LIST_BIT */ + { 14433, 0x00000B33 }, /* GL_LIST_INDEX */ + { 14447, 0x00000B30 }, /* GL_LIST_MODE */ + { 14460, 0x00000101 }, /* GL_LOAD */ + { 14468, 0x00000BF1 }, /* GL_LOGIC_OP */ + { 14480, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ + { 14497, 0x00008CA1 }, /* GL_LOWER_LEFT */ + { 14511, 0x00001909 }, /* GL_LUMINANCE */ + { 14524, 0x00008041 }, /* GL_LUMINANCE12 */ + { 14539, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ + { 14562, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ + { 14589, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ + { 14611, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ + { 14637, 0x00008041 }, /* GL_LUMINANCE12_EXT */ + { 14656, 0x00008042 }, /* GL_LUMINANCE16 */ + { 14671, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ + { 14694, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ + { 14721, 0x00008042 }, /* GL_LUMINANCE16_EXT */ + { 14740, 0x0000803F }, /* GL_LUMINANCE4 */ + { 14754, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ + { 14775, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ + { 14800, 0x0000803F }, /* GL_LUMINANCE4_EXT */ + { 14818, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ + { 14839, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ + { 14864, 0x00008040 }, /* GL_LUMINANCE8 */ + { 14878, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ + { 14899, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ + { 14924, 0x00008040 }, /* GL_LUMINANCE8_EXT */ + { 14942, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ + { 14961, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ + { 14977, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ + { 14997, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ + { 15019, 0x00000D91 }, /* GL_MAP1_INDEX */ + { 15033, 0x00000D92 }, /* GL_MAP1_NORMAL */ + { 15048, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ + { 15072, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ + { 15096, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ + { 15120, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ + { 15144, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ + { 15161, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ + { 15178, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + { 15206, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + { 15235, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + { 15264, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + { 15293, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + { 15322, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + { 15351, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + { 15380, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + { 15408, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + { 15436, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + { 15464, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + { 15492, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + { 15520, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + { 15548, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + { 15576, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + { 15604, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + { 15632, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ + { 15648, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ + { 15668, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ + { 15690, 0x00000DB1 }, /* GL_MAP2_INDEX */ + { 15704, 0x00000DB2 }, /* GL_MAP2_NORMAL */ + { 15719, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ + { 15743, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ + { 15767, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ + { 15791, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ + { 15815, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ + { 15832, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ + { 15849, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + { 15877, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + { 15906, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + { 15935, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + { 15964, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + { 15993, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + { 16022, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + { 16051, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + { 16079, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + { 16107, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + { 16135, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + { 16163, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + { 16191, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + { 16219, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ + { 16247, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + { 16275, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + { 16303, 0x00000D10 }, /* GL_MAP_COLOR */ + { 16316, 0x00000D11 }, /* GL_MAP_STENCIL */ + { 16331, 0x000088C0 }, /* GL_MATRIX0_ARB */ + { 16346, 0x00008630 }, /* GL_MATRIX0_NV */ + { 16360, 0x000088CA }, /* GL_MATRIX10_ARB */ + { 16376, 0x000088CB }, /* GL_MATRIX11_ARB */ + { 16392, 0x000088CC }, /* GL_MATRIX12_ARB */ + { 16408, 0x000088CD }, /* GL_MATRIX13_ARB */ + { 16424, 0x000088CE }, /* GL_MATRIX14_ARB */ + { 16440, 0x000088CF }, /* GL_MATRIX15_ARB */ + { 16456, 0x000088D0 }, /* GL_MATRIX16_ARB */ + { 16472, 0x000088D1 }, /* GL_MATRIX17_ARB */ + { 16488, 0x000088D2 }, /* GL_MATRIX18_ARB */ + { 16504, 0x000088D3 }, /* GL_MATRIX19_ARB */ + { 16520, 0x000088C1 }, /* GL_MATRIX1_ARB */ + { 16535, 0x00008631 }, /* GL_MATRIX1_NV */ + { 16549, 0x000088D4 }, /* GL_MATRIX20_ARB */ + { 16565, 0x000088D5 }, /* GL_MATRIX21_ARB */ + { 16581, 0x000088D6 }, /* GL_MATRIX22_ARB */ + { 16597, 0x000088D7 }, /* GL_MATRIX23_ARB */ + { 16613, 0x000088D8 }, /* GL_MATRIX24_ARB */ + { 16629, 0x000088D9 }, /* GL_MATRIX25_ARB */ + { 16645, 0x000088DA }, /* GL_MATRIX26_ARB */ + { 16661, 0x000088DB }, /* GL_MATRIX27_ARB */ + { 16677, 0x000088DC }, /* GL_MATRIX28_ARB */ + { 16693, 0x000088DD }, /* GL_MATRIX29_ARB */ + { 16709, 0x000088C2 }, /* GL_MATRIX2_ARB */ + { 16724, 0x00008632 }, /* GL_MATRIX2_NV */ + { 16738, 0x000088DE }, /* GL_MATRIX30_ARB */ + { 16754, 0x000088DF }, /* GL_MATRIX31_ARB */ + { 16770, 0x000088C3 }, /* GL_MATRIX3_ARB */ + { 16785, 0x00008633 }, /* GL_MATRIX3_NV */ + { 16799, 0x000088C4 }, /* GL_MATRIX4_ARB */ + { 16814, 0x00008634 }, /* GL_MATRIX4_NV */ + { 16828, 0x000088C5 }, /* GL_MATRIX5_ARB */ + { 16843, 0x00008635 }, /* GL_MATRIX5_NV */ + { 16857, 0x000088C6 }, /* GL_MATRIX6_ARB */ + { 16872, 0x00008636 }, /* GL_MATRIX6_NV */ + { 16886, 0x000088C7 }, /* GL_MATRIX7_ARB */ + { 16901, 0x00008637 }, /* GL_MATRIX7_NV */ + { 16915, 0x000088C8 }, /* GL_MATRIX8_ARB */ + { 16930, 0x000088C9 }, /* GL_MATRIX9_ARB */ + { 16945, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ + { 16971, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + { 17005, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + { 17036, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + { 17069, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + { 17100, 0x00000BA0 }, /* GL_MATRIX_MODE */ + { 17115, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ + { 17137, 0x00008008 }, /* GL_MAX */ + { 17144, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ + { 17167, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + { 17199, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ + { 17225, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + { 17258, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + { 17284, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 17318, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ + { 17337, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + { 17366, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + { 17398, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 17434, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + { 17470, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ + { 17510, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ + { 17536, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ + { 17566, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ + { 17591, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ + { 17620, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + { 17649, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ + { 17682, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ + { 17702, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ + { 17726, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ + { 17750, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ + { 17774, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ + { 17799, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ + { 17817, 0x00008008 }, /* GL_MAX_EXT */ + { 17828, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + { 17863, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ + { 17902, 0x00000D31 }, /* GL_MAX_LIGHTS */ + { 17916, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ + { 17936, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + { 17974, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + { 18003, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ + { 18027, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ + { 18055, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ + { 18078, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 18115, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 18151, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + { 18178, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + { 18207, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + { 18241, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + { 18277, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + { 18304, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + { 18336, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + { 18372, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + { 18401, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + { 18430, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ + { 18458, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + { 18496, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 18540, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 18583, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 18617, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 18656, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 18693, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 18731, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 18774, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 18817, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + { 18847, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + { 18878, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 18914, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 18950, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ + { 18980, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + { 19014, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ + { 19047, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + { 19076, 0x00008D57 }, /* GL_MAX_SAMPLES */ + { 19091, 0x00008504 }, /* GL_MAX_SHININESS_NV */ + { 19111, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ + { 19135, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ + { 19157, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ + { 19183, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + { 19210, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ + { 19241, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ + { 19265, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + { 19299, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ + { 19319, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ + { 19346, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ + { 19367, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ + { 19392, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ + { 19417, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + { 19452, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ + { 19474, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ + { 19500, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ + { 19522, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + { 19548, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + { 19582, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ + { 19620, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + { 19653, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ + { 19690, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ + { 19714, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ + { 19735, 0x00008007 }, /* GL_MIN */ + { 19742, 0x0000802E }, /* GL_MINMAX */ + { 19752, 0x0000802E }, /* GL_MINMAX_EXT */ + { 19766, 0x0000802F }, /* GL_MINMAX_FORMAT */ + { 19783, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ + { 19804, 0x00008030 }, /* GL_MINMAX_SINK */ + { 19819, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ + { 19838, 0x00008007 }, /* GL_MIN_EXT */ + { 19849, 0x00008370 }, /* GL_MIRRORED_REPEAT */ + { 19868, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ + { 19891, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ + { 19914, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ + { 19934, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ + { 19954, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + { 19984, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ + { 20012, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + { 20040, 0x00001700 }, /* GL_MODELVIEW */ + { 20053, 0x00001700 }, /* GL_MODELVIEW0_ARB */ + { 20071, 0x0000872A }, /* GL_MODELVIEW10_ARB */ + { 20090, 0x0000872B }, /* GL_MODELVIEW11_ARB */ + { 20109, 0x0000872C }, /* GL_MODELVIEW12_ARB */ + { 20128, 0x0000872D }, /* GL_MODELVIEW13_ARB */ + { 20147, 0x0000872E }, /* GL_MODELVIEW14_ARB */ + { 20166, 0x0000872F }, /* GL_MODELVIEW15_ARB */ + { 20185, 0x00008730 }, /* GL_MODELVIEW16_ARB */ + { 20204, 0x00008731 }, /* GL_MODELVIEW17_ARB */ + { 20223, 0x00008732 }, /* GL_MODELVIEW18_ARB */ + { 20242, 0x00008733 }, /* GL_MODELVIEW19_ARB */ + { 20261, 0x0000850A }, /* GL_MODELVIEW1_ARB */ + { 20279, 0x00008734 }, /* GL_MODELVIEW20_ARB */ + { 20298, 0x00008735 }, /* GL_MODELVIEW21_ARB */ + { 20317, 0x00008736 }, /* GL_MODELVIEW22_ARB */ + { 20336, 0x00008737 }, /* GL_MODELVIEW23_ARB */ + { 20355, 0x00008738 }, /* GL_MODELVIEW24_ARB */ + { 20374, 0x00008739 }, /* GL_MODELVIEW25_ARB */ + { 20393, 0x0000873A }, /* GL_MODELVIEW26_ARB */ + { 20412, 0x0000873B }, /* GL_MODELVIEW27_ARB */ + { 20431, 0x0000873C }, /* GL_MODELVIEW28_ARB */ + { 20450, 0x0000873D }, /* GL_MODELVIEW29_ARB */ + { 20469, 0x00008722 }, /* GL_MODELVIEW2_ARB */ + { 20487, 0x0000873E }, /* GL_MODELVIEW30_ARB */ + { 20506, 0x0000873F }, /* GL_MODELVIEW31_ARB */ + { 20525, 0x00008723 }, /* GL_MODELVIEW3_ARB */ + { 20543, 0x00008724 }, /* GL_MODELVIEW4_ARB */ + { 20561, 0x00008725 }, /* GL_MODELVIEW5_ARB */ + { 20579, 0x00008726 }, /* GL_MODELVIEW6_ARB */ + { 20597, 0x00008727 }, /* GL_MODELVIEW7_ARB */ + { 20615, 0x00008728 }, /* GL_MODELVIEW8_ARB */ + { 20633, 0x00008729 }, /* GL_MODELVIEW9_ARB */ + { 20651, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ + { 20671, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ + { 20698, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ + { 20723, 0x00002100 }, /* GL_MODULATE */ + { 20735, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ + { 20755, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ + { 20782, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ + { 20807, 0x00000103 }, /* GL_MULT */ + { 20815, 0x0000809D }, /* GL_MULTISAMPLE */ + { 20830, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ + { 20850, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ + { 20869, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ + { 20888, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ + { 20912, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ + { 20935, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + { 20965, 0x00002A25 }, /* GL_N3F_V3F */ + { 20976, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ + { 20996, 0x0000150E }, /* GL_NAND */ + { 21004, 0x00002600 }, /* GL_NEAREST */ + { 21015, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + { 21046, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + { 21078, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ + { 21103, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ + { 21129, 0x00000200 }, /* GL_NEVER */ + { 21138, 0x00001102 }, /* GL_NICEST */ + { 21148, 0x00000000 }, /* GL_NONE */ + { 21156, 0x00001505 }, /* GL_NOOP */ + { 21164, 0x00001508 }, /* GL_NOR */ + { 21171, 0x00000BA1 }, /* GL_NORMALIZE */ + { 21184, 0x00008075 }, /* GL_NORMAL_ARRAY */ + { 21200, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + { 21231, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ + { 21266, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ + { 21290, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ + { 21313, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ + { 21334, 0x00008511 }, /* GL_NORMAL_MAP */ + { 21348, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ + { 21366, 0x00008511 }, /* GL_NORMAL_MAP_NV */ + { 21383, 0x00000205 }, /* GL_NOTEQUAL */ + { 21395, 0x00000000 }, /* GL_NO_ERROR */ + { 21407, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + { 21441, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ + { 21479, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ + { 21511, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ + { 21553, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ + { 21583, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ + { 21623, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ + { 21654, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ + { 21683, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ + { 21711, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ + { 21741, 0x00002401 }, /* GL_OBJECT_LINEAR */ + { 21758, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ + { 21784, 0x00002501 }, /* GL_OBJECT_PLANE */ + { 21800, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ + { 21835, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ + { 21857, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ + { 21876, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ + { 21906, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ + { 21927, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ + { 21955, 0x00000001 }, /* GL_ONE */ + { 21962, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + { 21990, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ + { 22022, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ + { 22050, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ + { 22082, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ + { 22105, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ + { 22128, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ + { 22151, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ + { 22174, 0x00008598 }, /* GL_OPERAND0_ALPHA */ + { 22192, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ + { 22214, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ + { 22236, 0x00008590 }, /* GL_OPERAND0_RGB */ + { 22252, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ + { 22272, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ + { 22292, 0x00008599 }, /* GL_OPERAND1_ALPHA */ + { 22310, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ + { 22332, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ + { 22354, 0x00008591 }, /* GL_OPERAND1_RGB */ + { 22370, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ + { 22390, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ + { 22410, 0x0000859A }, /* GL_OPERAND2_ALPHA */ + { 22428, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ + { 22450, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ + { 22472, 0x00008592 }, /* GL_OPERAND2_RGB */ + { 22488, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ + { 22508, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ + { 22528, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ + { 22549, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ + { 22568, 0x00001507 }, /* GL_OR */ + { 22574, 0x00000A01 }, /* GL_ORDER */ + { 22583, 0x0000150D }, /* GL_OR_INVERTED */ + { 22598, 0x0000150B }, /* GL_OR_REVERSE */ + { 22612, 0x00000505 }, /* GL_OUT_OF_MEMORY */ + { 22629, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ + { 22647, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ + { 22668, 0x00008758 }, /* GL_PACK_INVERT_MESA */ + { 22688, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ + { 22706, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ + { 22725, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ + { 22745, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ + { 22765, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ + { 22783, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ + { 22802, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ + { 22827, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ + { 22851, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ + { 22872, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ + { 22894, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ + { 22916, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ + { 22941, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ + { 22965, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ + { 22986, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ + { 23008, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ + { 23030, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ + { 23052, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ + { 23083, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ + { 23103, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + { 23128, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ + { 23148, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + { 23173, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ + { 23193, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + { 23218, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ + { 23238, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + { 23263, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ + { 23283, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + { 23308, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ + { 23328, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + { 23353, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ + { 23373, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + { 23398, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ + { 23418, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + { 23443, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ + { 23463, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + { 23488, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ + { 23508, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + { 23533, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ + { 23551, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ + { 23572, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ + { 23601, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ + { 23634, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ + { 23659, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ + { 23682, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + { 23713, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ + { 23748, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ + { 23775, 0x00001B00 }, /* GL_POINT */ + { 23784, 0x00000000 }, /* GL_POINTS */ + { 23794, 0x00000002 }, /* GL_POINT_BIT */ + { 23807, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ + { 23837, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ + { 23871, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ + { 23905, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ + { 23940, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ + { 23969, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ + { 24002, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ + { 24035, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ + { 24069, 0x00000B11 }, /* GL_POINT_SIZE */ + { 24083, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ + { 24109, 0x00008127 }, /* GL_POINT_SIZE_MAX */ + { 24127, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ + { 24149, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ + { 24171, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ + { 24194, 0x00008126 }, /* GL_POINT_SIZE_MIN */ + { 24212, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ + { 24234, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ + { 24256, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ + { 24279, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ + { 24299, 0x00000B10 }, /* GL_POINT_SMOOTH */ + { 24315, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ + { 24336, 0x00008861 }, /* GL_POINT_SPRITE */ + { 24352, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ + { 24372, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ + { 24401, 0x00008861 }, /* GL_POINT_SPRITE_NV */ + { 24420, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ + { 24446, 0x00000701 }, /* GL_POINT_TOKEN */ + { 24461, 0x00000009 }, /* GL_POLYGON */ + { 24472, 0x00000008 }, /* GL_POLYGON_BIT */ + { 24487, 0x00000B40 }, /* GL_POLYGON_MODE */ + { 24503, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ + { 24526, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ + { 24551, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ + { 24574, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ + { 24597, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ + { 24621, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ + { 24645, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ + { 24663, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ + { 24686, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ + { 24705, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ + { 24728, 0x00000703 }, /* GL_POLYGON_TOKEN */ + { 24745, 0x00001203 }, /* GL_POSITION */ + { 24757, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + { 24789, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ + { 24825, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + { 24858, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ + { 24895, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + { 24926, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ + { 24961, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + { 24993, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ + { 25029, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + { 25062, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + { 25094, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ + { 25130, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + { 25163, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ + { 25200, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + { 25230, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ + { 25264, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + { 25295, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ + { 25330, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + { 25361, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ + { 25396, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + { 25428, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ + { 25464, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + { 25494, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ + { 25528, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + { 25559, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ + { 25594, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + { 25626, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + { 25657, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ + { 25692, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + { 25724, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ + { 25760, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ + { 25789, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ + { 25822, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ + { 25852, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ + { 25886, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + { 25925, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + { 25958, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + { 25998, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + { 26032, 0x00008578 }, /* GL_PREVIOUS */ + { 26044, 0x00008578 }, /* GL_PREVIOUS_ARB */ + { 26060, 0x00008578 }, /* GL_PREVIOUS_EXT */ + { 26076, 0x00008577 }, /* GL_PRIMARY_COLOR */ + { 26093, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ + { 26114, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ + { 26135, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 26168, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 26200, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ + { 26223, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ + { 26246, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ + { 26276, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ + { 26305, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ + { 26333, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ + { 26355, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + { 26383, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + { 26411, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ + { 26433, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ + { 26454, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 26494, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 26533, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 26563, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 26598, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 26631, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 26665, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 26704, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 26743, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ + { 26765, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ + { 26791, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ + { 26815, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ + { 26838, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ + { 26860, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ + { 26881, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ + { 26902, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ + { 26929, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 26961, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 26993, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + { 27028, 0x00001701 }, /* GL_PROJECTION */ + { 27042, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ + { 27063, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ + { 27089, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ + { 27110, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ + { 27129, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ + { 27152, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + { 27191, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + { 27229, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ + { 27249, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + { 27279, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ + { 27303, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ + { 27323, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + { 27353, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ + { 27377, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ + { 27397, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + { 27430, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ + { 27456, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ + { 27486, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + { 27517, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ + { 27547, 0x00002003 }, /* GL_Q */ + { 27552, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ + { 27577, 0x00000007 }, /* GL_QUADS */ + { 27586, 0x00008614 }, /* GL_QUAD_MESH_SUN */ + { 27603, 0x00000008 }, /* GL_QUAD_STRIP */ + { 27617, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ + { 27639, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ + { 27665, 0x00008866 }, /* GL_QUERY_RESULT */ + { 27681, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ + { 27701, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ + { 27727, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ + { 27757, 0x00002002 }, /* GL_R */ + { 27762, 0x00002A10 }, /* GL_R3_G3_B2 */ + { 27774, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + { 27807, 0x00000C02 }, /* GL_READ_BUFFER */ + { 27822, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ + { 27842, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + { 27874, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ + { 27898, 0x000088B8 }, /* GL_READ_ONLY */ + { 27911, 0x000088B8 }, /* GL_READ_ONLY_ARB */ + { 27928, 0x000088BA }, /* GL_READ_WRITE */ + { 27942, 0x000088BA }, /* GL_READ_WRITE_ARB */ + { 27960, 0x00001903 }, /* GL_RED */ + { 27967, 0x00008016 }, /* GL_REDUCE */ + { 27977, 0x00008016 }, /* GL_REDUCE_EXT */ + { 27991, 0x00000D15 }, /* GL_RED_BIAS */ + { 28003, 0x00000D52 }, /* GL_RED_BITS */ + { 28015, 0x00000D14 }, /* GL_RED_SCALE */ + { 28028, 0x00008512 }, /* GL_REFLECTION_MAP */ + { 28046, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ + { 28068, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ + { 28089, 0x00001C00 }, /* GL_RENDER */ + { 28099, 0x00008D41 }, /* GL_RENDERBUFFER */ + { 28115, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ + { 28142, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ + { 28170, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ + { 28196, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ + { 28223, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ + { 28243, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ + { 28270, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ + { 28293, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ + { 28320, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + { 28352, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ + { 28388, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ + { 28413, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ + { 28437, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ + { 28466, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ + { 28488, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ + { 28514, 0x00001F01 }, /* GL_RENDERER */ + { 28526, 0x00000C40 }, /* GL_RENDER_MODE */ + { 28541, 0x00002901 }, /* GL_REPEAT */ + { 28551, 0x00001E01 }, /* GL_REPLACE */ + { 28562, 0x00008062 }, /* GL_REPLACE_EXT */ + { 28577, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ + { 28600, 0x0000803A }, /* GL_RESCALE_NORMAL */ + { 28618, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ + { 28640, 0x00000102 }, /* GL_RETURN */ + { 28650, 0x00001907 }, /* GL_RGB */ + { 28657, 0x00008052 }, /* GL_RGB10 */ + { 28666, 0x00008059 }, /* GL_RGB10_A2 */ + { 28678, 0x00008059 }, /* GL_RGB10_A2_EXT */ + { 28694, 0x00008052 }, /* GL_RGB10_EXT */ + { 28707, 0x00008053 }, /* GL_RGB12 */ + { 28716, 0x00008053 }, /* GL_RGB12_EXT */ + { 28729, 0x00008054 }, /* GL_RGB16 */ + { 28738, 0x00008054 }, /* GL_RGB16_EXT */ + { 28751, 0x0000804E }, /* GL_RGB2_EXT */ + { 28763, 0x0000804F }, /* GL_RGB4 */ + { 28771, 0x0000804F }, /* GL_RGB4_EXT */ + { 28783, 0x000083A1 }, /* GL_RGB4_S3TC */ + { 28796, 0x00008050 }, /* GL_RGB5 */ + { 28804, 0x00008057 }, /* GL_RGB5_A1 */ + { 28815, 0x00008057 }, /* GL_RGB5_A1_EXT */ + { 28830, 0x00008050 }, /* GL_RGB5_EXT */ + { 28842, 0x00008051 }, /* GL_RGB8 */ + { 28850, 0x00008051 }, /* GL_RGB8_EXT */ + { 28862, 0x00001908 }, /* GL_RGBA */ + { 28870, 0x0000805A }, /* GL_RGBA12 */ + { 28880, 0x0000805A }, /* GL_RGBA12_EXT */ + { 28894, 0x0000805B }, /* GL_RGBA16 */ + { 28904, 0x0000805B }, /* GL_RGBA16_EXT */ + { 28918, 0x00008055 }, /* GL_RGBA2 */ + { 28927, 0x00008055 }, /* GL_RGBA2_EXT */ + { 28940, 0x00008056 }, /* GL_RGBA4 */ + { 28949, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ + { 28968, 0x00008056 }, /* GL_RGBA4_EXT */ + { 28981, 0x000083A3 }, /* GL_RGBA4_S3TC */ + { 28995, 0x00008058 }, /* GL_RGBA8 */ + { 29004, 0x00008058 }, /* GL_RGBA8_EXT */ + { 29017, 0x00008F97 }, /* GL_RGBA8_SNORM */ + { 29032, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ + { 29050, 0x00000C31 }, /* GL_RGBA_MODE */ + { 29063, 0x000083A2 }, /* GL_RGBA_S3TC */ + { 29076, 0x00008F93 }, /* GL_RGBA_SNORM */ + { 29090, 0x000083A0 }, /* GL_RGB_S3TC */ + { 29102, 0x00008573 }, /* GL_RGB_SCALE */ + { 29115, 0x00008573 }, /* GL_RGB_SCALE_ARB */ + { 29132, 0x00008573 }, /* GL_RGB_SCALE_EXT */ + { 29149, 0x00000407 }, /* GL_RIGHT */ + { 29158, 0x00002000 }, /* GL_S */ + { 29163, 0x00008B5D }, /* GL_SAMPLER_1D */ + { 29177, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ + { 29198, 0x00008B5E }, /* GL_SAMPLER_2D */ + { 29212, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ + { 29233, 0x00008B5F }, /* GL_SAMPLER_3D */ + { 29247, 0x00008B60 }, /* GL_SAMPLER_CUBE */ + { 29263, 0x000080A9 }, /* GL_SAMPLES */ + { 29274, 0x000086B4 }, /* GL_SAMPLES_3DFX */ + { 29290, 0x000080A9 }, /* GL_SAMPLES_ARB */ + { 29305, 0x00008914 }, /* GL_SAMPLES_PASSED */ + { 29323, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ + { 29345, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + { 29373, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ + { 29405, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ + { 29428, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ + { 29455, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ + { 29473, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ + { 29496, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ + { 29518, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ + { 29537, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ + { 29560, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ + { 29586, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ + { 29616, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ + { 29641, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ + { 29670, 0x00080000 }, /* GL_SCISSOR_BIT */ + { 29685, 0x00000C10 }, /* GL_SCISSOR_BOX */ + { 29700, 0x00000C11 }, /* GL_SCISSOR_TEST */ + { 29716, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ + { 29741, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + { 29781, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 29825, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + { 29858, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + { 29888, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + { 29920, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + { 29950, 0x00001C02 }, /* GL_SELECT */ + { 29960, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ + { 29988, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ + { 30013, 0x00008012 }, /* GL_SEPARABLE_2D */ + { 30029, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ + { 30056, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ + { 30087, 0x0000150F }, /* GL_SET */ + { 30094, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ + { 30115, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ + { 30139, 0x00008B4F }, /* GL_SHADER_TYPE */ + { 30154, 0x00000B54 }, /* GL_SHADE_MODEL */ + { 30169, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ + { 30197, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ + { 30220, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + { 30250, 0x00001601 }, /* GL_SHININESS */ + { 30263, 0x00001402 }, /* GL_SHORT */ + { 30272, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ + { 30293, 0x000081F9 }, /* GL_SINGLE_COLOR */ + { 30309, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ + { 30329, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ + { 30348, 0x00008C46 }, /* GL_SLUMINANCE */ + { 30362, 0x00008C47 }, /* GL_SLUMINANCE8 */ + { 30377, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ + { 30399, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ + { 30419, 0x00001D01 }, /* GL_SMOOTH */ + { 30429, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ + { 30462, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ + { 30489, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ + { 30522, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ + { 30549, 0x00008588 }, /* GL_SOURCE0_ALPHA */ + { 30566, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ + { 30587, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ + { 30608, 0x00008580 }, /* GL_SOURCE0_RGB */ + { 30623, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ + { 30642, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ + { 30661, 0x00008589 }, /* GL_SOURCE1_ALPHA */ + { 30678, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ + { 30699, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ + { 30720, 0x00008581 }, /* GL_SOURCE1_RGB */ + { 30735, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ + { 30754, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ + { 30773, 0x0000858A }, /* GL_SOURCE2_ALPHA */ + { 30790, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ + { 30811, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ + { 30832, 0x00008582 }, /* GL_SOURCE2_RGB */ + { 30847, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ + { 30866, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ + { 30885, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ + { 30905, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ + { 30923, 0x00001202 }, /* GL_SPECULAR */ + { 30935, 0x00002402 }, /* GL_SPHERE_MAP */ + { 30949, 0x00001206 }, /* GL_SPOT_CUTOFF */ + { 30964, 0x00001204 }, /* GL_SPOT_DIRECTION */ + { 30982, 0x00001205 }, /* GL_SPOT_EXPONENT */ + { 30999, 0x00008588 }, /* GL_SRC0_ALPHA */ + { 31013, 0x00008580 }, /* GL_SRC0_RGB */ + { 31025, 0x00008589 }, /* GL_SRC1_ALPHA */ + { 31039, 0x00008581 }, /* GL_SRC1_RGB */ + { 31051, 0x0000858A }, /* GL_SRC2_ALPHA */ + { 31065, 0x00008582 }, /* GL_SRC2_RGB */ + { 31077, 0x00000302 }, /* GL_SRC_ALPHA */ + { 31090, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ + { 31112, 0x00000300 }, /* GL_SRC_COLOR */ + { 31125, 0x00008C40 }, /* GL_SRGB */ + { 31133, 0x00008C41 }, /* GL_SRGB8 */ + { 31142, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ + { 31158, 0x00008C42 }, /* GL_SRGB_ALPHA */ + { 31172, 0x00000503 }, /* GL_STACK_OVERFLOW */ + { 31190, 0x00000504 }, /* GL_STACK_UNDERFLOW */ + { 31209, 0x000088E6 }, /* GL_STATIC_COPY */ + { 31224, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ + { 31243, 0x000088E4 }, /* GL_STATIC_DRAW */ + { 31258, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ + { 31277, 0x000088E5 }, /* GL_STATIC_READ */ + { 31292, 0x000088E5 }, /* GL_STATIC_READ_ARB */ + { 31311, 0x00001802 }, /* GL_STENCIL */ + { 31322, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ + { 31344, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ + { 31370, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ + { 31391, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ + { 31416, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ + { 31437, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ + { 31462, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + { 31494, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ + { 31530, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + { 31562, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ + { 31598, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ + { 31618, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ + { 31645, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ + { 31671, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 31687, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 31709, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 31732, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 31748, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 31764, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 31781, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 31804, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 31826, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 31848, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 31870, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 31891, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 31918, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 31945, 0x00000B97 }, /* GL_STENCIL_REF */ + { 31960, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 31976, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 32005, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 32027, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 32048, 0x00000C33 }, /* GL_STEREO */ + { 32058, 0x000088E2 }, /* GL_STREAM_COPY */ + { 32073, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 32092, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 32107, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 32126, 0x000088E1 }, /* GL_STREAM_READ */ + { 32141, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 32160, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 32177, 0x000084E7 }, /* GL_SUBTRACT */ + { 32189, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 32205, 0x00002001 }, /* GL_T */ + { 32210, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 32225, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 32244, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 32260, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 32275, 0x00002A27 }, /* GL_T2F_V3F */ + { 32286, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 32305, 0x00002A28 }, /* GL_T4F_V4F */ + { 32316, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 32339, 0x00001702 }, /* GL_TEXTURE */ + { 32350, 0x000084C0 }, /* GL_TEXTURE0 */ + { 32362, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 32378, 0x000084C1 }, /* GL_TEXTURE1 */ + { 32390, 0x000084CA }, /* GL_TEXTURE10 */ + { 32403, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 32420, 0x000084CB }, /* GL_TEXTURE11 */ + { 32433, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 32450, 0x000084CC }, /* GL_TEXTURE12 */ + { 32463, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 32480, 0x000084CD }, /* GL_TEXTURE13 */ + { 32493, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 32510, 0x000084CE }, /* GL_TEXTURE14 */ + { 32523, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 32540, 0x000084CF }, /* GL_TEXTURE15 */ + { 32553, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 32570, 0x000084D0 }, /* GL_TEXTURE16 */ + { 32583, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 32600, 0x000084D1 }, /* GL_TEXTURE17 */ + { 32613, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 32630, 0x000084D2 }, /* GL_TEXTURE18 */ + { 32643, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 32660, 0x000084D3 }, /* GL_TEXTURE19 */ + { 32673, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 32690, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 32706, 0x000084C2 }, /* GL_TEXTURE2 */ + { 32718, 0x000084D4 }, /* GL_TEXTURE20 */ + { 32731, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 32748, 0x000084D5 }, /* GL_TEXTURE21 */ + { 32761, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 32778, 0x000084D6 }, /* GL_TEXTURE22 */ + { 32791, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 32808, 0x000084D7 }, /* GL_TEXTURE23 */ + { 32821, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 32838, 0x000084D8 }, /* GL_TEXTURE24 */ + { 32851, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 32868, 0x000084D9 }, /* GL_TEXTURE25 */ + { 32881, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 32898, 0x000084DA }, /* GL_TEXTURE26 */ + { 32911, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 32928, 0x000084DB }, /* GL_TEXTURE27 */ + { 32941, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 32958, 0x000084DC }, /* GL_TEXTURE28 */ + { 32971, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 32988, 0x000084DD }, /* GL_TEXTURE29 */ + { 33001, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 33018, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 33034, 0x000084C3 }, /* GL_TEXTURE3 */ + { 33046, 0x000084DE }, /* GL_TEXTURE30 */ + { 33059, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 33076, 0x000084DF }, /* GL_TEXTURE31 */ + { 33089, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 33106, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 33122, 0x000084C4 }, /* GL_TEXTURE4 */ + { 33134, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 33150, 0x000084C5 }, /* GL_TEXTURE5 */ + { 33162, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 33178, 0x000084C6 }, /* GL_TEXTURE6 */ + { 33190, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 33206, 0x000084C7 }, /* GL_TEXTURE7 */ + { 33218, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 33234, 0x000084C8 }, /* GL_TEXTURE8 */ + { 33246, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 33262, 0x000084C9 }, /* GL_TEXTURE9 */ + { 33274, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 33290, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 33304, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ + { 33328, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 33342, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ + { 33366, 0x0000806F }, /* GL_TEXTURE_3D */ + { 33380, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 33402, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 33428, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 33450, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 33472, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + { 33504, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 33526, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + { 33558, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 33580, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 33608, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 33640, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 33673, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 33705, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 33720, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 33741, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 33766, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 33784, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 33808, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 33839, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 33869, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 33899, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 33934, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 33965, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 34003, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 34030, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 34062, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 34096, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 34120, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 34148, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 34172, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 34200, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 34233, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 34257, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 34279, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 34301, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 34327, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 34361, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 34394, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 34431, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 34459, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 34491, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 34514, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 34552, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 34594, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 34625, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 34653, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 34683, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 34711, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 34731, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 34755, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 34786, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 34821, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 34852, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 34887, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 34918, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 34953, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 34984, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 35019, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 35050, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 35085, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 35116, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 35151, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 35168, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 35190, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 35216, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 35231, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 35252, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 35272, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 35298, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 35318, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 35335, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 35352, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 35369, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 35386, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 35411, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 35433, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 35459, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 35477, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 35503, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 35529, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 35559, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 35586, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 35611, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 35631, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 35655, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 35682, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 35709, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 35736, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 35762, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 35792, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 35814, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 35832, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 35862, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 35890, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 35918, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 35946, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 35967, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 35986, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 36008, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 36027, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 36047, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 36072, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 36096, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 36116, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 36140, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 36160, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 36183, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ + { 36207, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 36232, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 36266, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 36283, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 36301, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 36319, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 36337, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ + { 36357, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 36376, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 36405, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 36422, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 36448, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 36478, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 36510, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 36540, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 36574, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 36590, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 36621, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 36656, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 36684, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 36716, 0x00000004 }, /* GL_TRIANGLES */ + { 36729, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 36745, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 36766, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 36784, 0x00000001 }, /* GL_TRUE */ + { 36792, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 36812, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 36835, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 36855, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 36876, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 36898, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 36920, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 36940, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 36961, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 36978, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 37005, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 37028, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 37044, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 37071, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ + { 37092, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 37116, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 37147, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 37171, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 37199, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ + { 37222, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 37240, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 37270, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 37296, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 37326, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 37352, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 37376, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 37404, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 37432, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 37459, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 37491, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 37522, 0x00008CA2 }, /* GL_UPPER_LEFT */ + { 37536, 0x00002A20 }, /* GL_V2F */ + { 37543, 0x00002A21 }, /* GL_V3F */ + { 37550, 0x00008B83 }, /* GL_VALIDATE_STATUS */ + { 37569, 0x00001F00 }, /* GL_VENDOR */ + { 37579, 0x00001F02 }, /* GL_VERSION */ + { 37590, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 37606, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + { 37636, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 37667, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 37702, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 37726, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 37747, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 37770, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 37791, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 37818, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 37846, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 37874, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 37902, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 37930, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 37958, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 37986, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 38013, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 38040, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 38067, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 38094, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 38121, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 38148, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 38175, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 38202, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 38229, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 38267, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 38309, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + { 38340, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 38375, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + { 38409, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 38447, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + { 38478, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 38513, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + { 38541, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 38573, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + { 38603, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 38637, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + { 38665, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 38697, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 38717, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 38739, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 38768, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 38789, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + { 38818, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 38851, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 38883, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + { 38910, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 38941, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 38971, 0x00008B31 }, /* GL_VERTEX_SHADER */ + { 38988, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 39009, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 39036, 0x00000BA2 }, /* GL_VIEWPORT */ + { 39048, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 39064, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 39084, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 39115, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 39150, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 39178, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 39203, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 39230, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 39255, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 39279, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 39298, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 39312, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 39330, 0x00001506 }, /* GL_XOR */ + { 39337, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 39356, 0x00008757 }, /* GL_YCBCR_MESA */ + { 39370, 0x00000000 }, /* GL_ZERO */ + { 39378, 0x00000D16 }, /* GL_ZOOM_X */ + { 39388, 0x00000D17 }, /* GL_ZOOM_Y */ }; -static const unsigned reduced_enums[1316] = +static const unsigned reduced_enums[1319] = { - 463, /* GL_FALSE */ - 695, /* GL_LINES */ - 697, /* GL_LINE_LOOP */ - 704, /* GL_LINE_STRIP */ - 1707, /* GL_TRIANGLES */ - 1710, /* GL_TRIANGLE_STRIP */ - 1708, /* GL_TRIANGLE_FAN */ - 1262, /* GL_QUADS */ - 1264, /* GL_QUAD_STRIP */ - 1150, /* GL_POLYGON */ - 1162, /* GL_POLYGON_STIPPLE_BIT */ - 1115, /* GL_PIXEL_MODE_BIT */ - 682, /* GL_LIGHTING_BIT */ - 485, /* GL_FOG_BIT */ + 469, /* GL_FALSE */ + 683, /* GL_LINES */ + 685, /* GL_LINE_LOOP */ + 692, /* GL_LINE_STRIP */ + 1709, /* GL_TRIANGLES */ + 1712, /* GL_TRIANGLE_STRIP */ + 1710, /* GL_TRIANGLE_FAN */ + 1254, /* GL_QUADS */ + 1256, /* GL_QUAD_STRIP */ + 1142, /* GL_POLYGON */ + 1154, /* GL_POLYGON_STIPPLE_BIT */ + 1103, /* GL_PIXEL_MODE_BIT */ + 670, /* GL_LIGHTING_BIT */ + 497, /* GL_FOG_BIT */ 8, /* GL_ACCUM */ - 714, /* GL_LOAD */ - 1316, /* GL_RETURN */ - 988, /* GL_MULT */ + 702, /* GL_LOAD */ + 1308, /* GL_RETURN */ + 976, /* GL_MULT */ 23, /* GL_ADD */ - 1004, /* GL_NEVER */ - 672, /* GL_LESS */ - 453, /* GL_EQUAL */ - 671, /* GL_LEQUAL */ - 595, /* GL_GREATER */ - 1019, /* GL_NOTEQUAL */ - 570, /* GL_GEQUAL */ + 992, /* GL_NEVER */ + 660, /* GL_LESS */ + 459, /* GL_EQUAL */ + 659, /* GL_LEQUAL */ + 583, /* GL_GREATER */ + 1007, /* GL_NOTEQUAL */ + 582, /* GL_GEQUAL */ 46, /* GL_ALWAYS */ - 1449, /* GL_SRC_COLOR */ - 1048, /* GL_ONE_MINUS_SRC_COLOR */ - 1447, /* GL_SRC_ALPHA */ - 1047, /* GL_ONE_MINUS_SRC_ALPHA */ - 432, /* GL_DST_ALPHA */ - 1045, /* GL_ONE_MINUS_DST_ALPHA */ - 433, /* GL_DST_COLOR */ - 1046, /* GL_ONE_MINUS_DST_COLOR */ - 1448, /* GL_SRC_ALPHA_SATURATE */ - 558, /* GL_FRONT_LEFT */ - 559, /* GL_FRONT_RIGHT */ + 1448, /* GL_SRC_COLOR */ + 1036, /* GL_ONE_MINUS_SRC_COLOR */ + 1446, /* GL_SRC_ALPHA */ + 1035, /* GL_ONE_MINUS_SRC_ALPHA */ + 438, /* GL_DST_ALPHA */ + 1033, /* GL_ONE_MINUS_DST_ALPHA */ + 439, /* GL_DST_COLOR */ + 1034, /* GL_ONE_MINUS_DST_COLOR */ + 1447, /* GL_SRC_ALPHA_SATURATE */ + 570, /* GL_FRONT_LEFT */ + 571, /* GL_FRONT_RIGHT */ 68, /* GL_BACK_LEFT */ 69, /* GL_BACK_RIGHT */ - 555, /* GL_FRONT */ + 567, /* GL_FRONT */ 67, /* GL_BACK */ - 670, /* GL_LEFT */ - 1356, /* GL_RIGHT */ - 556, /* GL_FRONT_AND_BACK */ + 658, /* GL_LEFT */ + 1350, /* GL_RIGHT */ + 568, /* GL_FRONT_AND_BACK */ 62, /* GL_AUX0 */ 63, /* GL_AUX1 */ 64, /* GL_AUX2 */ 65, /* GL_AUX3 */ - 661, /* GL_INVALID_ENUM */ - 665, /* GL_INVALID_VALUE */ - 664, /* GL_INVALID_OPERATION */ - 1451, /* GL_STACK_OVERFLOW */ - 1452, /* GL_STACK_UNDERFLOW */ - 1073, /* GL_OUT_OF_MEMORY */ - 662, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + 649, /* GL_INVALID_ENUM */ + 653, /* GL_INVALID_VALUE */ + 652, /* GL_INVALID_OPERATION */ + 1453, /* GL_STACK_OVERFLOW */ + 1454, /* GL_STACK_UNDERFLOW */ + 1061, /* GL_OUT_OF_MEMORY */ + 650, /* GL_INVALID_FRAMEBUFFER_OPERATION */ 0, /* GL_2D */ 2, /* GL_3D */ 3, /* GL_3D_COLOR */ 4, /* GL_3D_COLOR_TEXTURE */ 6, /* GL_4D_COLOR_TEXTURE */ - 1093, /* GL_PASS_THROUGH_TOKEN */ - 1149, /* GL_POINT_TOKEN */ - 705, /* GL_LINE_TOKEN */ - 1163, /* GL_POLYGON_TOKEN */ + 1081, /* GL_PASS_THROUGH_TOKEN */ + 1141, /* GL_POINT_TOKEN */ + 693, /* GL_LINE_TOKEN */ + 1155, /* GL_POLYGON_TOKEN */ 73, /* GL_BITMAP_TOKEN */ - 431, /* GL_DRAW_PIXEL_TOKEN */ - 292, /* GL_COPY_PIXEL_TOKEN */ - 698, /* GL_LINE_RESET_TOKEN */ - 456, /* GL_EXP */ - 457, /* GL_EXP2 */ - 325, /* GL_CW */ - 121, /* GL_CCW */ - 142, /* GL_COEFF */ - 1070, /* GL_ORDER */ - 369, /* GL_DOMAIN */ - 300, /* GL_CURRENT_COLOR */ - 303, /* GL_CURRENT_INDEX */ - 309, /* GL_CURRENT_NORMAL */ - 321, /* GL_CURRENT_TEXTURE_COORDS */ - 314, /* GL_CURRENT_RASTER_COLOR */ - 316, /* GL_CURRENT_RASTER_INDEX */ - 319, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ - 317, /* GL_CURRENT_RASTER_POSITION */ - 318, /* GL_CURRENT_RASTER_POSITION_VALID */ - 315, /* GL_CURRENT_RASTER_DISTANCE */ - 1142, /* GL_POINT_SMOOTH */ - 1131, /* GL_POINT_SIZE */ - 1141, /* GL_POINT_SIZE_RANGE */ - 1132, /* GL_POINT_SIZE_GRANULARITY */ - 699, /* GL_LINE_SMOOTH */ - 706, /* GL_LINE_WIDTH */ - 708, /* GL_LINE_WIDTH_RANGE */ - 707, /* GL_LINE_WIDTH_GRANULARITY */ - 701, /* GL_LINE_STIPPLE */ - 702, /* GL_LINE_STIPPLE_PATTERN */ - 703, /* GL_LINE_STIPPLE_REPEAT */ - 713, /* GL_LIST_MODE */ - 872, /* GL_MAX_LIST_NESTING */ - 710, /* GL_LIST_BASE */ - 712, /* GL_LIST_INDEX */ - 1152, /* GL_POLYGON_MODE */ - 1159, /* GL_POLYGON_SMOOTH */ - 1161, /* GL_POLYGON_STIPPLE */ - 442, /* GL_EDGE_FLAG */ - 293, /* GL_CULL_FACE */ - 294, /* GL_CULL_FACE_MODE */ - 557, /* GL_FRONT_FACE */ - 681, /* GL_LIGHTING */ - 686, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - 687, /* GL_LIGHT_MODEL_TWO_SIDE */ - 683, /* GL_LIGHT_MODEL_AMBIENT */ - 1402, /* GL_SHADE_MODEL */ - 189, /* GL_COLOR_MATERIAL_FACE */ - 190, /* GL_COLOR_MATERIAL_PARAMETER */ - 188, /* GL_COLOR_MATERIAL */ - 484, /* GL_FOG */ - 506, /* GL_FOG_INDEX */ - 502, /* GL_FOG_DENSITY */ - 510, /* GL_FOG_START */ - 504, /* GL_FOG_END */ - 507, /* GL_FOG_MODE */ - 486, /* GL_FOG_COLOR */ - 356, /* GL_DEPTH_RANGE */ - 363, /* GL_DEPTH_TEST */ - 366, /* GL_DEPTH_WRITEMASK */ - 344, /* GL_DEPTH_CLEAR_VALUE */ - 355, /* GL_DEPTH_FUNC */ + 437, /* GL_DRAW_PIXEL_TOKEN */ + 297, /* GL_COPY_PIXEL_TOKEN */ + 686, /* GL_LINE_RESET_TOKEN */ + 462, /* GL_EXP */ + 463, /* GL_EXP2 */ + 331, /* GL_CW */ + 122, /* GL_CCW */ + 143, /* GL_COEFF */ + 1058, /* GL_ORDER */ + 375, /* GL_DOMAIN */ + 305, /* GL_CURRENT_COLOR */ + 308, /* GL_CURRENT_INDEX */ + 314, /* GL_CURRENT_NORMAL */ + 327, /* GL_CURRENT_TEXTURE_COORDS */ + 319, /* GL_CURRENT_RASTER_COLOR */ + 321, /* GL_CURRENT_RASTER_INDEX */ + 325, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + 322, /* GL_CURRENT_RASTER_POSITION */ + 323, /* GL_CURRENT_RASTER_POSITION_VALID */ + 320, /* GL_CURRENT_RASTER_DISTANCE */ + 1134, /* GL_POINT_SMOOTH */ + 1123, /* GL_POINT_SIZE */ + 1133, /* GL_POINT_SIZE_RANGE */ + 1124, /* GL_POINT_SIZE_GRANULARITY */ + 687, /* GL_LINE_SMOOTH */ + 694, /* GL_LINE_WIDTH */ + 696, /* GL_LINE_WIDTH_RANGE */ + 695, /* GL_LINE_WIDTH_GRANULARITY */ + 689, /* GL_LINE_STIPPLE */ + 690, /* GL_LINE_STIPPLE_PATTERN */ + 691, /* GL_LINE_STIPPLE_REPEAT */ + 701, /* GL_LIST_MODE */ + 860, /* GL_MAX_LIST_NESTING */ + 698, /* GL_LIST_BASE */ + 700, /* GL_LIST_INDEX */ + 1144, /* GL_POLYGON_MODE */ + 1151, /* GL_POLYGON_SMOOTH */ + 1153, /* GL_POLYGON_STIPPLE */ + 448, /* GL_EDGE_FLAG */ + 298, /* GL_CULL_FACE */ + 299, /* GL_CULL_FACE_MODE */ + 569, /* GL_FRONT_FACE */ + 669, /* GL_LIGHTING */ + 674, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + 675, /* GL_LIGHT_MODEL_TWO_SIDE */ + 671, /* GL_LIGHT_MODEL_AMBIENT */ + 1396, /* GL_SHADE_MODEL */ + 190, /* GL_COLOR_MATERIAL_FACE */ + 191, /* GL_COLOR_MATERIAL_PARAMETER */ + 189, /* GL_COLOR_MATERIAL */ + 496, /* GL_FOG */ + 518, /* GL_FOG_INDEX */ + 514, /* GL_FOG_DENSITY */ + 522, /* GL_FOG_START */ + 516, /* GL_FOG_END */ + 519, /* GL_FOG_MODE */ + 498, /* GL_FOG_COLOR */ + 362, /* GL_DEPTH_RANGE */ + 369, /* GL_DEPTH_TEST */ + 372, /* GL_DEPTH_WRITEMASK */ + 350, /* GL_DEPTH_CLEAR_VALUE */ + 361, /* GL_DEPTH_FUNC */ 12, /* GL_ACCUM_CLEAR_VALUE */ - 1487, /* GL_STENCIL_TEST */ - 1475, /* GL_STENCIL_CLEAR_VALUE */ - 1477, /* GL_STENCIL_FUNC */ - 1489, /* GL_STENCIL_VALUE_MASK */ - 1476, /* GL_STENCIL_FAIL */ - 1484, /* GL_STENCIL_PASS_DEPTH_FAIL */ - 1485, /* GL_STENCIL_PASS_DEPTH_PASS */ - 1486, /* GL_STENCIL_REF */ - 1490, /* GL_STENCIL_WRITEMASK */ - 841, /* GL_MATRIX_MODE */ - 1009, /* GL_NORMALIZE */ - 1799, /* GL_VIEWPORT */ - 983, /* GL_MODELVIEW_STACK_DEPTH */ - 1242, /* GL_PROJECTION_STACK_DEPTH */ - 1685, /* GL_TEXTURE_STACK_DEPTH */ - 981, /* GL_MODELVIEW_MATRIX */ - 1241, /* GL_PROJECTION_MATRIX */ - 1670, /* GL_TEXTURE_MATRIX */ + 1489, /* GL_STENCIL_TEST */ + 1477, /* GL_STENCIL_CLEAR_VALUE */ + 1479, /* GL_STENCIL_FUNC */ + 1491, /* GL_STENCIL_VALUE_MASK */ + 1478, /* GL_STENCIL_FAIL */ + 1486, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1487, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1488, /* GL_STENCIL_REF */ + 1492, /* GL_STENCIL_WRITEMASK */ + 829, /* GL_MATRIX_MODE */ + 997, /* GL_NORMALIZE */ + 1801, /* GL_VIEWPORT */ + 971, /* GL_MODELVIEW_STACK_DEPTH */ + 1234, /* GL_PROJECTION_STACK_DEPTH */ + 1687, /* GL_TEXTURE_STACK_DEPTH */ + 969, /* GL_MODELVIEW_MATRIX */ + 1233, /* GL_PROJECTION_MATRIX */ + 1672, /* GL_TEXTURE_MATRIX */ 60, /* GL_ATTRIB_STACK_DEPTH */ - 132, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ + 133, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ 43, /* GL_ALPHA_TEST */ 44, /* GL_ALPHA_TEST_FUNC */ 45, /* GL_ALPHA_TEST_REF */ - 368, /* GL_DITHER */ + 374, /* GL_DITHER */ 77, /* GL_BLEND_DST */ - 85, /* GL_BLEND_SRC */ + 86, /* GL_BLEND_SRC */ 74, /* GL_BLEND */ - 716, /* GL_LOGIC_OP_MODE */ - 635, /* GL_INDEX_LOGIC_OP */ - 187, /* GL_COLOR_LOGIC_OP */ + 704, /* GL_LOGIC_OP_MODE */ + 623, /* GL_INDEX_LOGIC_OP */ + 188, /* GL_COLOR_LOGIC_OP */ 66, /* GL_AUX_BUFFERS */ - 379, /* GL_DRAW_BUFFER */ - 1274, /* GL_READ_BUFFER */ - 1383, /* GL_SCISSOR_BOX */ - 1384, /* GL_SCISSOR_TEST */ - 634, /* GL_INDEX_CLEAR_VALUE */ - 639, /* GL_INDEX_WRITEMASK */ - 184, /* GL_COLOR_CLEAR_VALUE */ - 226, /* GL_COLOR_WRITEMASK */ - 636, /* GL_INDEX_MODE */ - 1350, /* GL_RGBA_MODE */ - 378, /* GL_DOUBLEBUFFER */ - 1491, /* GL_STEREO */ - 1309, /* GL_RENDER_MODE */ - 1094, /* GL_PERSPECTIVE_CORRECTION_HINT */ - 1143, /* GL_POINT_SMOOTH_HINT */ - 700, /* GL_LINE_SMOOTH_HINT */ - 1160, /* GL_POLYGON_SMOOTH_HINT */ - 505, /* GL_FOG_HINT */ - 1651, /* GL_TEXTURE_GEN_S */ - 1652, /* GL_TEXTURE_GEN_T */ - 1650, /* GL_TEXTURE_GEN_R */ - 1649, /* GL_TEXTURE_GEN_Q */ - 1107, /* GL_PIXEL_MAP_I_TO_I */ - 1113, /* GL_PIXEL_MAP_S_TO_S */ - 1109, /* GL_PIXEL_MAP_I_TO_R */ - 1105, /* GL_PIXEL_MAP_I_TO_G */ - 1103, /* GL_PIXEL_MAP_I_TO_B */ - 1101, /* GL_PIXEL_MAP_I_TO_A */ - 1111, /* GL_PIXEL_MAP_R_TO_R */ - 1099, /* GL_PIXEL_MAP_G_TO_G */ - 1097, /* GL_PIXEL_MAP_B_TO_B */ - 1095, /* GL_PIXEL_MAP_A_TO_A */ - 1108, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - 1114, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - 1110, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - 1106, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - 1104, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - 1102, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - 1112, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - 1100, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - 1098, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - 1096, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - 1719, /* GL_UNPACK_SWAP_BYTES */ - 1714, /* GL_UNPACK_LSB_FIRST */ - 1715, /* GL_UNPACK_ROW_LENGTH */ - 1718, /* GL_UNPACK_SKIP_ROWS */ - 1717, /* GL_UNPACK_SKIP_PIXELS */ - 1712, /* GL_UNPACK_ALIGNMENT */ - 1082, /* GL_PACK_SWAP_BYTES */ - 1077, /* GL_PACK_LSB_FIRST */ - 1078, /* GL_PACK_ROW_LENGTH */ - 1081, /* GL_PACK_SKIP_ROWS */ - 1080, /* GL_PACK_SKIP_PIXELS */ - 1074, /* GL_PACK_ALIGNMENT */ - 794, /* GL_MAP_COLOR */ - 795, /* GL_MAP_STENCIL */ - 638, /* GL_INDEX_SHIFT */ - 637, /* GL_INDEX_OFFSET */ - 1287, /* GL_RED_SCALE */ - 1285, /* GL_RED_BIAS */ - 1816, /* GL_ZOOM_X */ - 1817, /* GL_ZOOM_Y */ - 599, /* GL_GREEN_SCALE */ - 597, /* GL_GREEN_BIAS */ - 91, /* GL_BLUE_SCALE */ - 89, /* GL_BLUE_BIAS */ + 385, /* GL_DRAW_BUFFER */ + 1266, /* GL_READ_BUFFER */ + 1377, /* GL_SCISSOR_BOX */ + 1378, /* GL_SCISSOR_TEST */ + 622, /* GL_INDEX_CLEAR_VALUE */ + 627, /* GL_INDEX_WRITEMASK */ + 185, /* GL_COLOR_CLEAR_VALUE */ + 227, /* GL_COLOR_WRITEMASK */ + 624, /* GL_INDEX_MODE */ + 1343, /* GL_RGBA_MODE */ + 384, /* GL_DOUBLEBUFFER */ + 1493, /* GL_STEREO */ + 1301, /* GL_RENDER_MODE */ + 1082, /* GL_PERSPECTIVE_CORRECTION_HINT */ + 1135, /* GL_POINT_SMOOTH_HINT */ + 688, /* GL_LINE_SMOOTH_HINT */ + 1152, /* GL_POLYGON_SMOOTH_HINT */ + 517, /* GL_FOG_HINT */ + 1653, /* GL_TEXTURE_GEN_S */ + 1654, /* GL_TEXTURE_GEN_T */ + 1652, /* GL_TEXTURE_GEN_R */ + 1651, /* GL_TEXTURE_GEN_Q */ + 1095, /* GL_PIXEL_MAP_I_TO_I */ + 1101, /* GL_PIXEL_MAP_S_TO_S */ + 1097, /* GL_PIXEL_MAP_I_TO_R */ + 1093, /* GL_PIXEL_MAP_I_TO_G */ + 1091, /* GL_PIXEL_MAP_I_TO_B */ + 1089, /* GL_PIXEL_MAP_I_TO_A */ + 1099, /* GL_PIXEL_MAP_R_TO_R */ + 1087, /* GL_PIXEL_MAP_G_TO_G */ + 1085, /* GL_PIXEL_MAP_B_TO_B */ + 1083, /* GL_PIXEL_MAP_A_TO_A */ + 1096, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + 1102, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + 1098, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + 1094, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + 1092, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + 1090, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + 1100, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + 1088, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + 1086, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + 1084, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + 1721, /* GL_UNPACK_SWAP_BYTES */ + 1716, /* GL_UNPACK_LSB_FIRST */ + 1717, /* GL_UNPACK_ROW_LENGTH */ + 1720, /* GL_UNPACK_SKIP_ROWS */ + 1719, /* GL_UNPACK_SKIP_PIXELS */ + 1714, /* GL_UNPACK_ALIGNMENT */ + 1070, /* GL_PACK_SWAP_BYTES */ + 1065, /* GL_PACK_LSB_FIRST */ + 1066, /* GL_PACK_ROW_LENGTH */ + 1069, /* GL_PACK_SKIP_ROWS */ + 1068, /* GL_PACK_SKIP_PIXELS */ + 1062, /* GL_PACK_ALIGNMENT */ + 782, /* GL_MAP_COLOR */ + 783, /* GL_MAP_STENCIL */ + 626, /* GL_INDEX_SHIFT */ + 625, /* GL_INDEX_OFFSET */ + 1279, /* GL_RED_SCALE */ + 1277, /* GL_RED_BIAS */ + 1818, /* GL_ZOOM_X */ + 1819, /* GL_ZOOM_Y */ + 587, /* GL_GREEN_SCALE */ + 585, /* GL_GREEN_BIAS */ + 92, /* GL_BLUE_SCALE */ + 90, /* GL_BLUE_BIAS */ 42, /* GL_ALPHA_SCALE */ 40, /* GL_ALPHA_BIAS */ - 357, /* GL_DEPTH_SCALE */ - 338, /* GL_DEPTH_BIAS */ - 867, /* GL_MAX_EVAL_ORDER */ - 871, /* GL_MAX_LIGHTS */ - 850, /* GL_MAX_CLIP_PLANES */ - 916, /* GL_MAX_TEXTURE_SIZE */ - 877, /* GL_MAX_PIXEL_MAP_TABLE */ - 846, /* GL_MAX_ATTRIB_STACK_DEPTH */ - 874, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - 875, /* GL_MAX_NAME_STACK_DEPTH */ - 903, /* GL_MAX_PROJECTION_STACK_DEPTH */ - 917, /* GL_MAX_TEXTURE_STACK_DEPTH */ - 931, /* GL_MAX_VIEWPORT_DIMS */ - 847, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - 1498, /* GL_SUBPIXEL_BITS */ - 633, /* GL_INDEX_BITS */ - 1286, /* GL_RED_BITS */ - 598, /* GL_GREEN_BITS */ - 90, /* GL_BLUE_BITS */ + 363, /* GL_DEPTH_SCALE */ + 344, /* GL_DEPTH_BIAS */ + 855, /* GL_MAX_EVAL_ORDER */ + 859, /* GL_MAX_LIGHTS */ + 838, /* GL_MAX_CLIP_PLANES */ + 904, /* GL_MAX_TEXTURE_SIZE */ + 865, /* GL_MAX_PIXEL_MAP_TABLE */ + 834, /* GL_MAX_ATTRIB_STACK_DEPTH */ + 862, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + 863, /* GL_MAX_NAME_STACK_DEPTH */ + 891, /* GL_MAX_PROJECTION_STACK_DEPTH */ + 905, /* GL_MAX_TEXTURE_STACK_DEPTH */ + 919, /* GL_MAX_VIEWPORT_DIMS */ + 835, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + 1500, /* GL_SUBPIXEL_BITS */ + 621, /* GL_INDEX_BITS */ + 1278, /* GL_RED_BITS */ + 586, /* GL_GREEN_BITS */ + 91, /* GL_BLUE_BITS */ 41, /* GL_ALPHA_BITS */ - 339, /* GL_DEPTH_BITS */ - 1473, /* GL_STENCIL_BITS */ + 345, /* GL_DEPTH_BITS */ + 1475, /* GL_STENCIL_BITS */ 14, /* GL_ACCUM_RED_BITS */ 13, /* GL_ACCUM_GREEN_BITS */ 10, /* GL_ACCUM_BLUE_BITS */ 9, /* GL_ACCUM_ALPHA_BITS */ - 997, /* GL_NAME_STACK_DEPTH */ + 985, /* GL_NAME_STACK_DEPTH */ 61, /* GL_AUTO_NORMAL */ - 740, /* GL_MAP1_COLOR_4 */ - 743, /* GL_MAP1_INDEX */ - 744, /* GL_MAP1_NORMAL */ - 745, /* GL_MAP1_TEXTURE_COORD_1 */ - 746, /* GL_MAP1_TEXTURE_COORD_2 */ - 747, /* GL_MAP1_TEXTURE_COORD_3 */ - 748, /* GL_MAP1_TEXTURE_COORD_4 */ - 749, /* GL_MAP1_VERTEX_3 */ - 750, /* GL_MAP1_VERTEX_4 */ - 767, /* GL_MAP2_COLOR_4 */ - 770, /* GL_MAP2_INDEX */ - 771, /* GL_MAP2_NORMAL */ - 772, /* GL_MAP2_TEXTURE_COORD_1 */ - 773, /* GL_MAP2_TEXTURE_COORD_2 */ - 774, /* GL_MAP2_TEXTURE_COORD_3 */ - 775, /* GL_MAP2_TEXTURE_COORD_4 */ - 776, /* GL_MAP2_VERTEX_3 */ - 777, /* GL_MAP2_VERTEX_4 */ - 741, /* GL_MAP1_GRID_DOMAIN */ - 742, /* GL_MAP1_GRID_SEGMENTS */ - 768, /* GL_MAP2_GRID_DOMAIN */ - 769, /* GL_MAP2_GRID_SEGMENTS */ - 1575, /* GL_TEXTURE_1D */ - 1577, /* GL_TEXTURE_2D */ - 466, /* GL_FEEDBACK_BUFFER_POINTER */ - 467, /* GL_FEEDBACK_BUFFER_SIZE */ - 468, /* GL_FEEDBACK_BUFFER_TYPE */ - 1393, /* GL_SELECTION_BUFFER_POINTER */ - 1394, /* GL_SELECTION_BUFFER_SIZE */ - 1689, /* GL_TEXTURE_WIDTH */ - 1656, /* GL_TEXTURE_HEIGHT */ - 1612, /* GL_TEXTURE_COMPONENTS */ - 1596, /* GL_TEXTURE_BORDER_COLOR */ - 1595, /* GL_TEXTURE_BORDER */ - 370, /* GL_DONT_CARE */ - 464, /* GL_FASTEST */ - 1005, /* GL_NICEST */ + 728, /* GL_MAP1_COLOR_4 */ + 731, /* GL_MAP1_INDEX */ + 732, /* GL_MAP1_NORMAL */ + 733, /* GL_MAP1_TEXTURE_COORD_1 */ + 734, /* GL_MAP1_TEXTURE_COORD_2 */ + 735, /* GL_MAP1_TEXTURE_COORD_3 */ + 736, /* GL_MAP1_TEXTURE_COORD_4 */ + 737, /* GL_MAP1_VERTEX_3 */ + 738, /* GL_MAP1_VERTEX_4 */ + 755, /* GL_MAP2_COLOR_4 */ + 758, /* GL_MAP2_INDEX */ + 759, /* GL_MAP2_NORMAL */ + 760, /* GL_MAP2_TEXTURE_COORD_1 */ + 761, /* GL_MAP2_TEXTURE_COORD_2 */ + 762, /* GL_MAP2_TEXTURE_COORD_3 */ + 763, /* GL_MAP2_TEXTURE_COORD_4 */ + 764, /* GL_MAP2_VERTEX_3 */ + 765, /* GL_MAP2_VERTEX_4 */ + 729, /* GL_MAP1_GRID_DOMAIN */ + 730, /* GL_MAP1_GRID_SEGMENTS */ + 756, /* GL_MAP2_GRID_DOMAIN */ + 757, /* GL_MAP2_GRID_SEGMENTS */ + 1577, /* GL_TEXTURE_1D */ + 1579, /* GL_TEXTURE_2D */ + 472, /* GL_FEEDBACK_BUFFER_POINTER */ + 473, /* GL_FEEDBACK_BUFFER_SIZE */ + 474, /* GL_FEEDBACK_BUFFER_TYPE */ + 1387, /* GL_SELECTION_BUFFER_POINTER */ + 1388, /* GL_SELECTION_BUFFER_SIZE */ + 1691, /* GL_TEXTURE_WIDTH */ + 1658, /* GL_TEXTURE_HEIGHT */ + 1614, /* GL_TEXTURE_COMPONENTS */ + 1598, /* GL_TEXTURE_BORDER_COLOR */ + 1597, /* GL_TEXTURE_BORDER */ + 376, /* GL_DONT_CARE */ + 470, /* GL_FASTEST */ + 993, /* GL_NICEST */ 47, /* GL_AMBIENT */ - 367, /* GL_DIFFUSE */ - 1436, /* GL_SPECULAR */ - 1164, /* GL_POSITION */ - 1439, /* GL_SPOT_DIRECTION */ - 1440, /* GL_SPOT_EXPONENT */ - 1438, /* GL_SPOT_CUTOFF */ - 266, /* GL_CONSTANT_ATTENUATION */ - 690, /* GL_LINEAR_ATTENUATION */ - 1261, /* GL_QUADRATIC_ATTENUATION */ - 240, /* GL_COMPILE */ - 241, /* GL_COMPILE_AND_EXECUTE */ - 116, /* GL_BYTE */ - 1720, /* GL_UNSIGNED_BYTE */ - 1407, /* GL_SHORT */ - 1731, /* GL_UNSIGNED_SHORT */ - 641, /* GL_INT */ - 1723, /* GL_UNSIGNED_INT */ - 471, /* GL_FLOAT */ + 373, /* GL_DIFFUSE */ + 1435, /* GL_SPECULAR */ + 1156, /* GL_POSITION */ + 1438, /* GL_SPOT_DIRECTION */ + 1439, /* GL_SPOT_EXPONENT */ + 1437, /* GL_SPOT_CUTOFF */ + 271, /* GL_CONSTANT_ATTENUATION */ + 678, /* GL_LINEAR_ATTENUATION */ + 1253, /* GL_QUADRATIC_ATTENUATION */ + 241, /* GL_COMPILE */ + 242, /* GL_COMPILE_AND_EXECUTE */ + 117, /* GL_BYTE */ + 1722, /* GL_UNSIGNED_BYTE */ + 1401, /* GL_SHORT */ + 1733, /* GL_UNSIGNED_SHORT */ + 629, /* GL_INT */ + 1725, /* GL_UNSIGNED_INT */ + 477, /* GL_FLOAT */ 1, /* GL_2_BYTES */ 5, /* GL_3_BYTES */ 7, /* GL_4_BYTES */ - 377, /* GL_DOUBLE */ - 128, /* GL_CLEAR */ + 383, /* GL_DOUBLE */ + 129, /* GL_CLEAR */ 49, /* GL_AND */ 51, /* GL_AND_REVERSE */ - 290, /* GL_COPY */ + 295, /* GL_COPY */ 50, /* GL_AND_INVERTED */ - 1007, /* GL_NOOP */ - 1812, /* GL_XOR */ - 1069, /* GL_OR */ - 1008, /* GL_NOR */ - 454, /* GL_EQUIV */ - 668, /* GL_INVERT */ - 1072, /* GL_OR_REVERSE */ - 291, /* GL_COPY_INVERTED */ - 1071, /* GL_OR_INVERTED */ - 998, /* GL_NAND */ - 1398, /* GL_SET */ - 451, /* GL_EMISSION */ - 1406, /* GL_SHININESS */ + 995, /* GL_NOOP */ + 1814, /* GL_XOR */ + 1057, /* GL_OR */ + 996, /* GL_NOR */ + 460, /* GL_EQUIV */ + 656, /* GL_INVERT */ + 1060, /* GL_OR_REVERSE */ + 296, /* GL_COPY_INVERTED */ + 1059, /* GL_OR_INVERTED */ + 986, /* GL_NAND */ + 1392, /* GL_SET */ + 457, /* GL_EMISSION */ + 1400, /* GL_SHININESS */ 48, /* GL_AMBIENT_AND_DIFFUSE */ - 186, /* GL_COLOR_INDEXES */ - 948, /* GL_MODELVIEW */ - 1240, /* GL_PROJECTION */ - 1510, /* GL_TEXTURE */ - 143, /* GL_COLOR */ - 334, /* GL_DEPTH */ - 1459, /* GL_STENCIL */ - 185, /* GL_COLOR_INDEX */ - 1478, /* GL_STENCIL_INDEX */ - 345, /* GL_DEPTH_COMPONENT */ - 1282, /* GL_RED */ - 596, /* GL_GREEN */ - 88, /* GL_BLUE */ + 187, /* GL_COLOR_INDEXES */ + 936, /* GL_MODELVIEW */ + 1232, /* GL_PROJECTION */ + 1512, /* GL_TEXTURE */ + 144, /* GL_COLOR */ + 340, /* GL_DEPTH */ + 1461, /* GL_STENCIL */ + 186, /* GL_COLOR_INDEX */ + 1480, /* GL_STENCIL_INDEX */ + 351, /* GL_DEPTH_COMPONENT */ + 1274, /* GL_RED */ + 584, /* GL_GREEN */ + 89, /* GL_BLUE */ 31, /* GL_ALPHA */ - 1317, /* GL_RGB */ - 1336, /* GL_RGBA */ - 718, /* GL_LUMINANCE */ - 739, /* GL_LUMINANCE_ALPHA */ + 1309, /* GL_RGB */ + 1328, /* GL_RGBA */ + 706, /* GL_LUMINANCE */ + 727, /* GL_LUMINANCE_ALPHA */ 72, /* GL_BITMAP */ - 1120, /* GL_POINT */ - 688, /* GL_LINE */ - 469, /* GL_FILL */ - 1291, /* GL_RENDER */ - 465, /* GL_FEEDBACK */ - 1392, /* GL_SELECT */ - 470, /* GL_FLAT */ - 1411, /* GL_SMOOTH */ - 669, /* GL_KEEP */ - 1311, /* GL_REPLACE */ - 623, /* GL_INCR */ - 330, /* GL_DECR */ - 1746, /* GL_VENDOR */ - 1308, /* GL_RENDERER */ - 1747, /* GL_VERSION */ - 458, /* GL_EXTENSIONS */ - 1357, /* GL_S */ - 1501, /* GL_T */ - 1271, /* GL_R */ - 1260, /* GL_Q */ - 984, /* GL_MODULATE */ - 329, /* GL_DECAL */ - 1646, /* GL_TEXTURE_ENV_MODE */ - 1645, /* GL_TEXTURE_ENV_COLOR */ - 1644, /* GL_TEXTURE_ENV */ - 459, /* GL_EYE_LINEAR */ - 1031, /* GL_OBJECT_LINEAR */ - 1437, /* GL_SPHERE_MAP */ - 1648, /* GL_TEXTURE_GEN_MODE */ - 1033, /* GL_OBJECT_PLANE */ - 460, /* GL_EYE_PLANE */ - 999, /* GL_NEAREST */ - 689, /* GL_LINEAR */ - 1003, /* GL_NEAREST_MIPMAP_NEAREST */ - 694, /* GL_LINEAR_MIPMAP_NEAREST */ - 1002, /* GL_NEAREST_MIPMAP_LINEAR */ - 693, /* GL_LINEAR_MIPMAP_LINEAR */ - 1669, /* GL_TEXTURE_MAG_FILTER */ - 1677, /* GL_TEXTURE_MIN_FILTER */ - 1691, /* GL_TEXTURE_WRAP_S */ - 1692, /* GL_TEXTURE_WRAP_T */ - 122, /* GL_CLAMP */ - 1310, /* GL_REPEAT */ - 1158, /* GL_POLYGON_OFFSET_UNITS */ - 1157, /* GL_POLYGON_OFFSET_POINT */ - 1156, /* GL_POLYGON_OFFSET_LINE */ - 1272, /* GL_R3_G3_B2 */ - 1743, /* GL_V2F */ - 1744, /* GL_V3F */ - 119, /* GL_C4UB_V2F */ - 120, /* GL_C4UB_V3F */ - 117, /* GL_C3F_V3F */ - 996, /* GL_N3F_V3F */ - 118, /* GL_C4F_N3F_V3F */ - 1506, /* GL_T2F_V3F */ - 1508, /* GL_T4F_V4F */ - 1504, /* GL_T2F_C4UB_V3F */ - 1502, /* GL_T2F_C3F_V3F */ - 1505, /* GL_T2F_N3F_V3F */ - 1503, /* GL_T2F_C4F_N3F_V3F */ - 1507, /* GL_T4F_C4F_N3F_V4F */ - 135, /* GL_CLIP_PLANE0 */ - 136, /* GL_CLIP_PLANE1 */ - 137, /* GL_CLIP_PLANE2 */ - 138, /* GL_CLIP_PLANE3 */ - 139, /* GL_CLIP_PLANE4 */ - 140, /* GL_CLIP_PLANE5 */ - 673, /* GL_LIGHT0 */ - 674, /* GL_LIGHT1 */ - 675, /* GL_LIGHT2 */ - 676, /* GL_LIGHT3 */ - 677, /* GL_LIGHT4 */ - 678, /* GL_LIGHT5 */ - 679, /* GL_LIGHT6 */ - 680, /* GL_LIGHT7 */ - 600, /* GL_HINT_BIT */ - 268, /* GL_CONSTANT_COLOR */ - 1043, /* GL_ONE_MINUS_CONSTANT_COLOR */ - 263, /* GL_CONSTANT_ALPHA */ - 1041, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + 1112, /* GL_POINT */ + 676, /* GL_LINE */ + 475, /* GL_FILL */ + 1283, /* GL_RENDER */ + 471, /* GL_FEEDBACK */ + 1386, /* GL_SELECT */ + 476, /* GL_FLAT */ + 1410, /* GL_SMOOTH */ + 657, /* GL_KEEP */ + 1303, /* GL_REPLACE */ + 611, /* GL_INCR */ + 336, /* GL_DECR */ + 1748, /* GL_VENDOR */ + 1300, /* GL_RENDERER */ + 1749, /* GL_VERSION */ + 464, /* GL_EXTENSIONS */ + 1351, /* GL_S */ + 1503, /* GL_T */ + 1263, /* GL_R */ + 1252, /* GL_Q */ + 972, /* GL_MODULATE */ + 335, /* GL_DECAL */ + 1648, /* GL_TEXTURE_ENV_MODE */ + 1647, /* GL_TEXTURE_ENV_COLOR */ + 1646, /* GL_TEXTURE_ENV */ + 465, /* GL_EYE_LINEAR */ + 1019, /* GL_OBJECT_LINEAR */ + 1436, /* GL_SPHERE_MAP */ + 1650, /* GL_TEXTURE_GEN_MODE */ + 1021, /* GL_OBJECT_PLANE */ + 466, /* GL_EYE_PLANE */ + 987, /* GL_NEAREST */ + 677, /* GL_LINEAR */ + 991, /* GL_NEAREST_MIPMAP_NEAREST */ + 682, /* GL_LINEAR_MIPMAP_NEAREST */ + 990, /* GL_NEAREST_MIPMAP_LINEAR */ + 681, /* GL_LINEAR_MIPMAP_LINEAR */ + 1671, /* GL_TEXTURE_MAG_FILTER */ + 1679, /* GL_TEXTURE_MIN_FILTER */ + 1693, /* GL_TEXTURE_WRAP_S */ + 1694, /* GL_TEXTURE_WRAP_T */ + 123, /* GL_CLAMP */ + 1302, /* GL_REPEAT */ + 1150, /* GL_POLYGON_OFFSET_UNITS */ + 1149, /* GL_POLYGON_OFFSET_POINT */ + 1148, /* GL_POLYGON_OFFSET_LINE */ + 1264, /* GL_R3_G3_B2 */ + 1745, /* GL_V2F */ + 1746, /* GL_V3F */ + 120, /* GL_C4UB_V2F */ + 121, /* GL_C4UB_V3F */ + 118, /* GL_C3F_V3F */ + 984, /* GL_N3F_V3F */ + 119, /* GL_C4F_N3F_V3F */ + 1508, /* GL_T2F_V3F */ + 1510, /* GL_T4F_V4F */ + 1506, /* GL_T2F_C4UB_V3F */ + 1504, /* GL_T2F_C3F_V3F */ + 1507, /* GL_T2F_N3F_V3F */ + 1505, /* GL_T2F_C4F_N3F_V3F */ + 1509, /* 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 */ + 661, /* GL_LIGHT0 */ + 662, /* GL_LIGHT1 */ + 663, /* GL_LIGHT2 */ + 664, /* GL_LIGHT3 */ + 665, /* GL_LIGHT4 */ + 666, /* GL_LIGHT5 */ + 667, /* GL_LIGHT6 */ + 668, /* GL_LIGHT7 */ + 588, /* GL_HINT_BIT */ + 273, /* GL_CONSTANT_COLOR */ + 1031, /* GL_ONE_MINUS_CONSTANT_COLOR */ + 268, /* GL_CONSTANT_ALPHA */ + 1029, /* GL_ONE_MINUS_CONSTANT_ALPHA */ 75, /* GL_BLEND_COLOR */ - 560, /* GL_FUNC_ADD */ - 932, /* GL_MIN */ - 843, /* GL_MAX */ + 572, /* GL_FUNC_ADD */ + 920, /* GL_MIN */ + 831, /* GL_MAX */ 80, /* GL_BLEND_EQUATION */ - 564, /* GL_FUNC_SUBTRACT */ - 562, /* GL_FUNC_REVERSE_SUBTRACT */ - 271, /* GL_CONVOLUTION_1D */ - 272, /* GL_CONVOLUTION_2D */ - 1395, /* GL_SEPARABLE_2D */ - 275, /* GL_CONVOLUTION_BORDER_MODE */ - 279, /* GL_CONVOLUTION_FILTER_SCALE */ - 277, /* GL_CONVOLUTION_FILTER_BIAS */ - 1283, /* GL_REDUCE */ - 281, /* GL_CONVOLUTION_FORMAT */ - 285, /* GL_CONVOLUTION_WIDTH */ - 283, /* GL_CONVOLUTION_HEIGHT */ - 858, /* GL_MAX_CONVOLUTION_WIDTH */ - 856, /* GL_MAX_CONVOLUTION_HEIGHT */ - 1197, /* GL_POST_CONVOLUTION_RED_SCALE */ - 1193, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - 1188, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - 1184, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - 1195, /* GL_POST_CONVOLUTION_RED_BIAS */ - 1191, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - 1186, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - 1182, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - 601, /* GL_HISTOGRAM */ - 1244, /* GL_PROXY_HISTOGRAM */ - 617, /* GL_HISTOGRAM_WIDTH */ - 607, /* GL_HISTOGRAM_FORMAT */ - 613, /* GL_HISTOGRAM_RED_SIZE */ - 609, /* GL_HISTOGRAM_GREEN_SIZE */ - 604, /* GL_HISTOGRAM_BLUE_SIZE */ - 602, /* GL_HISTOGRAM_ALPHA_SIZE */ - 611, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - 615, /* GL_HISTOGRAM_SINK */ - 933, /* GL_MINMAX */ - 935, /* GL_MINMAX_FORMAT */ - 937, /* GL_MINMAX_SINK */ - 1509, /* GL_TABLE_TOO_LARGE_EXT */ - 1722, /* GL_UNSIGNED_BYTE_3_3_2 */ - 1733, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - 1735, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - 1728, /* GL_UNSIGNED_INT_8_8_8_8 */ - 1724, /* GL_UNSIGNED_INT_10_10_10_2 */ - 1155, /* GL_POLYGON_OFFSET_FILL */ - 1154, /* GL_POLYGON_OFFSET_FACTOR */ - 1153, /* GL_POLYGON_OFFSET_BIAS */ - 1314, /* GL_RESCALE_NORMAL */ + 576, /* GL_FUNC_SUBTRACT */ + 574, /* GL_FUNC_REVERSE_SUBTRACT */ + 276, /* GL_CONVOLUTION_1D */ + 277, /* GL_CONVOLUTION_2D */ + 1389, /* GL_SEPARABLE_2D */ + 280, /* GL_CONVOLUTION_BORDER_MODE */ + 284, /* GL_CONVOLUTION_FILTER_SCALE */ + 282, /* GL_CONVOLUTION_FILTER_BIAS */ + 1275, /* GL_REDUCE */ + 286, /* GL_CONVOLUTION_FORMAT */ + 290, /* GL_CONVOLUTION_WIDTH */ + 288, /* GL_CONVOLUTION_HEIGHT */ + 846, /* GL_MAX_CONVOLUTION_WIDTH */ + 844, /* GL_MAX_CONVOLUTION_HEIGHT */ + 1189, /* GL_POST_CONVOLUTION_RED_SCALE */ + 1185, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + 1180, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + 1176, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + 1187, /* GL_POST_CONVOLUTION_RED_BIAS */ + 1183, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + 1178, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + 1174, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + 589, /* GL_HISTOGRAM */ + 1236, /* GL_PROXY_HISTOGRAM */ + 605, /* GL_HISTOGRAM_WIDTH */ + 595, /* GL_HISTOGRAM_FORMAT */ + 601, /* GL_HISTOGRAM_RED_SIZE */ + 597, /* GL_HISTOGRAM_GREEN_SIZE */ + 592, /* GL_HISTOGRAM_BLUE_SIZE */ + 590, /* GL_HISTOGRAM_ALPHA_SIZE */ + 599, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + 603, /* GL_HISTOGRAM_SINK */ + 921, /* GL_MINMAX */ + 923, /* GL_MINMAX_FORMAT */ + 925, /* GL_MINMAX_SINK */ + 1511, /* GL_TABLE_TOO_LARGE_EXT */ + 1724, /* GL_UNSIGNED_BYTE_3_3_2 */ + 1735, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 1737, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 1730, /* GL_UNSIGNED_INT_8_8_8_8 */ + 1726, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1147, /* GL_POLYGON_OFFSET_FILL */ + 1146, /* GL_POLYGON_OFFSET_FACTOR */ + 1145, /* GL_POLYGON_OFFSET_BIAS */ + 1306, /* GL_RESCALE_NORMAL */ 36, /* GL_ALPHA4 */ 38, /* GL_ALPHA8 */ 32, /* GL_ALPHA12 */ 34, /* GL_ALPHA16 */ - 729, /* GL_LUMINANCE4 */ - 735, /* GL_LUMINANCE8 */ - 719, /* GL_LUMINANCE12 */ - 725, /* GL_LUMINANCE16 */ - 730, /* GL_LUMINANCE4_ALPHA4 */ - 733, /* GL_LUMINANCE6_ALPHA2 */ - 736, /* GL_LUMINANCE8_ALPHA8 */ - 722, /* GL_LUMINANCE12_ALPHA4 */ - 720, /* GL_LUMINANCE12_ALPHA12 */ - 726, /* GL_LUMINANCE16_ALPHA16 */ - 642, /* GL_INTENSITY */ - 647, /* GL_INTENSITY4 */ - 649, /* GL_INTENSITY8 */ - 643, /* GL_INTENSITY12 */ - 645, /* GL_INTENSITY16 */ - 1326, /* GL_RGB2_EXT */ - 1327, /* GL_RGB4 */ - 1330, /* GL_RGB5 */ - 1334, /* GL_RGB8 */ - 1318, /* GL_RGB10 */ - 1322, /* GL_RGB12 */ - 1324, /* GL_RGB16 */ - 1341, /* GL_RGBA2 */ - 1343, /* GL_RGBA4 */ - 1331, /* GL_RGB5_A1 */ - 1347, /* GL_RGBA8 */ - 1319, /* GL_RGB10_A2 */ - 1337, /* GL_RGBA12 */ - 1339, /* GL_RGBA16 */ - 1682, /* GL_TEXTURE_RED_SIZE */ - 1654, /* GL_TEXTURE_GREEN_SIZE */ - 1593, /* GL_TEXTURE_BLUE_SIZE */ - 1580, /* GL_TEXTURE_ALPHA_SIZE */ - 1667, /* GL_TEXTURE_LUMINANCE_SIZE */ - 1658, /* GL_TEXTURE_INTENSITY_SIZE */ - 1312, /* GL_REPLACE_EXT */ - 1248, /* GL_PROXY_TEXTURE_1D */ - 1251, /* GL_PROXY_TEXTURE_2D */ - 1687, /* GL_TEXTURE_TOO_LARGE_EXT */ - 1679, /* GL_TEXTURE_PRIORITY */ - 1684, /* GL_TEXTURE_RESIDENT */ - 1583, /* GL_TEXTURE_BINDING_1D */ - 1585, /* GL_TEXTURE_BINDING_2D */ - 1587, /* GL_TEXTURE_BINDING_3D */ - 1079, /* GL_PACK_SKIP_IMAGES */ - 1075, /* GL_PACK_IMAGE_HEIGHT */ - 1716, /* GL_UNPACK_SKIP_IMAGES */ - 1713, /* GL_UNPACK_IMAGE_HEIGHT */ - 1579, /* GL_TEXTURE_3D */ - 1254, /* GL_PROXY_TEXTURE_3D */ - 1641, /* GL_TEXTURE_DEPTH */ - 1690, /* GL_TEXTURE_WRAP_R */ - 844, /* GL_MAX_3D_TEXTURE_SIZE */ - 1748, /* GL_VERTEX_ARRAY */ - 1010, /* GL_NORMAL_ARRAY */ - 144, /* GL_COLOR_ARRAY */ - 627, /* GL_INDEX_ARRAY */ - 1620, /* GL_TEXTURE_COORD_ARRAY */ - 443, /* GL_EDGE_FLAG_ARRAY */ - 1753, /* GL_VERTEX_ARRAY_SIZE */ - 1755, /* GL_VERTEX_ARRAY_TYPE */ - 1754, /* GL_VERTEX_ARRAY_STRIDE */ - 1015, /* GL_NORMAL_ARRAY_TYPE */ - 1014, /* GL_NORMAL_ARRAY_STRIDE */ - 148, /* GL_COLOR_ARRAY_SIZE */ - 150, /* GL_COLOR_ARRAY_TYPE */ - 149, /* GL_COLOR_ARRAY_STRIDE */ - 632, /* GL_INDEX_ARRAY_TYPE */ - 631, /* GL_INDEX_ARRAY_STRIDE */ - 1624, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - 1626, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - 1625, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - 447, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - 1752, /* GL_VERTEX_ARRAY_POINTER */ - 1013, /* GL_NORMAL_ARRAY_POINTER */ - 147, /* GL_COLOR_ARRAY_POINTER */ - 630, /* GL_INDEX_ARRAY_POINTER */ - 1623, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - 446, /* GL_EDGE_FLAG_ARRAY_POINTER */ - 989, /* GL_MULTISAMPLE */ - 1369, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - 1371, /* GL_SAMPLE_ALPHA_TO_ONE */ - 1376, /* GL_SAMPLE_COVERAGE */ - 1373, /* GL_SAMPLE_BUFFERS */ - 1364, /* GL_SAMPLES */ - 1380, /* GL_SAMPLE_COVERAGE_VALUE */ - 1378, /* GL_SAMPLE_COVERAGE_INVERT */ - 191, /* GL_COLOR_MATRIX */ - 193, /* GL_COLOR_MATRIX_STACK_DEPTH */ - 852, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - 1180, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - 1176, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - 1171, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - 1167, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - 1178, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - 1174, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - 1169, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - 1165, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - 1603, /* GL_TEXTURE_COLOR_TABLE_SGI */ - 1255, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - 1605, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 717, /* GL_LUMINANCE4 */ + 723, /* GL_LUMINANCE8 */ + 707, /* GL_LUMINANCE12 */ + 713, /* GL_LUMINANCE16 */ + 718, /* GL_LUMINANCE4_ALPHA4 */ + 721, /* GL_LUMINANCE6_ALPHA2 */ + 724, /* GL_LUMINANCE8_ALPHA8 */ + 710, /* GL_LUMINANCE12_ALPHA4 */ + 708, /* GL_LUMINANCE12_ALPHA12 */ + 714, /* GL_LUMINANCE16_ALPHA16 */ + 630, /* GL_INTENSITY */ + 635, /* GL_INTENSITY4 */ + 637, /* GL_INTENSITY8 */ + 631, /* GL_INTENSITY12 */ + 633, /* GL_INTENSITY16 */ + 1318, /* GL_RGB2_EXT */ + 1319, /* GL_RGB4 */ + 1322, /* GL_RGB5 */ + 1326, /* GL_RGB8 */ + 1310, /* GL_RGB10 */ + 1314, /* GL_RGB12 */ + 1316, /* GL_RGB16 */ + 1333, /* GL_RGBA2 */ + 1335, /* GL_RGBA4 */ + 1323, /* GL_RGB5_A1 */ + 1339, /* GL_RGBA8 */ + 1311, /* GL_RGB10_A2 */ + 1329, /* GL_RGBA12 */ + 1331, /* GL_RGBA16 */ + 1684, /* GL_TEXTURE_RED_SIZE */ + 1656, /* GL_TEXTURE_GREEN_SIZE */ + 1595, /* GL_TEXTURE_BLUE_SIZE */ + 1582, /* GL_TEXTURE_ALPHA_SIZE */ + 1669, /* GL_TEXTURE_LUMINANCE_SIZE */ + 1660, /* GL_TEXTURE_INTENSITY_SIZE */ + 1304, /* GL_REPLACE_EXT */ + 1240, /* GL_PROXY_TEXTURE_1D */ + 1243, /* GL_PROXY_TEXTURE_2D */ + 1689, /* GL_TEXTURE_TOO_LARGE_EXT */ + 1681, /* GL_TEXTURE_PRIORITY */ + 1686, /* GL_TEXTURE_RESIDENT */ + 1585, /* GL_TEXTURE_BINDING_1D */ + 1587, /* GL_TEXTURE_BINDING_2D */ + 1589, /* GL_TEXTURE_BINDING_3D */ + 1067, /* GL_PACK_SKIP_IMAGES */ + 1063, /* GL_PACK_IMAGE_HEIGHT */ + 1718, /* GL_UNPACK_SKIP_IMAGES */ + 1715, /* GL_UNPACK_IMAGE_HEIGHT */ + 1581, /* GL_TEXTURE_3D */ + 1246, /* GL_PROXY_TEXTURE_3D */ + 1643, /* GL_TEXTURE_DEPTH */ + 1692, /* GL_TEXTURE_WRAP_R */ + 832, /* GL_MAX_3D_TEXTURE_SIZE */ + 1750, /* GL_VERTEX_ARRAY */ + 998, /* GL_NORMAL_ARRAY */ + 145, /* GL_COLOR_ARRAY */ + 615, /* GL_INDEX_ARRAY */ + 1622, /* GL_TEXTURE_COORD_ARRAY */ + 449, /* GL_EDGE_FLAG_ARRAY */ + 1755, /* GL_VERTEX_ARRAY_SIZE */ + 1757, /* GL_VERTEX_ARRAY_TYPE */ + 1756, /* GL_VERTEX_ARRAY_STRIDE */ + 1003, /* GL_NORMAL_ARRAY_TYPE */ + 1002, /* GL_NORMAL_ARRAY_STRIDE */ + 149, /* GL_COLOR_ARRAY_SIZE */ + 151, /* GL_COLOR_ARRAY_TYPE */ + 150, /* GL_COLOR_ARRAY_STRIDE */ + 620, /* GL_INDEX_ARRAY_TYPE */ + 619, /* GL_INDEX_ARRAY_STRIDE */ + 1626, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 1628, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 1627, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 453, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + 1754, /* GL_VERTEX_ARRAY_POINTER */ + 1001, /* GL_NORMAL_ARRAY_POINTER */ + 148, /* GL_COLOR_ARRAY_POINTER */ + 618, /* GL_INDEX_ARRAY_POINTER */ + 1625, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 452, /* GL_EDGE_FLAG_ARRAY_POINTER */ + 977, /* GL_MULTISAMPLE */ + 1363, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + 1365, /* GL_SAMPLE_ALPHA_TO_ONE */ + 1370, /* GL_SAMPLE_COVERAGE */ + 1367, /* GL_SAMPLE_BUFFERS */ + 1358, /* GL_SAMPLES */ + 1374, /* GL_SAMPLE_COVERAGE_VALUE */ + 1372, /* GL_SAMPLE_COVERAGE_INVERT */ + 192, /* GL_COLOR_MATRIX */ + 194, /* GL_COLOR_MATRIX_STACK_DEPTH */ + 840, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + 1172, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + 1168, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + 1163, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + 1159, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + 1170, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + 1166, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + 1161, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + 1157, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + 1605, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1247, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + 1607, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ 79, /* GL_BLEND_DST_RGB */ - 87, /* GL_BLEND_SRC_RGB */ + 88, /* GL_BLEND_SRC_RGB */ 78, /* GL_BLEND_DST_ALPHA */ - 86, /* GL_BLEND_SRC_ALPHA */ - 197, /* GL_COLOR_TABLE */ - 1190, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - 1173, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - 1243, /* GL_PROXY_COLOR_TABLE */ - 1247, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - 1246, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - 221, /* GL_COLOR_TABLE_SCALE */ - 201, /* GL_COLOR_TABLE_BIAS */ - 206, /* GL_COLOR_TABLE_FORMAT */ - 223, /* GL_COLOR_TABLE_WIDTH */ - 218, /* GL_COLOR_TABLE_RED_SIZE */ - 209, /* GL_COLOR_TABLE_GREEN_SIZE */ - 203, /* GL_COLOR_TABLE_BLUE_SIZE */ - 198, /* GL_COLOR_TABLE_ALPHA_SIZE */ - 215, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ - 212, /* GL_COLOR_TABLE_INTENSITY_SIZE */ + 87, /* GL_BLEND_SRC_ALPHA */ + 198, /* GL_COLOR_TABLE */ + 1182, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + 1165, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + 1235, /* GL_PROXY_COLOR_TABLE */ + 1239, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + 1238, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + 222, /* GL_COLOR_TABLE_SCALE */ + 202, /* GL_COLOR_TABLE_BIAS */ + 207, /* GL_COLOR_TABLE_FORMAT */ + 224, /* GL_COLOR_TABLE_WIDTH */ + 219, /* GL_COLOR_TABLE_RED_SIZE */ + 210, /* GL_COLOR_TABLE_GREEN_SIZE */ + 204, /* GL_COLOR_TABLE_BLUE_SIZE */ + 199, /* GL_COLOR_TABLE_ALPHA_SIZE */ + 216, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ + 213, /* GL_COLOR_TABLE_INTENSITY_SIZE */ 70, /* GL_BGR */ 71, /* GL_BGRA */ - 866, /* GL_MAX_ELEMENTS_VERTICES */ - 865, /* GL_MAX_ELEMENTS_INDICES */ - 1657, /* GL_TEXTURE_INDEX_SIZE_EXT */ - 141, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - 1137, /* GL_POINT_SIZE_MIN */ - 1133, /* GL_POINT_SIZE_MAX */ - 1127, /* GL_POINT_FADE_THRESHOLD_SIZE */ - 1123, /* GL_POINT_DISTANCE_ATTENUATION */ - 123, /* GL_CLAMP_TO_BORDER */ - 126, /* GL_CLAMP_TO_EDGE */ - 1678, /* GL_TEXTURE_MIN_LOD */ - 1676, /* GL_TEXTURE_MAX_LOD */ - 1582, /* GL_TEXTURE_BASE_LEVEL */ - 1675, /* GL_TEXTURE_MAX_LEVEL */ - 620, /* GL_IGNORE_BORDER_HP */ - 267, /* GL_CONSTANT_BORDER_HP */ - 1313, /* GL_REPLICATE_BORDER_HP */ - 273, /* GL_CONVOLUTION_BORDER_COLOR */ - 1038, /* GL_OCCLUSION_TEST_HP */ - 1039, /* GL_OCCLUSION_TEST_RESULT_HP */ - 691, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - 1597, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - 1599, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - 1601, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - 1602, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1600, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - 1598, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - 848, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - 849, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1200, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - 1202, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - 1199, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - 1201, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - 1665, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - 1666, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - 1664, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - 566, /* GL_GENERATE_MIPMAP */ - 567, /* GL_GENERATE_MIPMAP_HINT */ - 508, /* GL_FOG_OFFSET_SGIX */ - 509, /* GL_FOG_OFFSET_VALUE_SGIX */ - 1611, /* GL_TEXTURE_COMPARE_SGIX */ - 1610, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - 1661, /* GL_TEXTURE_LEQUAL_R_SGIX */ - 1653, /* GL_TEXTURE_GEQUAL_R_SGIX */ - 346, /* GL_DEPTH_COMPONENT16 */ - 349, /* GL_DEPTH_COMPONENT24 */ - 352, /* GL_DEPTH_COMPONENT32 */ - 295, /* GL_CULL_VERTEX_EXT */ - 297, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ - 296, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - 1809, /* GL_WRAP_BORDER_SUN */ - 1604, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - 684, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - 1408, /* GL_SINGLE_COLOR */ - 1396, /* GL_SEPARATE_SPECULAR_COLOR */ - 1405, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - 519, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - 520, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - 527, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - 522, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - 518, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - 517, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - 521, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - 528, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - 539, /* GL_FRAMEBUFFER_DEFAULT */ - 552, /* GL_FRAMEBUFFER_UNDEFINED */ - 359, /* GL_DEPTH_STENCIL_ATTACHMENT */ - 626, /* GL_INDEX */ - 1721, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - 1736, /* GL_UNSIGNED_SHORT_5_6_5 */ - 1737, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - 1734, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - 1732, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - 1729, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - 1727, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - 1673, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - 1674, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - 1672, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - 940, /* GL_MIRRORED_REPEAT */ - 1352, /* GL_RGB_S3TC */ - 1329, /* GL_RGB4_S3TC */ - 1351, /* GL_RGBA_S3TC */ - 1346, /* GL_RGBA4_S3TC */ - 1349, /* GL_RGBA_DXT5_S3TC */ - 1344, /* GL_RGBA4_DXT5_S3TC */ - 260, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ - 255, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ - 256, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ - 257, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - 1001, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - 1000, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - 692, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - 495, /* GL_FOG_COORDINATE_SOURCE */ - 487, /* GL_FOG_COORD */ - 511, /* GL_FRAGMENT_DEPTH */ - 301, /* GL_CURRENT_FOG_COORD */ - 494, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - 493, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - 492, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - 489, /* GL_FOG_COORDINATE_ARRAY */ - 195, /* GL_COLOR_SUM */ - 320, /* GL_CURRENT_SECONDARY_COLOR */ - 1389, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - 1391, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - 1390, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - 1388, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - 1385, /* GL_SECONDARY_COLOR_ARRAY */ - 576, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */ + 854, /* GL_MAX_ELEMENTS_VERTICES */ + 853, /* GL_MAX_ELEMENTS_INDICES */ + 1659, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 142, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ + 1129, /* GL_POINT_SIZE_MIN */ + 1125, /* GL_POINT_SIZE_MAX */ + 1119, /* GL_POINT_FADE_THRESHOLD_SIZE */ + 1115, /* GL_POINT_DISTANCE_ATTENUATION */ + 124, /* GL_CLAMP_TO_BORDER */ + 127, /* GL_CLAMP_TO_EDGE */ + 1680, /* GL_TEXTURE_MIN_LOD */ + 1678, /* GL_TEXTURE_MAX_LOD */ + 1584, /* GL_TEXTURE_BASE_LEVEL */ + 1677, /* GL_TEXTURE_MAX_LEVEL */ + 608, /* GL_IGNORE_BORDER_HP */ + 272, /* GL_CONSTANT_BORDER_HP */ + 1305, /* GL_REPLICATE_BORDER_HP */ + 278, /* GL_CONVOLUTION_BORDER_COLOR */ + 1026, /* GL_OCCLUSION_TEST_HP */ + 1027, /* GL_OCCLUSION_TEST_RESULT_HP */ + 679, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + 1599, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1601, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1603, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1604, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1602, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1600, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 836, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + 837, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1192, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + 1194, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + 1191, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + 1193, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + 1667, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 1668, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 1666, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 578, /* GL_GENERATE_MIPMAP */ + 579, /* GL_GENERATE_MIPMAP_HINT */ + 520, /* GL_FOG_OFFSET_SGIX */ + 521, /* GL_FOG_OFFSET_VALUE_SGIX */ + 1613, /* GL_TEXTURE_COMPARE_SGIX */ + 1612, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 1663, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 1655, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 352, /* GL_DEPTH_COMPONENT16 */ + 355, /* GL_DEPTH_COMPONENT24 */ + 358, /* GL_DEPTH_COMPONENT32 */ + 300, /* GL_CULL_VERTEX_EXT */ + 302, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + 301, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + 1811, /* GL_WRAP_BORDER_SUN */ + 1606, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 672, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + 1403, /* GL_SINGLE_COLOR */ + 1390, /* GL_SEPARATE_SPECULAR_COLOR */ + 1399, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + 531, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + 532, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + 539, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + 534, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + 530, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + 529, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + 533, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + 540, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + 551, /* GL_FRAMEBUFFER_DEFAULT */ + 564, /* GL_FRAMEBUFFER_UNDEFINED */ + 365, /* GL_DEPTH_STENCIL_ATTACHMENT */ + 614, /* GL_INDEX */ + 1723, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 1738, /* GL_UNSIGNED_SHORT_5_6_5 */ + 1739, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 1736, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 1734, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 1731, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 1729, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 1675, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 1676, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 1674, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 928, /* GL_MIRRORED_REPEAT */ + 1346, /* GL_RGB_S3TC */ + 1321, /* GL_RGB4_S3TC */ + 1344, /* GL_RGBA_S3TC */ + 1338, /* GL_RGBA4_S3TC */ + 1342, /* GL_RGBA_DXT5_S3TC */ + 1336, /* 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 */ + 989, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + 988, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + 680, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + 507, /* GL_FOG_COORDINATE_SOURCE */ + 499, /* GL_FOG_COORD */ + 523, /* GL_FRAGMENT_DEPTH */ + 306, /* GL_CURRENT_FOG_COORD */ + 506, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + 505, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + 504, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + 501, /* GL_FOG_COORDINATE_ARRAY */ + 196, /* GL_COLOR_SUM */ + 326, /* GL_CURRENT_SECONDARY_COLOR */ + 1383, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + 1385, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + 1384, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + 1382, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + 1379, /* GL_SECONDARY_COLOR_ARRAY */ + 324, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ 28, /* GL_ALIASED_POINT_SIZE_RANGE */ 27, /* GL_ALIASED_LINE_WIDTH_RANGE */ - 1511, /* GL_TEXTURE0 */ - 1513, /* GL_TEXTURE1 */ - 1535, /* GL_TEXTURE2 */ - 1557, /* GL_TEXTURE3 */ - 1563, /* GL_TEXTURE4 */ - 1565, /* GL_TEXTURE5 */ - 1567, /* GL_TEXTURE6 */ - 1569, /* GL_TEXTURE7 */ - 1571, /* GL_TEXTURE8 */ - 1573, /* GL_TEXTURE9 */ - 1514, /* GL_TEXTURE10 */ - 1516, /* GL_TEXTURE11 */ - 1518, /* GL_TEXTURE12 */ - 1520, /* GL_TEXTURE13 */ - 1522, /* GL_TEXTURE14 */ - 1524, /* GL_TEXTURE15 */ - 1526, /* GL_TEXTURE16 */ - 1528, /* GL_TEXTURE17 */ - 1530, /* GL_TEXTURE18 */ - 1532, /* GL_TEXTURE19 */ - 1536, /* GL_TEXTURE20 */ - 1538, /* GL_TEXTURE21 */ - 1540, /* GL_TEXTURE22 */ - 1542, /* GL_TEXTURE23 */ - 1544, /* GL_TEXTURE24 */ - 1546, /* GL_TEXTURE25 */ - 1548, /* GL_TEXTURE26 */ - 1550, /* GL_TEXTURE27 */ - 1552, /* GL_TEXTURE28 */ - 1554, /* GL_TEXTURE29 */ - 1558, /* GL_TEXTURE30 */ - 1560, /* GL_TEXTURE31 */ + 1513, /* GL_TEXTURE0 */ + 1515, /* GL_TEXTURE1 */ + 1537, /* GL_TEXTURE2 */ + 1559, /* GL_TEXTURE3 */ + 1565, /* GL_TEXTURE4 */ + 1567, /* GL_TEXTURE5 */ + 1569, /* GL_TEXTURE6 */ + 1571, /* GL_TEXTURE7 */ + 1573, /* GL_TEXTURE8 */ + 1575, /* GL_TEXTURE9 */ + 1516, /* GL_TEXTURE10 */ + 1518, /* GL_TEXTURE11 */ + 1520, /* GL_TEXTURE12 */ + 1522, /* GL_TEXTURE13 */ + 1524, /* GL_TEXTURE14 */ + 1526, /* GL_TEXTURE15 */ + 1528, /* GL_TEXTURE16 */ + 1530, /* GL_TEXTURE17 */ + 1532, /* GL_TEXTURE18 */ + 1534, /* GL_TEXTURE19 */ + 1538, /* GL_TEXTURE20 */ + 1540, /* GL_TEXTURE21 */ + 1542, /* GL_TEXTURE22 */ + 1544, /* GL_TEXTURE23 */ + 1546, /* GL_TEXTURE24 */ + 1548, /* GL_TEXTURE25 */ + 1550, /* GL_TEXTURE26 */ + 1552, /* GL_TEXTURE27 */ + 1554, /* GL_TEXTURE28 */ + 1556, /* GL_TEXTURE29 */ + 1560, /* GL_TEXTURE30 */ + 1562, /* GL_TEXTURE31 */ 18, /* GL_ACTIVE_TEXTURE */ - 129, /* GL_CLIENT_ACTIVE_TEXTURE */ - 918, /* GL_MAX_TEXTURE_UNITS */ - 1700, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - 1703, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - 1705, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - 1697, /* GL_TRANSPOSE_COLOR_MATRIX */ - 1499, /* GL_SUBTRACT */ - 906, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ - 243, /* GL_COMPRESSED_ALPHA */ - 247, /* GL_COMPRESSED_LUMINANCE */ - 248, /* GL_COMPRESSED_LUMINANCE_ALPHA */ - 245, /* GL_COMPRESSED_INTENSITY */ - 251, /* GL_COMPRESSED_RGB */ - 252, /* GL_COMPRESSED_RGBA */ - 1618, /* GL_TEXTURE_COMPRESSION_HINT */ - 1680, /* GL_TEXTURE_RECTANGLE_ARB */ - 1590, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - 1258, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - 904, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - 358, /* GL_DEPTH_STENCIL */ - 1725, /* GL_UNSIGNED_INT_24_8 */ - 914, /* GL_MAX_TEXTURE_LOD_BIAS */ - 1671, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - 915, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - 1647, /* GL_TEXTURE_FILTER_CONTROL */ - 1662, /* GL_TEXTURE_LOD_BIAS */ - 228, /* GL_COMBINE4 */ - 908, /* GL_MAX_SHININESS_NV */ - 909, /* GL_MAX_SPOT_EXPONENT_NV */ - 624, /* GL_INCR_WRAP */ - 331, /* GL_DECR_WRAP */ - 960, /* GL_MODELVIEW1_ARB */ - 1016, /* GL_NORMAL_MAP */ - 1288, /* GL_REFLECTION_MAP */ - 1627, /* GL_TEXTURE_CUBE_MAP */ - 1588, /* GL_TEXTURE_BINDING_CUBE_MAP */ - 1635, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - 1629, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - 1637, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - 1631, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - 1639, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - 1633, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - 1256, /* GL_PROXY_TEXTURE_CUBE_MAP */ - 860, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - 995, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - 503, /* GL_FOG_DISTANCE_MODE_NV */ - 462, /* GL_EYE_RADIAL_NV */ - 461, /* GL_EYE_PLANE_ABSOLUTE_NV */ - 227, /* GL_COMBINE */ - 234, /* GL_COMBINE_RGB */ - 229, /* GL_COMBINE_ALPHA */ - 1353, /* GL_RGB_SCALE */ + 130, /* GL_CLIENT_ACTIVE_TEXTURE */ + 906, /* GL_MAX_TEXTURE_UNITS */ + 1702, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 1705, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 1707, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 1699, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1501, /* GL_SUBTRACT */ + 894, /* 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 */ + 1620, /* GL_TEXTURE_COMPRESSION_HINT */ + 1682, /* GL_TEXTURE_RECTANGLE_ARB */ + 1592, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + 1250, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + 892, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + 364, /* GL_DEPTH_STENCIL */ + 1727, /* GL_UNSIGNED_INT_24_8 */ + 902, /* GL_MAX_TEXTURE_LOD_BIAS */ + 1673, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 903, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + 1649, /* GL_TEXTURE_FILTER_CONTROL */ + 1664, /* GL_TEXTURE_LOD_BIAS */ + 229, /* GL_COMBINE4 */ + 896, /* GL_MAX_SHININESS_NV */ + 897, /* GL_MAX_SPOT_EXPONENT_NV */ + 612, /* GL_INCR_WRAP */ + 337, /* GL_DECR_WRAP */ + 948, /* GL_MODELVIEW1_ARB */ + 1004, /* GL_NORMAL_MAP */ + 1280, /* GL_REFLECTION_MAP */ + 1629, /* GL_TEXTURE_CUBE_MAP */ + 1590, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 1637, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 1631, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 1639, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 1633, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 1641, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 1635, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1248, /* GL_PROXY_TEXTURE_CUBE_MAP */ + 848, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + 983, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + 515, /* GL_FOG_DISTANCE_MODE_NV */ + 468, /* GL_EYE_RADIAL_NV */ + 467, /* GL_EYE_PLANE_ABSOLUTE_NV */ + 228, /* GL_COMBINE */ + 235, /* GL_COMBINE_RGB */ + 230, /* GL_COMBINE_ALPHA */ + 1347, /* GL_RGB_SCALE */ 24, /* GL_ADD_SIGNED */ - 652, /* GL_INTERPOLATE */ - 262, /* GL_CONSTANT */ - 1206, /* GL_PRIMARY_COLOR */ - 1203, /* GL_PREVIOUS */ - 1419, /* GL_SOURCE0_RGB */ - 1425, /* GL_SOURCE1_RGB */ - 1431, /* GL_SOURCE2_RGB */ - 1435, /* GL_SOURCE3_RGB_NV */ - 1416, /* GL_SOURCE0_ALPHA */ - 1422, /* GL_SOURCE1_ALPHA */ - 1428, /* GL_SOURCE2_ALPHA */ - 1434, /* GL_SOURCE3_ALPHA_NV */ - 1052, /* GL_OPERAND0_RGB */ - 1058, /* GL_OPERAND1_RGB */ - 1064, /* GL_OPERAND2_RGB */ - 1068, /* GL_OPERAND3_RGB_NV */ - 1049, /* GL_OPERAND0_ALPHA */ - 1055, /* GL_OPERAND1_ALPHA */ - 1061, /* GL_OPERAND2_ALPHA */ - 1067, /* GL_OPERAND3_ALPHA_NV */ - 1749, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - 1813, /* GL_YCBCR_422_APPLE */ - 1738, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - 1740, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - 1410, /* GL_SLICE_ACCUM_SUN */ - 1263, /* GL_QUAD_MESH_SUN */ - 1709, /* GL_TRIANGLE_MESH_SUN */ - 1787, /* GL_VERTEX_PROGRAM_ARB */ - 1798, /* GL_VERTEX_STATE_PROGRAM_NV */ - 1774, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - 1780, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - 1782, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - 1784, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - 322, /* GL_CURRENT_VERTEX_ATTRIB */ - 1219, /* GL_PROGRAM_LENGTH_ARB */ - 1233, /* GL_PROGRAM_STRING_ARB */ - 982, /* GL_MODELVIEW_PROJECTION_NV */ - 619, /* GL_IDENTITY_NV */ - 666, /* GL_INVERSE_NV */ - 1702, /* GL_TRANSPOSE_NV */ - 667, /* GL_INVERSE_TRANSPOSE_NV */ - 890, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - 889, /* GL_MAX_PROGRAM_MATRICES_ARB */ - 797, /* GL_MATRIX0_NV */ - 809, /* GL_MATRIX1_NV */ - 821, /* GL_MATRIX2_NV */ - 825, /* GL_MATRIX3_NV */ - 827, /* GL_MATRIX4_NV */ - 829, /* GL_MATRIX5_NV */ - 831, /* GL_MATRIX6_NV */ - 833, /* GL_MATRIX7_NV */ - 307, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ - 304, /* GL_CURRENT_MATRIX_ARB */ - 1790, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - 1793, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - 1231, /* GL_PROGRAM_PARAMETER_NV */ - 1778, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - 1235, /* GL_PROGRAM_TARGET_NV */ - 1232, /* GL_PROGRAM_RESIDENT_NV */ - 1694, /* GL_TRACK_MATRIX_NV */ - 1695, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - 1788, /* GL_VERTEX_PROGRAM_BINDING_NV */ - 1213, /* GL_PROGRAM_ERROR_POSITION_ARB */ - 343, /* GL_DEPTH_CLAMP_NV */ - 1756, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - 1763, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - 1764, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - 1765, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - 1766, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - 1767, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - 1768, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - 1769, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - 1770, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - 1771, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - 1757, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - 1758, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - 1759, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - 1760, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - 1761, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - 1762, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - 751, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - 758, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - 759, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - 760, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - 761, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - 762, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - 763, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - 764, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - 765, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - 766, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - 752, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - 753, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - 754, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - 755, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - 756, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - 757, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - 778, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - 785, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - 786, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - 787, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - 788, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - 789, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - 790, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - 1212, /* GL_PROGRAM_BINDING_ARB */ - 792, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - 793, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - 779, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - 780, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - 781, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - 782, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - 783, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - 784, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - 1616, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - 1613, /* GL_TEXTURE_COMPRESSED */ - 1021, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - 261, /* GL_COMPRESSED_TEXTURE_FORMATS */ - 930, /* GL_MAX_VERTEX_UNITS_ARB */ + 640, /* GL_INTERPOLATE */ + 267, /* GL_CONSTANT */ + 1198, /* GL_PRIMARY_COLOR */ + 1195, /* GL_PREVIOUS */ + 1418, /* GL_SOURCE0_RGB */ + 1424, /* GL_SOURCE1_RGB */ + 1430, /* GL_SOURCE2_RGB */ + 1434, /* GL_SOURCE3_RGB_NV */ + 1415, /* GL_SOURCE0_ALPHA */ + 1421, /* GL_SOURCE1_ALPHA */ + 1427, /* GL_SOURCE2_ALPHA */ + 1433, /* GL_SOURCE3_ALPHA_NV */ + 1040, /* GL_OPERAND0_RGB */ + 1046, /* GL_OPERAND1_RGB */ + 1052, /* GL_OPERAND2_RGB */ + 1056, /* GL_OPERAND3_RGB_NV */ + 1037, /* GL_OPERAND0_ALPHA */ + 1043, /* GL_OPERAND1_ALPHA */ + 1049, /* GL_OPERAND2_ALPHA */ + 1055, /* GL_OPERAND3_ALPHA_NV */ + 1751, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + 1815, /* GL_YCBCR_422_APPLE */ + 1740, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 1742, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 1405, /* GL_SLICE_ACCUM_SUN */ + 1255, /* GL_QUAD_MESH_SUN */ + 1711, /* GL_TRIANGLE_MESH_SUN */ + 1789, /* GL_VERTEX_PROGRAM_ARB */ + 1800, /* GL_VERTEX_STATE_PROGRAM_NV */ + 1776, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + 1782, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + 1784, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + 1786, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + 328, /* GL_CURRENT_VERTEX_ATTRIB */ + 1211, /* GL_PROGRAM_LENGTH_ARB */ + 1225, /* GL_PROGRAM_STRING_ARB */ + 970, /* GL_MODELVIEW_PROJECTION_NV */ + 607, /* GL_IDENTITY_NV */ + 654, /* GL_INVERSE_NV */ + 1704, /* GL_TRANSPOSE_NV */ + 655, /* GL_INVERSE_TRANSPOSE_NV */ + 878, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + 877, /* GL_MAX_PROGRAM_MATRICES_ARB */ + 785, /* GL_MATRIX0_NV */ + 797, /* GL_MATRIX1_NV */ + 809, /* GL_MATRIX2_NV */ + 813, /* GL_MATRIX3_NV */ + 815, /* GL_MATRIX4_NV */ + 817, /* GL_MATRIX5_NV */ + 819, /* GL_MATRIX6_NV */ + 821, /* GL_MATRIX7_NV */ + 312, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + 309, /* GL_CURRENT_MATRIX_ARB */ + 1792, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + 1795, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + 1223, /* GL_PROGRAM_PARAMETER_NV */ + 1780, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + 1227, /* GL_PROGRAM_TARGET_NV */ + 1224, /* GL_PROGRAM_RESIDENT_NV */ + 1696, /* GL_TRACK_MATRIX_NV */ + 1697, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 1790, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1205, /* GL_PROGRAM_ERROR_POSITION_ARB */ + 349, /* GL_DEPTH_CLAMP_NV */ + 1758, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 1765, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 1766, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 1767, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 1768, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 1769, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 1770, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 1771, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 1772, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 1773, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 1759, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 1760, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 1761, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 1762, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 1763, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 1764, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 739, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + 746, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + 747, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + 748, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + 749, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + 750, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + 751, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + 752, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + 753, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + 754, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + 740, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + 741, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + 742, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + 743, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + 744, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + 745, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + 766, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + 773, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + 774, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + 775, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + 776, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + 777, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + 778, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + 1204, /* GL_PROGRAM_BINDING_ARB */ + 780, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + 781, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + 767, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + 768, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + 769, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + 770, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + 771, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + 772, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + 1618, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 1615, /* GL_TEXTURE_COMPRESSED */ + 1009, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + 266, /* GL_COMPRESSED_TEXTURE_FORMATS */ + 918, /* GL_MAX_VERTEX_UNITS_ARB */ 22, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - 1808, /* GL_WEIGHT_SUM_UNITY_ARB */ - 1786, /* GL_VERTEX_BLEND_ARB */ - 324, /* GL_CURRENT_WEIGHT_ARB */ - 1807, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - 1806, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - 1805, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - 1804, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - 1801, /* GL_WEIGHT_ARRAY_ARB */ - 371, /* GL_DOT3_RGB */ - 372, /* GL_DOT3_RGBA */ - 259, /* GL_COMPRESSED_RGB_FXT1_3DFX */ - 254, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - 990, /* GL_MULTISAMPLE_3DFX */ - 1374, /* GL_SAMPLE_BUFFERS_3DFX */ - 1365, /* GL_SAMPLES_3DFX */ - 971, /* GL_MODELVIEW2_ARB */ - 974, /* GL_MODELVIEW3_ARB */ - 975, /* GL_MODELVIEW4_ARB */ - 976, /* GL_MODELVIEW5_ARB */ - 977, /* GL_MODELVIEW6_ARB */ - 978, /* GL_MODELVIEW7_ARB */ - 979, /* GL_MODELVIEW8_ARB */ - 980, /* GL_MODELVIEW9_ARB */ - 950, /* GL_MODELVIEW10_ARB */ - 951, /* GL_MODELVIEW11_ARB */ - 952, /* GL_MODELVIEW12_ARB */ - 953, /* GL_MODELVIEW13_ARB */ - 954, /* GL_MODELVIEW14_ARB */ - 955, /* GL_MODELVIEW15_ARB */ - 956, /* GL_MODELVIEW16_ARB */ - 957, /* GL_MODELVIEW17_ARB */ - 958, /* GL_MODELVIEW18_ARB */ - 959, /* GL_MODELVIEW19_ARB */ - 961, /* GL_MODELVIEW20_ARB */ - 962, /* GL_MODELVIEW21_ARB */ - 963, /* GL_MODELVIEW22_ARB */ - 964, /* GL_MODELVIEW23_ARB */ - 965, /* GL_MODELVIEW24_ARB */ - 966, /* GL_MODELVIEW25_ARB */ - 967, /* GL_MODELVIEW26_ARB */ - 968, /* GL_MODELVIEW27_ARB */ - 969, /* GL_MODELVIEW28_ARB */ - 970, /* GL_MODELVIEW29_ARB */ - 972, /* GL_MODELVIEW30_ARB */ - 973, /* GL_MODELVIEW31_ARB */ - 376, /* GL_DOT3_RGB_EXT */ - 374, /* GL_DOT3_RGBA_EXT */ - 944, /* GL_MIRROR_CLAMP_EXT */ - 947, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - 985, /* GL_MODULATE_ADD_ATI */ - 986, /* GL_MODULATE_SIGNED_ADD_ATI */ - 987, /* GL_MODULATE_SUBTRACT_ATI */ - 1814, /* GL_YCBCR_MESA */ - 1076, /* GL_PACK_INVERT_MESA */ - 327, /* GL_DEBUG_OBJECT_MESA */ - 328, /* GL_DEBUG_PRINT_MESA */ - 326, /* GL_DEBUG_ASSERT_MESA */ - 106, /* GL_BUFFER_SIZE */ - 108, /* GL_BUFFER_USAGE */ - 112, /* GL_BUMP_ROT_MATRIX_ATI */ - 113, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ - 111, /* GL_BUMP_NUM_TEX_UNITS_ATI */ - 115, /* GL_BUMP_TEX_UNITS_ATI */ - 435, /* GL_DUDV_ATI */ - 434, /* GL_DU8DV8_ATI */ - 110, /* GL_BUMP_ENVMAP_ATI */ - 114, /* GL_BUMP_TARGET_ATI */ - 1464, /* GL_STENCIL_BACK_FUNC */ - 1462, /* GL_STENCIL_BACK_FAIL */ - 1466, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - 1468, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - 512, /* GL_FRAGMENT_PROGRAM_ARB */ - 1210, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 1238, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 1237, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - 1222, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 1228, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 1227, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 879, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 902, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 901, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - 892, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 898, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 897, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 862, /* GL_MAX_DRAW_BUFFERS */ - 380, /* GL_DRAW_BUFFER0 */ - 383, /* GL_DRAW_BUFFER1 */ - 404, /* GL_DRAW_BUFFER2 */ - 407, /* GL_DRAW_BUFFER3 */ - 410, /* GL_DRAW_BUFFER4 */ - 413, /* GL_DRAW_BUFFER5 */ - 416, /* GL_DRAW_BUFFER6 */ - 419, /* GL_DRAW_BUFFER7 */ - 422, /* GL_DRAW_BUFFER8 */ - 425, /* GL_DRAW_BUFFER9 */ - 384, /* GL_DRAW_BUFFER10 */ - 387, /* GL_DRAW_BUFFER11 */ - 390, /* GL_DRAW_BUFFER12 */ - 393, /* GL_DRAW_BUFFER13 */ - 396, /* GL_DRAW_BUFFER14 */ - 399, /* GL_DRAW_BUFFER15 */ + 1810, /* GL_WEIGHT_SUM_UNITY_ARB */ + 1788, /* GL_VERTEX_BLEND_ARB */ + 330, /* GL_CURRENT_WEIGHT_ARB */ + 1809, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 1808, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 1807, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 1806, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 1803, /* GL_WEIGHT_ARRAY_ARB */ + 377, /* GL_DOT3_RGB */ + 378, /* GL_DOT3_RGBA */ + 260, /* GL_COMPRESSED_RGB_FXT1_3DFX */ + 255, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ + 978, /* GL_MULTISAMPLE_3DFX */ + 1368, /* GL_SAMPLE_BUFFERS_3DFX */ + 1359, /* GL_SAMPLES_3DFX */ + 959, /* GL_MODELVIEW2_ARB */ + 962, /* GL_MODELVIEW3_ARB */ + 963, /* GL_MODELVIEW4_ARB */ + 964, /* GL_MODELVIEW5_ARB */ + 965, /* GL_MODELVIEW6_ARB */ + 966, /* GL_MODELVIEW7_ARB */ + 967, /* GL_MODELVIEW8_ARB */ + 968, /* GL_MODELVIEW9_ARB */ + 938, /* GL_MODELVIEW10_ARB */ + 939, /* GL_MODELVIEW11_ARB */ + 940, /* GL_MODELVIEW12_ARB */ + 941, /* GL_MODELVIEW13_ARB */ + 942, /* GL_MODELVIEW14_ARB */ + 943, /* GL_MODELVIEW15_ARB */ + 944, /* GL_MODELVIEW16_ARB */ + 945, /* GL_MODELVIEW17_ARB */ + 946, /* GL_MODELVIEW18_ARB */ + 947, /* GL_MODELVIEW19_ARB */ + 949, /* GL_MODELVIEW20_ARB */ + 950, /* GL_MODELVIEW21_ARB */ + 951, /* GL_MODELVIEW22_ARB */ + 952, /* GL_MODELVIEW23_ARB */ + 953, /* GL_MODELVIEW24_ARB */ + 954, /* GL_MODELVIEW25_ARB */ + 955, /* GL_MODELVIEW26_ARB */ + 956, /* GL_MODELVIEW27_ARB */ + 957, /* GL_MODELVIEW28_ARB */ + 958, /* GL_MODELVIEW29_ARB */ + 960, /* GL_MODELVIEW30_ARB */ + 961, /* GL_MODELVIEW31_ARB */ + 382, /* GL_DOT3_RGB_EXT */ + 380, /* GL_DOT3_RGBA_EXT */ + 932, /* GL_MIRROR_CLAMP_EXT */ + 935, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + 973, /* GL_MODULATE_ADD_ATI */ + 974, /* GL_MODULATE_SIGNED_ADD_ATI */ + 975, /* GL_MODULATE_SUBTRACT_ATI */ + 1816, /* GL_YCBCR_MESA */ + 1064, /* GL_PACK_INVERT_MESA */ + 333, /* GL_DEBUG_OBJECT_MESA */ + 334, /* GL_DEBUG_PRINT_MESA */ + 332, /* GL_DEBUG_ASSERT_MESA */ + 107, /* GL_BUFFER_SIZE */ + 109, /* GL_BUFFER_USAGE */ + 113, /* GL_BUMP_ROT_MATRIX_ATI */ + 114, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ + 112, /* GL_BUMP_NUM_TEX_UNITS_ATI */ + 116, /* GL_BUMP_TEX_UNITS_ATI */ + 441, /* GL_DUDV_ATI */ + 440, /* GL_DU8DV8_ATI */ + 111, /* GL_BUMP_ENVMAP_ATI */ + 115, /* GL_BUMP_TARGET_ATI */ + 1466, /* GL_STENCIL_BACK_FUNC */ + 1464, /* GL_STENCIL_BACK_FAIL */ + 1468, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + 1470, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + 524, /* GL_FRAGMENT_PROGRAM_ARB */ + 1202, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 1230, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 1229, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + 1214, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 1220, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 1219, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 867, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 890, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 889, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + 880, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 886, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 885, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 850, /* GL_MAX_DRAW_BUFFERS */ + 386, /* GL_DRAW_BUFFER0 */ + 389, /* GL_DRAW_BUFFER1 */ + 410, /* GL_DRAW_BUFFER2 */ + 413, /* GL_DRAW_BUFFER3 */ + 416, /* GL_DRAW_BUFFER4 */ + 419, /* GL_DRAW_BUFFER5 */ + 422, /* GL_DRAW_BUFFER6 */ + 425, /* GL_DRAW_BUFFER7 */ + 428, /* GL_DRAW_BUFFER8 */ + 431, /* GL_DRAW_BUFFER9 */ + 390, /* GL_DRAW_BUFFER10 */ + 393, /* GL_DRAW_BUFFER11 */ + 396, /* GL_DRAW_BUFFER12 */ + 399, /* GL_DRAW_BUFFER13 */ + 402, /* GL_DRAW_BUFFER14 */ + 405, /* GL_DRAW_BUFFER15 */ 81, /* GL_BLEND_EQUATION_ALPHA */ - 842, /* GL_MATRIX_PALETTE_ARB */ - 873, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - 876, /* GL_MAX_PALETTE_MATRICES_ARB */ - 310, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - 836, /* GL_MATRIX_INDEX_ARRAY_ARB */ - 305, /* GL_CURRENT_MATRIX_INDEX_ARB */ - 838, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - 840, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - 839, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - 837, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - 1642, /* GL_TEXTURE_DEPTH_SIZE */ - 364, /* GL_DEPTH_TEXTURE_MODE */ - 1608, /* GL_TEXTURE_COMPARE_MODE */ - 1606, /* GL_TEXTURE_COMPARE_FUNC */ - 238, /* GL_COMPARE_R_TO_TEXTURE */ - 1144, /* GL_POINT_SPRITE */ - 287, /* GL_COORD_REPLACE */ - 1148, /* GL_POINT_SPRITE_R_MODE_NV */ - 1265, /* GL_QUERY_COUNTER_BITS */ - 312, /* GL_CURRENT_QUERY */ - 1267, /* GL_QUERY_RESULT */ - 1269, /* GL_QUERY_RESULT_AVAILABLE */ - 924, /* GL_MAX_VERTEX_ATTRIBS */ - 1776, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - 362, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - 361, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - 910, /* GL_MAX_TEXTURE_COORDS */ - 912, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - 1215, /* GL_PROGRAM_ERROR_STRING_ARB */ - 1217, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - 1216, /* GL_PROGRAM_FORMAT_ARB */ - 1688, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - 341, /* GL_DEPTH_BOUNDS_TEST_EXT */ - 340, /* GL_DEPTH_BOUNDS_EXT */ + 830, /* GL_MATRIX_PALETTE_ARB */ + 861, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + 864, /* GL_MAX_PALETTE_MATRICES_ARB */ + 315, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + 824, /* GL_MATRIX_INDEX_ARRAY_ARB */ + 310, /* GL_CURRENT_MATRIX_INDEX_ARB */ + 826, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + 828, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + 827, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + 825, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + 1644, /* GL_TEXTURE_DEPTH_SIZE */ + 370, /* GL_DEPTH_TEXTURE_MODE */ + 1610, /* GL_TEXTURE_COMPARE_MODE */ + 1608, /* GL_TEXTURE_COMPARE_FUNC */ + 239, /* GL_COMPARE_R_TO_TEXTURE */ + 1136, /* GL_POINT_SPRITE */ + 292, /* GL_COORD_REPLACE */ + 1140, /* GL_POINT_SPRITE_R_MODE_NV */ + 1257, /* GL_QUERY_COUNTER_BITS */ + 317, /* GL_CURRENT_QUERY */ + 1259, /* GL_QUERY_RESULT */ + 1261, /* GL_QUERY_RESULT_AVAILABLE */ + 912, /* GL_MAX_VERTEX_ATTRIBS */ + 1778, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + 368, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + 367, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + 898, /* GL_MAX_TEXTURE_COORDS */ + 900, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + 1207, /* GL_PROGRAM_ERROR_STRING_ARB */ + 1209, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + 1208, /* GL_PROGRAM_FORMAT_ARB */ + 1690, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 347, /* GL_DEPTH_BOUNDS_TEST_EXT */ + 346, /* GL_DEPTH_BOUNDS_EXT */ 52, /* GL_ARRAY_BUFFER */ - 448, /* GL_ELEMENT_ARRAY_BUFFER */ + 454, /* GL_ELEMENT_ARRAY_BUFFER */ 53, /* GL_ARRAY_BUFFER_BINDING */ - 449, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - 1750, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - 1011, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - 145, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - 628, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - 1621, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - 444, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - 1386, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - 490, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - 1802, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - 1772, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - 1218, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - 885, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - 1224, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 894, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 1236, /* GL_PROGRAM_TEMPORARIES_ARB */ - 900, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - 1226, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 896, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 1230, /* GL_PROGRAM_PARAMETERS_ARB */ - 899, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - 1225, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - 895, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - 1211, /* GL_PROGRAM_ATTRIBS_ARB */ - 880, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - 1223, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - 893, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - 1209, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - 878, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - 1221, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 891, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 886, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - 882, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - 1239, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - 1699, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - 1278, /* GL_READ_ONLY */ - 1810, /* GL_WRITE_ONLY */ - 1280, /* GL_READ_WRITE */ - 100, /* GL_BUFFER_ACCESS */ - 102, /* GL_BUFFER_MAPPED */ - 104, /* GL_BUFFER_MAP_POINTER */ - 1693, /* GL_TIME_ELAPSED_EXT */ - 796, /* GL_MATRIX0_ARB */ - 808, /* GL_MATRIX1_ARB */ - 820, /* GL_MATRIX2_ARB */ - 824, /* GL_MATRIX3_ARB */ - 826, /* GL_MATRIX4_ARB */ - 828, /* GL_MATRIX5_ARB */ - 830, /* GL_MATRIX6_ARB */ - 832, /* GL_MATRIX7_ARB */ - 834, /* GL_MATRIX8_ARB */ - 835, /* GL_MATRIX9_ARB */ - 798, /* GL_MATRIX10_ARB */ - 799, /* GL_MATRIX11_ARB */ - 800, /* GL_MATRIX12_ARB */ - 801, /* GL_MATRIX13_ARB */ - 802, /* GL_MATRIX14_ARB */ - 803, /* GL_MATRIX15_ARB */ - 804, /* GL_MATRIX16_ARB */ - 805, /* GL_MATRIX17_ARB */ - 806, /* GL_MATRIX18_ARB */ - 807, /* GL_MATRIX19_ARB */ - 810, /* GL_MATRIX20_ARB */ - 811, /* GL_MATRIX21_ARB */ - 812, /* GL_MATRIX22_ARB */ - 813, /* GL_MATRIX23_ARB */ - 814, /* GL_MATRIX24_ARB */ - 815, /* GL_MATRIX25_ARB */ - 816, /* GL_MATRIX26_ARB */ - 817, /* GL_MATRIX27_ARB */ - 818, /* GL_MATRIX28_ARB */ - 819, /* GL_MATRIX29_ARB */ - 822, /* GL_MATRIX30_ARB */ - 823, /* GL_MATRIX31_ARB */ - 1494, /* GL_STREAM_DRAW */ - 1496, /* GL_STREAM_READ */ - 1492, /* GL_STREAM_COPY */ - 1455, /* GL_STATIC_DRAW */ - 1457, /* GL_STATIC_READ */ - 1453, /* GL_STATIC_COPY */ - 438, /* GL_DYNAMIC_DRAW */ - 440, /* GL_DYNAMIC_READ */ - 436, /* GL_DYNAMIC_COPY */ - 583, /* GL_GL_PIXEL_PACK_BUFFER */ - 585, /* GL_GL_PIXEL_UNPACK_BUFFER */ - 584, /* GL_GL_PIXEL_PACK_BUFFER_BINDING */ - 586, /* GL_GL_PIXEL_UNPACK_BUFFER_BINDING */ - 335, /* GL_DEPTH24_STENCIL8 */ - 1686, /* GL_TEXTURE_STENCIL_SIZE */ - 883, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - 881, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - 884, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - 888, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - 887, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - 845, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - 1488, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 455, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + 1752, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 999, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + 146, /* GL_COLOR_ARRAY_BUFFER_BINDING */ + 616, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + 1623, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 450, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + 1380, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + 502, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + 1804, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 1774, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1210, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + 873, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + 1216, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 882, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 1228, /* GL_PROGRAM_TEMPORARIES_ARB */ + 888, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + 1218, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 884, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 1222, /* GL_PROGRAM_PARAMETERS_ARB */ + 887, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + 1217, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + 883, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + 1203, /* GL_PROGRAM_ATTRIBS_ARB */ + 868, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + 1215, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + 881, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + 1201, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + 866, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + 1213, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 879, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 874, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + 870, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + 1231, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + 1701, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1270, /* GL_READ_ONLY */ + 1812, /* GL_WRITE_ONLY */ + 1272, /* GL_READ_WRITE */ + 101, /* GL_BUFFER_ACCESS */ + 103, /* GL_BUFFER_MAPPED */ + 105, /* GL_BUFFER_MAP_POINTER */ + 1695, /* GL_TIME_ELAPSED_EXT */ + 784, /* GL_MATRIX0_ARB */ + 796, /* GL_MATRIX1_ARB */ + 808, /* GL_MATRIX2_ARB */ + 812, /* GL_MATRIX3_ARB */ + 814, /* GL_MATRIX4_ARB */ + 816, /* GL_MATRIX5_ARB */ + 818, /* GL_MATRIX6_ARB */ + 820, /* GL_MATRIX7_ARB */ + 822, /* GL_MATRIX8_ARB */ + 823, /* GL_MATRIX9_ARB */ + 786, /* GL_MATRIX10_ARB */ + 787, /* GL_MATRIX11_ARB */ + 788, /* GL_MATRIX12_ARB */ + 789, /* GL_MATRIX13_ARB */ + 790, /* GL_MATRIX14_ARB */ + 791, /* GL_MATRIX15_ARB */ + 792, /* GL_MATRIX16_ARB */ + 793, /* GL_MATRIX17_ARB */ + 794, /* GL_MATRIX18_ARB */ + 795, /* GL_MATRIX19_ARB */ + 798, /* GL_MATRIX20_ARB */ + 799, /* GL_MATRIX21_ARB */ + 800, /* GL_MATRIX22_ARB */ + 801, /* GL_MATRIX23_ARB */ + 802, /* GL_MATRIX24_ARB */ + 803, /* GL_MATRIX25_ARB */ + 804, /* GL_MATRIX26_ARB */ + 805, /* GL_MATRIX27_ARB */ + 806, /* GL_MATRIX28_ARB */ + 807, /* GL_MATRIX29_ARB */ + 810, /* GL_MATRIX30_ARB */ + 811, /* GL_MATRIX31_ARB */ + 1496, /* GL_STREAM_DRAW */ + 1498, /* GL_STREAM_READ */ + 1494, /* GL_STREAM_COPY */ + 1457, /* GL_STATIC_DRAW */ + 1459, /* GL_STATIC_READ */ + 1455, /* GL_STATIC_COPY */ + 444, /* GL_DYNAMIC_DRAW */ + 446, /* GL_DYNAMIC_READ */ + 442, /* GL_DYNAMIC_COPY */ + 1104, /* GL_PIXEL_PACK_BUFFER */ + 1108, /* GL_PIXEL_UNPACK_BUFFER */ + 1105, /* GL_PIXEL_PACK_BUFFER_BINDING */ + 1109, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + 341, /* GL_DEPTH24_STENCIL8 */ + 1688, /* GL_TEXTURE_STENCIL_SIZE */ + 871, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + 869, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + 872, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + 876, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + 875, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + 833, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + 1490, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ 17, /* GL_ACTIVE_STENCIL_FACE_EXT */ - 945, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - 1367, /* GL_SAMPLES_PASSED */ - 513, /* GL_FRAGMENT_SHADER */ - 1796, /* GL_VERTEX_SHADER */ - 1229, /* GL_PROGRAM_OBJECT_ARB */ - 1399, /* GL_SHADER_OBJECT_ARB */ - 869, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - 928, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - 922, /* GL_MAX_VARYING_FLOATS */ - 926, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - 854, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - 1036, /* GL_OBJECT_TYPE_ARB */ - 1401, /* GL_SHADER_TYPE */ - 478, /* GL_FLOAT_VEC2 */ - 480, /* GL_FLOAT_VEC3 */ - 482, /* GL_FLOAT_VEC4 */ - 655, /* GL_INT_VEC2 */ - 657, /* GL_INT_VEC3 */ - 659, /* GL_INT_VEC4 */ - 92, /* GL_BOOL */ - 94, /* GL_BOOL_VEC2 */ - 96, /* GL_BOOL_VEC3 */ - 98, /* GL_BOOL_VEC4 */ - 472, /* GL_FLOAT_MAT2 */ - 474, /* GL_FLOAT_MAT3 */ - 476, /* GL_FLOAT_MAT4 */ - 1358, /* GL_SAMPLER_1D */ - 1360, /* GL_SAMPLER_2D */ - 1362, /* GL_SAMPLER_3D */ - 1363, /* GL_SAMPLER_CUBE */ - 1359, /* GL_SAMPLER_1D_SHADOW */ - 1361, /* GL_SAMPLER_2D_SHADOW */ - 577, /* GL_GL_FLOAT_MAT2x3 */ - 578, /* GL_GL_FLOAT_MAT2x4 */ - 579, /* GL_GL_FLOAT_MAT3x2 */ - 580, /* GL_GL_FLOAT_MAT3x4 */ - 581, /* GL_GL_FLOAT_MAT4x2 */ - 582, /* GL_GL_FLOAT_MAT4x3 */ - 333, /* GL_DELETE_STATUS */ - 242, /* GL_COMPILE_STATUS */ - 709, /* GL_LINK_STATUS */ - 1745, /* GL_VALIDATE_STATUS */ - 640, /* GL_INFO_LOG_LENGTH */ + 933, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + 1361, /* GL_SAMPLES_PASSED */ + 525, /* GL_FRAGMENT_SHADER */ + 1798, /* GL_VERTEX_SHADER */ + 1221, /* GL_PROGRAM_OBJECT_ARB */ + 1393, /* GL_SHADER_OBJECT_ARB */ + 857, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + 916, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + 910, /* GL_MAX_VARYING_FLOATS */ + 914, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + 842, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + 1024, /* GL_OBJECT_TYPE_ARB */ + 1395, /* GL_SHADER_TYPE */ + 490, /* GL_FLOAT_VEC2 */ + 492, /* GL_FLOAT_VEC3 */ + 494, /* GL_FLOAT_VEC4 */ + 643, /* GL_INT_VEC2 */ + 645, /* GL_INT_VEC3 */ + 647, /* GL_INT_VEC4 */ + 93, /* GL_BOOL */ + 95, /* GL_BOOL_VEC2 */ + 97, /* GL_BOOL_VEC3 */ + 99, /* GL_BOOL_VEC4 */ + 478, /* GL_FLOAT_MAT2 */ + 482, /* GL_FLOAT_MAT3 */ + 486, /* GL_FLOAT_MAT4 */ + 1352, /* GL_SAMPLER_1D */ + 1354, /* GL_SAMPLER_2D */ + 1356, /* GL_SAMPLER_3D */ + 1357, /* GL_SAMPLER_CUBE */ + 1353, /* GL_SAMPLER_1D_SHADOW */ + 1355, /* GL_SAMPLER_2D_SHADOW */ + 480, /* GL_FLOAT_MAT2x3 */ + 481, /* GL_FLOAT_MAT2x4 */ + 484, /* GL_FLOAT_MAT3x2 */ + 485, /* GL_FLOAT_MAT3x4 */ + 488, /* GL_FLOAT_MAT4x2 */ + 489, /* GL_FLOAT_MAT4x3 */ + 339, /* GL_DELETE_STATUS */ + 243, /* GL_COMPILE_STATUS */ + 697, /* GL_LINK_STATUS */ + 1747, /* GL_VALIDATE_STATUS */ + 628, /* GL_INFO_LOG_LENGTH */ 55, /* GL_ATTACHED_SHADERS */ 20, /* GL_ACTIVE_UNIFORMS */ 21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ - 1400, /* GL_SHADER_SOURCE_LENGTH */ + 1394, /* GL_SHADER_SOURCE_LENGTH */ 15, /* GL_ACTIVE_ATTRIBUTES */ 16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ - 515, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - 1403, /* GL_SHADING_LANGUAGE_VERSION */ - 311, /* GL_CURRENT_PROGRAM */ - 1085, /* GL_PALETTE4_RGB8_OES */ - 1087, /* GL_PALETTE4_RGBA8_OES */ - 1083, /* GL_PALETTE4_R5_G6_B5_OES */ - 1086, /* GL_PALETTE4_RGBA4_OES */ - 1084, /* GL_PALETTE4_RGB5_A1_OES */ - 1090, /* GL_PALETTE8_RGB8_OES */ - 1092, /* GL_PALETTE8_RGBA8_OES */ - 1088, /* GL_PALETTE8_R5_G6_B5_OES */ - 1091, /* GL_PALETTE8_RGBA4_OES */ - 1089, /* GL_PALETTE8_RGB5_A1_OES */ - 622, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - 621, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - 1730, /* GL_UNSIGNED_NORMALIZED */ - 1576, /* GL_TEXTURE_1D_ARRAY_EXT */ - 1249, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - 1578, /* GL_TEXTURE_2D_ARRAY_EXT */ - 1252, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - 1584, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - 1586, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - 591, /* GL_GL_SRGB */ - 592, /* GL_GL_SRGB8 */ - 594, /* GL_GL_SRGB_ALPHA */ - 593, /* GL_GL_SRGB8_ALPHA8 */ - 590, /* GL_GL_SLUMINANCE_ALPHA */ - 589, /* GL_GL_SLUMINANCE8_ALPHA8 */ - 587, /* GL_GL_SLUMINANCE */ - 588, /* GL_GL_SLUMINANCE8 */ - 574, /* GL_GL_COMPRESSED_SRGB */ - 575, /* GL_GL_COMPRESSED_SRGB_ALPHA */ - 572, /* GL_GL_COMPRESSED_SLUMINANCE */ - 573, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */ - 1146, /* GL_POINT_SPRITE_COORD_ORIGIN */ - 717, /* GL_LOWER_LEFT */ - 1742, /* GL_UPPER_LEFT */ - 1470, /* GL_STENCIL_BACK_REF */ - 1471, /* GL_STENCIL_BACK_VALUE_MASK */ - 1472, /* GL_STENCIL_BACK_WRITEMASK */ - 429, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - 1294, /* GL_RENDERBUFFER_BINDING_EXT */ - 1275, /* GL_READ_FRAMEBUFFER */ - 428, /* GL_DRAW_FRAMEBUFFER */ - 1276, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - 1304, /* GL_RENDERBUFFER_SAMPLES */ - 525, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - 523, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - 534, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - 530, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - 532, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - 537, /* GL_FRAMEBUFFER_COMPLETE */ - 541, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - 547, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - 545, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - 543, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - 546, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - 544, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - 550, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - 553, /* GL_FRAMEBUFFER_UNSUPPORTED */ - 551, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - 851, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ - 151, /* GL_COLOR_ATTACHMENT0 */ - 153, /* GL_COLOR_ATTACHMENT1 */ - 167, /* GL_COLOR_ATTACHMENT2 */ - 169, /* GL_COLOR_ATTACHMENT3 */ - 171, /* GL_COLOR_ATTACHMENT4 */ - 173, /* GL_COLOR_ATTACHMENT5 */ - 175, /* GL_COLOR_ATTACHMENT6 */ - 177, /* GL_COLOR_ATTACHMENT7 */ - 179, /* GL_COLOR_ATTACHMENT8 */ - 181, /* GL_COLOR_ATTACHMENT9 */ - 154, /* GL_COLOR_ATTACHMENT10 */ - 156, /* GL_COLOR_ATTACHMENT11 */ - 158, /* GL_COLOR_ATTACHMENT12 */ - 160, /* GL_COLOR_ATTACHMENT13 */ - 162, /* GL_COLOR_ATTACHMENT14 */ - 164, /* GL_COLOR_ATTACHMENT15 */ - 336, /* GL_DEPTH_ATTACHMENT */ - 1460, /* GL_STENCIL_ATTACHMENT */ - 516, /* GL_FRAMEBUFFER */ - 1292, /* GL_RENDERBUFFER */ - 1306, /* GL_RENDERBUFFER_WIDTH */ - 1299, /* GL_RENDERBUFFER_HEIGHT */ - 1301, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - 1483, /* GL_STENCIL_INDEX_EXT */ - 1480, /* GL_STENCIL_INDEX1_EXT */ - 1481, /* GL_STENCIL_INDEX4_EXT */ - 1482, /* GL_STENCIL_INDEX8_EXT */ - 1479, /* GL_STENCIL_INDEX16_EXT */ - 1303, /* GL_RENDERBUFFER_RED_SIZE */ - 1298, /* GL_RENDERBUFFER_GREEN_SIZE */ - 1295, /* GL_RENDERBUFFER_BLUE_SIZE */ - 1293, /* GL_RENDERBUFFER_ALPHA_SIZE */ - 1296, /* GL_RENDERBUFFER_DEPTH_SIZE */ - 1305, /* GL_RENDERBUFFER_STENCIL_SIZE */ - 549, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - 907, /* GL_MAX_SAMPLES */ - 455, /* GL_EVAL_BIT */ - 1273, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - 711, /* GL_LIST_BIT */ - 1592, /* GL_TEXTURE_BIT */ - 1382, /* GL_SCISSOR_BIT */ + 527, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + 1397, /* GL_SHADING_LANGUAGE_VERSION */ + 316, /* GL_CURRENT_PROGRAM */ + 1073, /* GL_PALETTE4_RGB8_OES */ + 1075, /* GL_PALETTE4_RGBA8_OES */ + 1071, /* GL_PALETTE4_R5_G6_B5_OES */ + 1074, /* GL_PALETTE4_RGBA4_OES */ + 1072, /* GL_PALETTE4_RGB5_A1_OES */ + 1078, /* GL_PALETTE8_RGB8_OES */ + 1080, /* GL_PALETTE8_RGBA8_OES */ + 1076, /* GL_PALETTE8_R5_G6_B5_OES */ + 1079, /* GL_PALETTE8_RGBA4_OES */ + 1077, /* GL_PALETTE8_RGB5_A1_OES */ + 610, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + 609, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + 1732, /* GL_UNSIGNED_NORMALIZED */ + 1578, /* GL_TEXTURE_1D_ARRAY_EXT */ + 1241, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + 1580, /* GL_TEXTURE_2D_ARRAY_EXT */ + 1244, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + 1586, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + 1588, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + 1449, /* GL_SRGB */ + 1450, /* GL_SRGB8 */ + 1452, /* GL_SRGB_ALPHA */ + 1451, /* GL_SRGB8_ALPHA8 */ + 1409, /* GL_SLUMINANCE_ALPHA */ + 1408, /* GL_SLUMINANCE8_ALPHA8 */ + 1406, /* GL_SLUMINANCE */ + 1407, /* GL_SLUMINANCE8 */ + 264, /* GL_COMPRESSED_SRGB */ + 265, /* GL_COMPRESSED_SRGB_ALPHA */ + 262, /* GL_COMPRESSED_SLUMINANCE */ + 263, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ + 1138, /* GL_POINT_SPRITE_COORD_ORIGIN */ + 705, /* GL_LOWER_LEFT */ + 1744, /* GL_UPPER_LEFT */ + 1472, /* GL_STENCIL_BACK_REF */ + 1473, /* GL_STENCIL_BACK_VALUE_MASK */ + 1474, /* GL_STENCIL_BACK_WRITEMASK */ + 435, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ + 1286, /* GL_RENDERBUFFER_BINDING_EXT */ + 1267, /* GL_READ_FRAMEBUFFER */ + 434, /* GL_DRAW_FRAMEBUFFER */ + 1268, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + 1296, /* GL_RENDERBUFFER_SAMPLES */ + 537, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + 535, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + 546, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + 542, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + 544, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + 549, /* GL_FRAMEBUFFER_COMPLETE */ + 553, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + 559, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + 557, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + 555, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + 558, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + 556, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + 562, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + 565, /* GL_FRAMEBUFFER_UNSUPPORTED */ + 563, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + 839, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + 152, /* GL_COLOR_ATTACHMENT0 */ + 154, /* GL_COLOR_ATTACHMENT1 */ + 168, /* GL_COLOR_ATTACHMENT2 */ + 170, /* GL_COLOR_ATTACHMENT3 */ + 172, /* GL_COLOR_ATTACHMENT4 */ + 174, /* GL_COLOR_ATTACHMENT5 */ + 176, /* GL_COLOR_ATTACHMENT6 */ + 178, /* GL_COLOR_ATTACHMENT7 */ + 180, /* GL_COLOR_ATTACHMENT8 */ + 182, /* GL_COLOR_ATTACHMENT9 */ + 155, /* GL_COLOR_ATTACHMENT10 */ + 157, /* GL_COLOR_ATTACHMENT11 */ + 159, /* GL_COLOR_ATTACHMENT12 */ + 161, /* GL_COLOR_ATTACHMENT13 */ + 163, /* GL_COLOR_ATTACHMENT14 */ + 165, /* GL_COLOR_ATTACHMENT15 */ + 342, /* GL_DEPTH_ATTACHMENT */ + 1462, /* GL_STENCIL_ATTACHMENT */ + 528, /* GL_FRAMEBUFFER */ + 1284, /* GL_RENDERBUFFER */ + 1298, /* GL_RENDERBUFFER_WIDTH */ + 1291, /* GL_RENDERBUFFER_HEIGHT */ + 1293, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + 1485, /* GL_STENCIL_INDEX_EXT */ + 1482, /* GL_STENCIL_INDEX1_EXT */ + 1483, /* GL_STENCIL_INDEX4_EXT */ + 1484, /* GL_STENCIL_INDEX8_EXT */ + 1481, /* GL_STENCIL_INDEX16_EXT */ + 1295, /* GL_RENDERBUFFER_RED_SIZE */ + 1290, /* GL_RENDERBUFFER_GREEN_SIZE */ + 1287, /* GL_RENDERBUFFER_BLUE_SIZE */ + 1285, /* GL_RENDERBUFFER_ALPHA_SIZE */ + 1288, /* GL_RENDERBUFFER_DEPTH_SIZE */ + 1297, /* GL_RENDERBUFFER_STENCIL_SIZE */ + 561, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + 895, /* GL_MAX_SAMPLES */ + 1345, /* GL_RGBA_SNORM */ + 1341, /* GL_RGBA8_SNORM */ + 1402, /* GL_SIGNED_NORMALIZED */ + 461, /* GL_EVAL_BIT */ + 1265, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + 699, /* GL_LIST_BIT */ + 1594, /* GL_TEXTURE_BIT */ + 1376, /* GL_SCISSOR_BIT */ 29, /* GL_ALL_ATTRIB_BITS */ - 992, /* GL_MULTISAMPLE_BIT */ + 980, /* GL_MULTISAMPLE_BIT */ 30, /* GL_ALL_CLIENT_ATTRIB_BITS */ }; -- cgit v1.2.3 From bb386a1ecae6d7f805af44df463b0e4d661eef85 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 27 Mar 2009 21:59:33 +0100 Subject: mesa: add _rev signed rgba texture format --- src/mesa/main/texformat.c | 25 +++++++++++++++++++++++++ src/mesa/main/texformat.h | 4 +++- src/mesa/main/texformat_tmp.h | 23 ++++++++++++++++++++++- src/mesa/main/texstore.c | 31 ++++++++++++++++++++++++++++--- 4 files changed, 78 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 0ceaaf3ecec..ee531c45c69 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -746,6 +746,30 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { store_texel_signed_rgba8888 /* StoreTexel */ }; +const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { + MESA_FORMAT_SIGNED_RGBA8888_REV, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_SIGNED_NORMALIZED, /* DataType */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 4, /* TexelBytes */ + _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_signed_rgba8888_rev, /* FetchTexel1Df */ + fetch_texel_2d_signed_rgba8888_rev, /* FetchTexel2Df */ + fetch_texel_3d_signed_rgba8888_rev, /* FetchTexel3Df */ + store_texel_signed_rgba8888_rev /* StoreTexel */ +}; + /*@}*/ @@ -1854,6 +1878,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, return; case MESA_FORMAT_SIGNED_RGBA8888: + case MESA_FORMAT_SIGNED_RGBA8888_REV: *datatype = GL_BYTE; *comps = 4; return; diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 3a08339adfd..5aa1d756cbc 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -169,7 +169,8 @@ enum _format { */ /*@{*/ MESA_FORMAT_DUDV8, - MESA_FORMAT_SIGNED_RGBA8888 + MESA_FORMAT_SIGNED_RGBA8888, + MESA_FORMAT_SIGNED_RGBA8888_REV /*@}*/ }; @@ -221,6 +222,7 @@ extern const struct gl_texture_format _mesa_texformat_intensity_float16; /*@{*/ extern const struct gl_texture_format _mesa_texformat_dudv8; extern const struct gl_texture_format _mesa_texformat_signed_rgba8888; +extern const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev; /*@}*/ /** \name Assorted hardware-friendly formats */ diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 604b1a744cb..ae57baf9222 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1321,7 +1321,7 @@ static void FETCH(dudv8)(const struct gl_texture_image *texImage, texel[ACOMP] = 0; } -/* MESA_FORMAT_SIGNED_ARGB8888 ***********************************************/ +/* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/ static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1343,6 +1343,27 @@ static void store_texel_signed_rgba8888(struct gl_texture_image *texImage, } #endif +static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s ) & 0xff ); + texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 8) & 0xff ); + texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff ); + texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s >> 24) ); +} + +#if DIM == 3 +static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); +} +#endif + + /* MESA_FORMAT_YCBCR *********************************************************/ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 785fb506220..7e7e0ac07a4 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2564,14 +2564,15 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) } /** - * Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV. + * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or MESA_FORMAT_SIGNED_RGBA8888_REV */ GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888); + ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888 || + dstFormat == &_mesa_texformat_signed_rgba8888_rev); ASSERT(dstFormat->TexelBytes == 4); if (!ctx->_ImageTransferState && @@ -2588,6 +2589,20 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_signed_rgba8888_rev && + baseInternalFormat == GL_RGBA && + ((srcFormat == GL_RGBA && srcType == GL_BYTE && littleEndian) || + (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } else if (!ctx->_ImageTransferState && (srcType == GL_BYTE) && can_swizzle(baseInternalFormat) && @@ -2597,7 +2612,8 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if (littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) { + if ((littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) || + (!littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888_rev)) { dstmap[3] = 0; dstmap[2] = 1; dstmap[1] = 2; @@ -2649,6 +2665,15 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) srcRow += 4; } } + else { + for (col = 0; col < srcWidth; col++) { + dstUI[col] = PACK_COLOR_8888_REV( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]), + FLOAT_TO_BYTE_TEX(srcRow[GCOMP]), + FLOAT_TO_BYTE_TEX(srcRow[BCOMP]), + FLOAT_TO_BYTE_TEX(srcRow[ACOMP]) ); + srcRow += 4; + } + } dstRow += dstRowStride; } } -- cgit v1.2.3 From 79e2df63af4d231a1223887e79a819b3baac9a6c Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 27 Mar 2009 22:42:19 +0100 Subject: i965: add support for signed rgba texture format --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 4 ++++ src/mesa/drivers/dri/intel/intel_extensions.c | 1 + src/mesa/drivers/dri/intel/intel_tex_format.c | 4 ++++ 3 files changed, 9 insertions(+) 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 e6113eff87e..66ce9289558 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -142,6 +142,7 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format, case MESA_FORMAT_SRGBA8: return BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB; + case MESA_FORMAT_SRGB_DXT1: return BRW_SURFACEFORMAT_BC1_UNORM_SRGB; @@ -159,6 +160,9 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format, case MESA_FORMAT_DUDV8: return BRW_SURFACEFORMAT_R8G8_SNORM; + case MESA_FORMAT_SIGNED_RGBA8888_REV: + return BRW_SURFACEFORMAT_R8G8B8A8_SNORM; + default: assert(0); return 0; diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 8dd0b2461bd..9ec1b4ec2f4 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -132,6 +132,7 @@ static const struct dri_extension brw_extensions[] = { { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions }, { "GL_ARB_shadow", NULL }, + { "GL_MESA_texture_signed_rgba", NULL }, { "GL_ARB_texture_non_power_of_two", NULL }, { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions }, { "GL_EXT_shadow_funcs", NULL }, diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index 8732354e7a5..ce33cdc218b 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -175,9 +175,13 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return &_mesa_texformat_srgb_dxt1; + /* i915 could also do this */ case GL_DUDV_ATI: case GL_DU8DV8_ATI: return &_mesa_texformat_dudv8; + case GL_RGBA_SNORM: + case GL_RGBA8_SNORM: + return &_mesa_texformat_signed_rgba8888_rev; #endif default: -- cgit v1.2.3 From 02a579f2e7abc832dd46956048d1116f7dc3dd92 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 28 Mar 2009 01:19:49 +0100 Subject: mesa: fix a glGetTexImage issue with base-converted texture formats need to respect the user-supplied base format, not the one derived from the texture format actually used. --- src/mesa/main/texformat.c | 1 + src/mesa/main/texstore.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index ee531c45c69..0d60e5ebd34 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -382,6 +382,7 @@ const struct gl_texture_format _mesa_texformat_sl8 = { store_texel_sl8 /* StoreTexel */ }; +/* Note: this format name looks like a misnomer, make it sal8? */ const struct gl_texture_format _mesa_texformat_sla8 = { MESA_FORMAT_SLA8, /* MesaFormat */ GL_LUMINANCE_ALPHA, /* BaseFormat */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 7e7e0ac07a4..a94df532c64 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -4078,18 +4078,18 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, for (col = 0; col < width; col++) { (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); - if (texImage->TexFormat->BaseFormat == GL_LUMINANCE) { + if (texImage->_BaseFormat == GL_LUMINANCE) { rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); rgba[col][GCOMP] = 0.0; rgba[col][BCOMP] = 0.0; } - else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE_ALPHA) { + else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) { rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); rgba[col][GCOMP] = 0.0; rgba[col][BCOMP] = 0.0; } - else if (texImage->TexFormat->BaseFormat == GL_RGB || - texImage->TexFormat->BaseFormat == GL_RGBA) { + else if (texImage->_BaseFormat == GL_RGB || + texImage->_BaseFormat == GL_RGBA) { rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]); rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]); @@ -4117,21 +4117,21 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, for (col = 0; col < width; col++) { (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); - if (texImage->TexFormat->BaseFormat == GL_ALPHA) { + if (texImage->_BaseFormat == GL_ALPHA) { rgba[col][RCOMP] = 0.0; rgba[col][GCOMP] = 0.0; rgba[col][BCOMP] = 0.0; } - else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE) { + else if (texImage->_BaseFormat == GL_LUMINANCE) { rgba[col][GCOMP] = 0.0; rgba[col][BCOMP] = 0.0; rgba[col][ACOMP] = 1.0; } - else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE_ALPHA) { + else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) { rgba[col][GCOMP] = 0.0; rgba[col][BCOMP] = 0.0; } - else if (texImage->TexFormat->BaseFormat == GL_INTENSITY) { + else if (texImage->_BaseFormat == GL_INTENSITY) { rgba[col][GCOMP] = 0.0; rgba[col][BCOMP] = 0.0; rgba[col][ACOMP] = 1.0; -- cgit v1.2.3 From a693a2998c996f063edec8a83a4f6a175f39c471 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 28 Mar 2009 01:43:50 +0100 Subject: i965: srgb texture fixes i965 can either do SRGBA8_REV format or SARGB8 format, but not SRGBA8. Could add SRGBA8_REV support to mesa, but simply use SARGB8 for now. While here, also add true srgb luminance / luminance_alpha support - unfortunately the published docs fail to mention which asics support this, tested on g43 so assume this works on any g4x. --- src/mesa/drivers/dri/i965/brw_defines.h | 8 +++++--- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 10 ++++++++-- src/mesa/drivers/dri/intel/intel_tex_format.c | 19 ++++++++++++++----- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 74dbba4fdd1..98fc909c2ad 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -367,9 +367,10 @@ #define BRW_SURFACEFORMAT_L8A8_UNORM 0x114 #define BRW_SURFACEFORMAT_I16_FLOAT 0x115 #define BRW_SURFACEFORMAT_L16_FLOAT 0x116 -#define BRW_SURFACEFORMAT_A16_FLOAT 0x117 -#define BRW_SURFACEFORMAT_R5G5_SNORM_B6_UNORM 0x119 -#define BRW_SURFACEFORMAT_B5G5R5X1_UNORM 0x11A +#define BRW_SURFACEFORMAT_A16_FLOAT 0x117 +#define BRW_SURFACEFORMAT_L8A8_UNORM_SRGB 0x118 +#define BRW_SURFACEFORMAT_R5G5_SNORM_B6_UNORM 0x119 +#define BRW_SURFACEFORMAT_B5G5R5X1_UNORM 0x11A #define BRW_SURFACEFORMAT_B5G5R5X1_UNORM_SRGB 0x11B #define BRW_SURFACEFORMAT_R8G8_SSCALED 0x11C #define BRW_SURFACEFORMAT_R8G8_USCALED 0x11D @@ -386,6 +387,7 @@ #define BRW_SURFACEFORMAT_A4P4_UNORM 0x148 #define BRW_SURFACEFORMAT_R8_SSCALED 0x149 #define BRW_SURFACEFORMAT_R8_USCALED 0x14A +#define BRW_SURFACEFORMAT_L8_UNORM_SRGB 0x14C #define BRW_SURFACEFORMAT_R1_UINT 0x181 #define BRW_SURFACEFORMAT_YCRCB_NORMAL 0x182 #define BRW_SURFACEFORMAT_YCRCB_SWAPUVY 0x183 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 66ce9289558..2f1f4c55f94 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -140,8 +140,14 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format, case MESA_FORMAT_RGBA_DXT5: return BRW_SURFACEFORMAT_BC3_UNORM; - case MESA_FORMAT_SRGBA8: - return BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB; + case MESA_FORMAT_SARGB8: + return BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB; + + case MESA_FORMAT_SLA8: + return BRW_SURFACEFORMAT_L8A8_UNORM_SRGB; + + case MESA_FORMAT_SL8: + return BRW_SURFACEFORMAT_L8_UNORM_SRGB; case MESA_FORMAT_SRGB_DXT1: return BRW_SURFACEFORMAT_BC1_UNORM_SRGB; diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index ce33cdc218b..3322a711307 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -1,5 +1,6 @@ #include "intel_context.h" #include "intel_tex.h" +#include "intel_chipset.h" #include "main/texformat.h" #include "main/enums.h" @@ -160,15 +161,23 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_SRGB8_EXT: case GL_SRGB_ALPHA_EXT: case GL_SRGB8_ALPHA8_EXT: - case GL_SLUMINANCE_EXT: - case GL_SLUMINANCE8_EXT: - case GL_SLUMINANCE_ALPHA_EXT: - case GL_SLUMINANCE8_ALPHA8_EXT: case GL_COMPRESSED_SRGB_EXT: case GL_COMPRESSED_SRGB_ALPHA_EXT: case GL_COMPRESSED_SLUMINANCE_EXT: case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: - return &_mesa_texformat_srgba8; + return &_mesa_texformat_sargb8; + case GL_SLUMINANCE_EXT: + case GL_SLUMINANCE8_EXT: + if (IS_G4X(intel->intelScreen->deviceID)) + return &_mesa_texformat_sl8; + else + return &_mesa_texformat_sargb8; + case GL_SLUMINANCE_ALPHA_EXT: + case GL_SLUMINANCE8_ALPHA8_EXT: + if (IS_G4X(intel->intelScreen->deviceID)) + return &_mesa_texformat_sla8; + else + return &_mesa_texformat_sargb8; case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: -- cgit v1.2.3 From a20bae3d17a812a5144553963174191288457cf7 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 12:12:20 +0100 Subject: scons: Get python extensions building correctly on windows. --- scons/python.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scons/python.py b/scons/python.py index 539184dd39c..9e94d056e1c 100644 --- a/scons/python.py +++ b/scons/python.py @@ -38,7 +38,7 @@ import os.path def generate(env): # See http://www.scons.org/wiki/PythonExtensions - if sys.platform in ['windows']: + if sys.platform in ['win32']: python_root = sys.prefix python_version = '%u%u' % sys.version_info[:2] python_include = os.path.join(python_root, 'include') @@ -56,6 +56,8 @@ def generate(env): cppdefines = env['CPPDEFINES'] cppdefines = [define for define in cppdefines if define != '_DEBUG'] env.Replace(CPPDEFINES = cppdefines) + env.AppendUnique(CPPFLAGS = ['/U_DEBUG']) + env.AppendUnique(LINKFLAGS = ['/nodefaultlib:python25_d.lib']) else: #env.ParseConfig('python-config --cflags --ldflags --libs') env.AppendUnique(CPPPATH = [distutils.sysconfig.get_python_inc()]) -- cgit v1.2.3 From 29933fc6fec88e0c20e6ba4feebce10934eb48a3 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 12:12:37 +0100 Subject: python: Update instructions for windows. --- src/gallium/state_trackers/python/README | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/python/README b/src/gallium/state_trackers/python/README index 4281d9bdb0d..e03d5468304 100644 --- a/src/gallium/state_trackers/python/README +++ b/src/gallium/state_trackers/python/README @@ -6,20 +6,27 @@ the python script perspective. To build you'll need: * Python (with development packages) * SCons -* SWIG -* Python Imaging Library with TK support (for the samples) +* SWIG, http://www.swig.org/download.html +* Python Imaging Library with TK support, http://www.pythonware.com/products/pil/, + for the samples On a debian-based distro you can simply do: aptitude install python-dev scons swig python-imaging python-imaging-tk +On a Windows machine ensure the swig command is in your PATH. + Invoke scons on the top dir as - scons debug=yes statetrackers=python driver=softpipe,trace + scons debug=yes statetrackers=python drivers=softpipe,trace winsys=none + +To use it set PYTHONPATH appropriately, e.g, in Linux do: + + export PYTHONPATH=$PWD/build/linux-x86-debug/gallium/state_trackers/python -To use do +or (in Windows) - export PYTHONPATH=$PWD/build/XXXX-XXXX-XXXX/gallium/state_trackers/python + set PYTHONPATH=%CD%\build\windows-x86-debug\gallium\state_trackers\python and then try running @@ -31,7 +38,6 @@ which should show a triangle. This is still work in progress: - errors are not handled properly and almost always result in crash - state atoms with array members are awkward to set -- there no efficient way to view images -- -Jose Fonseca +Jose Fonseca -- cgit v1.2.3 From 1c989c24aea5a4cc8807cbc46e68e62f4d28f018 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 14:24:20 +0100 Subject: python: Dont touch old pipe_winsys. --- src/gallium/state_trackers/python/gallium.i | 1 - src/gallium/state_trackers/python/p_context.i | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i index 4970819190e..38f8245adf5 100644 --- a/src/gallium/state_trackers/python/gallium.i +++ b/src/gallium/state_trackers/python/gallium.i @@ -42,7 +42,6 @@ #include "pipe/p_context.h" #include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" -#include "pipe/internal/p_winsys_screen.h" #include "cso_cache/cso_context.h" #include "util/u_draw_quad.h" #include "util/u_tile.h" diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 05f3f222035..6dcd38e7d14 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -257,8 +257,8 @@ error1: struct pipe_fence_handle *fence = NULL; $self->pipe->flush($self->pipe, flags | PIPE_FLUSH_RENDER_CACHE, &fence); /* TODO: allow asynchronous operation */ - $self->pipe->winsys->fence_finish( $self->pipe->winsys, fence, 0 ); - $self->pipe->winsys->fence_reference( $self->pipe->winsys, &fence, NULL ); + $self->pipe->screen->fence_finish( $self->pipe->screen, fence, 0 ); + $self->pipe->screen->fence_reference( $self->pipe->screen, &fence, NULL ); } /* -- cgit v1.2.3 From 25e491e68c4c191a7f76b24520e5812356fe5a85 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 30 Mar 2009 15:39:29 +0200 Subject: tgsi: Document BRA opcode. --- src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index 5b21a2be0bd..d3b66728e6d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -548,7 +548,7 @@ TGSI Instruction Specification 1.6.3 BRA - Branch - TBD + pc = target 1.6.4 CAL - Subroutine Call -- cgit v1.2.3 From bd4c1c133b19e87d372c4f1c4e1cb7cae178d381 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 30 Mar 2009 17:12:58 +0200 Subject: tgsi: Explain symbols used in instruction set documentation. --- .../auxiliary/tgsi/tgsi-instruction-set.txt | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index d3b66728e6d..d6b8fef83c1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -1038,3 +1038,74 @@ TGSI Instruction Specification Alias for ARR. + +2 Explanation of symbols used +============================== + + +2.1 Functions +-------------- + + + abs(x) Absolute value of x. + |x| + (x < 0.0) ? -x : x + + ceil(x) Ceiling of x. + + clamp(x,y,z) Clamp x between y and z. + (x < y) ? y : (x > z) ? z : x + + cos(x) Cosine of x. + + floor(x) Floor of x. + + lg2(x) Logarithm base 2 of x. + + max(x,y) Maximum of x and y. + (x > y) ? x : y + + min(x,y) Minimum of x and y. + (x < y) ? x : y + + partialx(x) Derivative of x relative to fragment's X. + + partialy(x) Derivative of x relative to fragment's Y. + + pop() Pop from stack. + + pow(x,y) Raise x to power of y. + + push(x) Push x on stack. + + round(x) Round x. + + sin(x) Sine of x. + + sqrt(x) Square root of x. + + trunc(x) Truncate x. + + +2.2 Keywords +------------- + + + discard Discard fragment. + + dst First destination register. + + dst0 First destination register. + + pc Program counter. + + src First source register. + + src0 First source register. + + src1 Second source register. + + src2 Third source register. + + target Label of target instruction. + -- cgit v1.2.3 From e08a0f479055be08a08594d723aa8837778c79f8 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 30 Mar 2009 17:13:52 +0200 Subject: tgsi: Condition codes are implied in KILP. --- src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index d6b8fef83c1..a20ad689c08 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -382,9 +382,7 @@ TGSI Instruction Specification 1.5.7 KILP - Predicated Discard - if (cc.x || cc.y || cc.z || cc.w) - discard - endif + discard 1.5.8 LG2 - Logarithm Base 2 -- cgit v1.2.3 From 68342f9036d3c94ee50c4cbe5c7b36439eeb6825 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 15:09:18 +0100 Subject: python: Hide away the surface usage flags. Surfaces are now by definition GPU views. So CPU access flags don't make any sense when creating a surface. For now we are forcing surfaces to be GPU read/write, but that will go away soon. --- src/gallium/state_trackers/python/p_texture.i | 3 ++- src/gallium/state_trackers/python/retrace/interpreter.py | 2 +- src/gallium/state_trackers/python/samples/tri.py | 6 +++--- src/gallium/state_trackers/python/tests/texture.py | 5 ++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index b03054adcce..fee9fb0bf84 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -79,8 +79,9 @@ /** Get a surface which is a "view" into a texture */ struct pipe_surface * - get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0, unsigned usage=0 ) + get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0 ) { + const usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE; struct pipe_screen *screen = $self->screen; return screen->get_tex_surface(screen, $self, face, level, zslice, usage); } diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index a22314d2000..510adcc2425 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -272,7 +272,7 @@ class Screen(Object): pass def get_tex_surface(self, texture, face, level, zslice, usage): - return texture.get_surface(face, level, zslice, usage) + return texture.get_surface(face, level, zslice) def tex_surface_destroy(self, surface): self.interpreter.unregister_object(surface) diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index 9581b307bf5..72e94560af4 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -135,7 +135,7 @@ def test(dev): width, height, tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, ) - _cbuf = cbuf.get_surface(usage = PIPE_BUFFER_USAGE_GPU_READ|PIPE_BUFFER_USAGE_GPU_WRITE) + _cbuf = cbuf.get_surface() fb = Framebuffer() fb.width = width fb.height = height @@ -205,8 +205,8 @@ def test(dev): ctx.flush() - show_image(cbuf.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE)) - #save_image('tri.png', cbuf.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE)) + show_image(cbuf.get_surface()) + #save_image('tri.png', cbuf.get_surface()) diff --git a/src/gallium/state_trackers/python/tests/texture.py b/src/gallium/state_trackers/python/tests/texture.py index ce1c66720b4..bd95f734fe7 100644 --- a/src/gallium/state_trackers/python/tests/texture.py +++ b/src/gallium/state_trackers/python/tests/texture.py @@ -197,7 +197,6 @@ class TextureTest(TestCase): expected_rgba = FloatArray(height*width*4) texture.get_surface( - usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE, face = face, level = level, zslice = zslice, @@ -213,7 +212,7 @@ class TextureTest(TestCase): tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET, ) - cbuf = cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_GPU_WRITE|PIPE_BUFFER_USAGE_GPU_READ) + cbuf = cbuf_tex.get_surface() fb = Framebuffer() fb.width = width fb.height = height @@ -290,7 +289,7 @@ class TextureTest(TestCase): ctx.flush() - cbuf = cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ) + cbuf = cbuf_tex.get_surface() total = h*w different = cbuf.compare_tile_rgba(x, y, w, h, expected_rgba, tol=4.0/256) -- cgit v1.2.3 From 28de69d6819eab289a400482d15797b662e4d633 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 16:02:21 +0100 Subject: python: Set the surface GPU access flags. Make python surface just a dumb (texture, face, level, zslice) tuple. --- src/gallium/state_trackers/python/gallium.i | 2 +- src/gallium/state_trackers/python/p_context.i | 85 +++++++++++++++++++++++---- src/gallium/state_trackers/python/p_state.i | 31 ++++++++-- src/gallium/state_trackers/python/p_texture.i | 84 +++++++++++++++++++++----- src/gallium/state_trackers/python/st_device.h | 19 ++++++ src/gallium/state_trackers/python/st_sample.c | 22 ++++--- src/gallium/state_trackers/python/st_sample.h | 2 +- 7 files changed, 206 insertions(+), 39 deletions(-) diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i index 38f8245adf5..3f79cc1a3d7 100644 --- a/src/gallium/state_trackers/python/gallium.i +++ b/src/gallium/state_trackers/python/gallium.i @@ -69,7 +69,7 @@ %rename(Device) st_device; %rename(Context) st_context; %rename(Texture) pipe_texture; -%rename(Surface) pipe_surface; +%rename(Surface) st_surface; %rename(Buffer) pipe_buffer; %rename(BlendColor) pipe_blend_color; diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 6dcd38e7d14..a0bf063d814 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -124,7 +124,9 @@ struct st_context { $self->pipe->set_constant_buffer($self->pipe, shader, index, &state); } - void set_framebuffer(const struct pipe_framebuffer_state *state ) { + void set_framebuffer(const struct pipe_framebuffer_state *state ) + { + memcpy(&$self->framebuffer, state, sizeof *state); cso_set_framebuffer($self->cso, state); } @@ -265,23 +267,86 @@ error1: * Surface functions */ - void surface_copy(struct pipe_surface *dest, + void surface_copy(struct st_surface *dst, unsigned destx, unsigned desty, - struct pipe_surface *src, + struct st_surface *src, unsigned srcx, unsigned srcy, - unsigned width, unsigned height) { - $self->pipe->surface_copy($self->pipe, dest, destx, desty, src, srcx, srcy, width, height); + unsigned width, unsigned height) + { + struct pipe_surface *_dst = NULL; + struct pipe_surface *_src = NULL; + + _dst = st_pipe_surface(dst, PIPE_BUFFER_USAGE_GPU_WRITE); + if(!_dst) + SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing"); + + _src = st_pipe_surface(src, PIPE_BUFFER_USAGE_GPU_READ); + if(!_src) + SWIG_exception(SWIG_ValueError, "couldn't acquire source surface for reading"); + + $self->pipe->surface_copy($self->pipe, _dst, destx, desty, _src, srcx, srcy, width, height); + + fail: + pipe_surface_reference(&_src, NULL); + pipe_surface_reference(&_dst, NULL); } - void surface_fill(struct pipe_surface *dst, + void surface_fill(struct st_surface *dst, unsigned x, unsigned y, unsigned width, unsigned height, - unsigned value) { - $self->pipe->surface_fill($self->pipe, dst, x, y, width, height, value); + unsigned value) + { + struct pipe_surface *_dst = NULL; + + _dst = st_pipe_surface(dst, PIPE_BUFFER_USAGE_GPU_WRITE); + if(!_dst) + SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing"); + + $self->pipe->surface_fill($self->pipe, _dst, x, y, width, height, value); + + fail: + pipe_surface_reference(&_dst, NULL); } - void surface_clear(struct pipe_surface *surface, unsigned value = 0) { - $self->pipe->clear($self->pipe, surface, value); + void surface_clear(struct st_surface *surface, unsigned value = 0) + { + unsigned i; + struct pipe_surface *_surface = NULL; + + if(!surface) + SWIG_exception(SWIG_TypeError, "surface must not be null"); + + for(i = 0; i < $self->framebuffer.nr_cbufs; ++i) { + struct pipe_surface *cbuf = $self->framebuffer.cbufs[i]; + if(cbuf) { + if(cbuf->texture == surface->texture && + cbuf->face == surface->face && + cbuf->level == surface->level && + cbuf->zslice == surface->zslice) { + _surface = cbuf; + break; + } + } + } + + if(!_surface) { + struct pipe_surface *zsbuf = $self->framebuffer.zsbuf; + if(zsbuf) { + if(zsbuf->texture == surface->texture && + zsbuf->face == surface->face && + zsbuf->level == surface->level && + zsbuf->zslice == surface->zslice) { + _surface = zsbuf; + } + } + } + + if(!_surface) + SWIG_exception(SWIG_ValueError, "surface not bound"); + + $self->pipe->clear($self->pipe, _surface, value); + fail: + return; } }; diff --git a/src/gallium/state_trackers/python/p_state.i b/src/gallium/state_trackers/python/p_state.i index 110b3d5da43..fc8607ba72f 100644 --- a/src/gallium/state_trackers/python/p_state.i +++ b/src/gallium/state_trackers/python/p_state.i @@ -59,13 +59,36 @@ } void - set_cbuf(unsigned index, struct pipe_surface *surface) { - pipe_surface_reference(&$self->cbufs[index], surface); + set_cbuf(unsigned index, struct st_surface *surface) + { + struct pipe_surface *_surface = NULL; + + if(index >= PIPE_MAX_COLOR_BUFS) + SWIG_exception(SWIG_ValueError, "index out of bounds"); + + _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE); + if(!_surface) + SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing"); + + pipe_surface_reference(&$self->cbufs[index], _surface); + + fail: + return; } void - set_zsbuf(struct pipe_surface *surface) { - pipe_surface_reference(&$self->zsbuf, surface); + set_zsbuf(struct st_surface *surface) + { + struct pipe_surface *_surface = NULL; + + _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE); + if(!_surface) + SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing"); + + pipe_surface_reference(&$self->zsbuf, _surface); + + fail: + return; } }; diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index fee9fb0bf84..543a0cf33f8 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -34,18 +34,19 @@ %nodefaultctor pipe_texture; -%nodefaultctor pipe_surface; +%nodefaultctor st_surface; %nodefaultctor pipe_buffer; %nodefaultdtor pipe_texture; -%nodefaultdtor pipe_surface; +%nodefaultdtor st_surface; %nodefaultdtor pipe_buffer; %ignore pipe_texture::screen; -%ignore pipe_surface::winsys; -%immutable pipe_surface::texture; -%immutable pipe_surface::buffer; +%immutable st_surface::texture; +%immutable st_surface::face; +%immutable st_surface::level; +%immutable st_surface::zslice; %newobject pipe_texture::get_surface; @@ -78,22 +79,57 @@ } /** Get a surface which is a "view" into a texture */ - struct pipe_surface * - get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0 ) + struct st_surface * + get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0) { - const usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE; - struct pipe_screen *screen = $self->screen; - return screen->get_tex_surface(screen, $self, face, level, zslice, usage); + struct st_surface *surface; + + if(face >= ($self->target == PIPE_TEXTURE_CUBE ? 6 : 1)) + SWIG_exception(SWIG_ValueError, "face out of bounds"); + if(level > $self->last_level) + SWIG_exception(SWIG_ValueError, "level out of bounds"); + if(zslice >= $self->depth[level]) + SWIG_exception(SWIG_ValueError, "zslice out of bounds"); + + surface = CALLOC_STRUCT(st_surface); + if(!surface) + return NULL; + + pipe_texture_reference(&surface->texture, $self); + surface->face = face; + surface->level = level; + surface->zslice = zslice; + + return surface; + + fail: + return NULL; } }; +struct st_surface +{ + %immutable; + + struct pipe_texture *texture; + unsigned face; + unsigned level; + unsigned zslice; + +}; -%extend pipe_surface { +%extend st_surface { + + %immutable; - ~pipe_surface() { - struct pipe_surface *ptr = $self; - pipe_surface_reference(&ptr, NULL); + unsigned format; + unsigned width; + unsigned height; + + ~st_surface() { + pipe_texture_reference(&$self->texture, NULL); + FREE($self); } void @@ -309,6 +345,26 @@ }; +%{ + static enum pipe_format + st_surface_format_get(struct st_surface *surface) + { + return surface->texture->format; + } + + static unsigned + st_surface_width_get(struct st_surface *surface) + { + return surface->texture->width[surface->level]; + } + + static unsigned + st_surface_height_get(struct st_surface *surface) + { + return surface->texture->height[surface->level]; + } +%} + /* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */ %rename(read) pipe_buffer_read_; %rename(write) pipe_buffer_write_; diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h index d1bd8c31f4f..a246b6a1f25 100644 --- a/src/gallium/state_trackers/python/st_device.h +++ b/src/gallium/state_trackers/python/st_device.h @@ -38,6 +38,15 @@ struct pipe_context; struct st_winsys; +struct st_surface +{ + struct pipe_texture *texture; + unsigned face; + unsigned level; + unsigned zslice; +}; + + struct st_context { struct st_device *st_dev; @@ -57,6 +66,8 @@ struct st_context { unsigned num_vertex_elements; struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS]; + + struct pipe_framebuffer_state framebuffer; }; @@ -71,6 +82,14 @@ struct st_device { }; +static INLINE struct pipe_surface * +st_pipe_surface(struct st_surface *surface, unsigned usage) +{ + struct pipe_texture *texture = surface->texture; + struct pipe_screen *screen = texture->screen; + return screen->get_tex_surface(screen, texture, surface->face, surface->level, surface->zslice, usage); +} + struct st_context * st_context_create(struct st_device *st_dev); diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index c2ffe9fce1d..70ca16c23dd 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -34,6 +34,7 @@ #include "util/u_math.h" #include "util/u_memory.h" +#include "st_device.h" #include "st_sample.h" @@ -523,10 +524,13 @@ st_sample_pixel_block(enum pipe_format format, void -st_sample_surface(struct pipe_surface *surface, float *rgba) +st_sample_surface(struct st_surface *surface, float *rgba) { - struct pipe_screen *screen = surface->texture->screen; - uint rgba_stride = surface->width * 4; + struct pipe_texture *texture = surface->texture; + struct pipe_screen *screen = texture->screen; + unsigned width = texture->width[surface->level]; + unsigned height = texture->height[surface->level]; + uint rgba_stride = width * 4; struct pipe_transfer *transfer; void *raw; @@ -537,25 +541,25 @@ st_sample_surface(struct pipe_surface *surface, float *rgba) surface->zslice, PIPE_TRANSFER_READ, 0, 0, - surface->width, - surface->height); + width, + height); if (!transfer) return; raw = screen->transfer_map(screen, transfer); if (raw) { - const struct pipe_format_block *block = &transfer->block; + const struct pipe_format_block *block = &texture->block; uint x, y; for (y = 0; y < transfer->nblocksy; ++y) { for (x = 0; x < transfer->nblocksx; ++x) { - st_sample_pixel_block(surface->format, + st_sample_pixel_block(texture->format, block, (uint8_t *) raw + y * transfer->stride + x * block->size, rgba + y * block->height * rgba_stride + x * block->width * 4, rgba_stride, - MIN2(block->width, surface->width - x*block->width), - MIN2(block->height, surface->height - y*block->height)); + MIN2(block->width, width - x*block->width), + MIN2(block->height, height - y*block->height)); } } diff --git a/src/gallium/state_trackers/python/st_sample.h b/src/gallium/state_trackers/python/st_sample.h index ff04a12613f..0a27083549f 100644 --- a/src/gallium/state_trackers/python/st_sample.h +++ b/src/gallium/state_trackers/python/st_sample.h @@ -41,7 +41,7 @@ st_sample_pixel_block(enum pipe_format format, unsigned w, unsigned h); void -st_sample_surface(struct pipe_surface *surface, float *rgba); +st_sample_surface(struct st_surface *surface, float *rgba); #endif /* ST_SAMPLE_H_ */ -- cgit v1.2.3 From 844868048f404ab941cc2e75358b77463ee67482 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 17:08:23 +0100 Subject: python: Set correct transfer mode. --- src/gallium/state_trackers/python/p_texture.i | 2 +- src/gallium/state_trackers/python/st_sample.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 543a0cf33f8..b97d1889737 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -315,7 +315,7 @@ struct st_surface $self->face, $self->level, $self->zslice, - PIPE_TRANSFER_WRITE, + PIPE_TRANSFER_READ, x, y, w, h); if(!transfer) { FREE(rgba2); diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index 70ca16c23dd..53a01891e12 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -539,7 +539,7 @@ st_sample_surface(struct st_surface *surface, float *rgba) surface->face, surface->level, surface->zslice, - PIPE_TRANSFER_READ, + PIPE_TRANSFER_WRITE, 0, 0, width, height); -- cgit v1.2.3 From af25470a5430c68e157489ff095baa5d548d8783 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 17:09:03 +0100 Subject: python: Force unsigned comparison. --- src/gallium/state_trackers/python/p_texture.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index b97d1889737..47bcd4ba3c6 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -84,7 +84,7 @@ { struct st_surface *surface; - if(face >= ($self->target == PIPE_TEXTURE_CUBE ? 6 : 1)) + if(face >= ($self->target == PIPE_TEXTURE_CUBE ? 6U : 1U)) SWIG_exception(SWIG_ValueError, "face out of bounds"); if(level > $self->last_level) SWIG_exception(SWIG_ValueError, "level out of bounds"); -- cgit v1.2.3 From a8251d041ac323712a00d5fed3e51fa5ad7bc987 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 17:51:55 +0100 Subject: python/test: Move the image comparison logic to the base test class. --- src/gallium/state_trackers/python/tests/base.py | 21 ++++++++++++++++++++- src/gallium/state_trackers/python/tests/texture.py | 18 +----------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py index 8477aa5fc9b..2df2af0cdf2 100644 --- a/src/gallium/state_trackers/python/tests/base.py +++ b/src/gallium/state_trackers/python/tests/base.py @@ -33,6 +33,8 @@ Loosely inspired on Python's unittest module. """ +import sys + from gallium import * @@ -115,6 +117,23 @@ class Test: self._run(result) result.summary() + def assert_rgba(self, surface, x, y, w, h, expected_rgba, pixel_tol=4.0/256, surface_tol=0.85): + total = h*w + different = surface.compare_tile_rgba(x, y, w, h, expected_rgba, tol=pixel_tol) + if different: + sys.stderr.write("%u out of %u pixels differ\n" % (different, total)) + + if float(total - different)/float(total) < surface_tol: + if 0: + rgba = FloatArray(h*w*4) + surface.get_tile_rgba(x, y, w, h, rgba) + show_image(w, h, Result=rgba, Expected=expected_rgba) + save_image(w, h, rgba, "result.png") + save_image(w, h, expected_rgba, "expected.png") + #sys.exit(0) + + raise TestFailure + class TestCase(Test): @@ -190,4 +209,4 @@ class TestResult: print "%u tests, %u passed, %u skipped, %u failed" % (self.tests, self.passed, self.skipped, self.failed) for description in self.failed_descriptions: print " %s" % description - \ No newline at end of file + diff --git a/src/gallium/state_trackers/python/tests/texture.py b/src/gallium/state_trackers/python/tests/texture.py index bd95f734fe7..58b7e1c1246 100644 --- a/src/gallium/state_trackers/python/tests/texture.py +++ b/src/gallium/state_trackers/python/tests/texture.py @@ -27,7 +27,6 @@ ########################################################################## -import sys from gallium import * from base import * @@ -291,22 +290,7 @@ class TextureTest(TestCase): cbuf = cbuf_tex.get_surface() - total = h*w - different = cbuf.compare_tile_rgba(x, y, w, h, expected_rgba, tol=4.0/256) - if different: - sys.stderr.write("%u out of %u pixels differ\n" % (different, total)) - - if float(total - different)/float(total) < 0.85: - - if 0: - rgba = FloatArray(h*w*4) - cbuf.get_tile_rgba(x, y, w, h, rgba) - show_image(w, h, Result=rgba, Expected=expected_rgba) - save_image(w, h, rgba, "result.png") - save_image(w, h, expected_rgba, "expected.png") - #sys.exit(0) - - raise TestFailure + self.assert_rgba(cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85) del ctx -- cgit v1.2.3 From 5e815cf26fe4789d92c0fa018e6a20c463e20d32 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 18:18:15 +0100 Subject: python/test: Move the test description logic to the base class. --- src/gallium/state_trackers/python/tests/base.py | 44 +++++++++++++++++++++- src/gallium/state_trackers/python/tests/texture.py | 37 ++++++------------ 2 files changed, 54 insertions(+), 27 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py index 2df2af0cdf2..10964d99568 100644 --- a/src/gallium/state_trackers/python/tests/base.py +++ b/src/gallium/state_trackers/python/tests/base.py @@ -137,14 +137,54 @@ class Test: class TestCase(Test): + tags = () + def __init__(self, dev, **kargs): Test.__init__(self) self.dev = dev self.__dict__.update(kargs) def description(self): - raise NotImplementedError - + descriptions = [] + for tag in self.tags: + try: + method = getattr(self, '_describe_' + tag) + except AttributeError: + description = str(getattr(self, tag, None)) + else: + description = method() + if description is not None: + descriptions.append(tag + '=' + description) + return ' '.join(descriptions) + + def _describe_target(self): + return { + PIPE_TEXTURE_1D: "1d", + PIPE_TEXTURE_2D: "2d", + PIPE_TEXTURE_3D: "3d", + PIPE_TEXTURE_CUBE: "cube", + }[self.target] + + def _describe_format(self): + name = formats[self.format] + if name.startswith('PIPE_FORMAT_'): + name = name[12:] + name = name.lower() + return name + + def _describe_face(self): + if self.target == PIPE_TEXTURE_CUBE: + return { + PIPE_TEX_FACE_POS_X: "+x", + PIPE_TEX_FACE_NEG_X: "-x", + PIPE_TEX_FACE_POS_Y: "+y", + PIPE_TEX_FACE_NEG_Y: "-y", + PIPE_TEX_FACE_POS_Z: "+z", + PIPE_TEX_FACE_NEG_Z: "-z", + }[self.face] + else: + return None + def test(self): raise NotImplementedError diff --git a/src/gallium/state_trackers/python/tests/texture.py b/src/gallium/state_trackers/python/tests/texture.py index 58b7e1c1246..fcb347f9a17 100644 --- a/src/gallium/state_trackers/python/tests/texture.py +++ b/src/gallium/state_trackers/python/tests/texture.py @@ -100,31 +100,18 @@ def is_pot(n): class TextureTest(TestCase): - def description(self): - target = { - PIPE_TEXTURE_1D: "1d", - PIPE_TEXTURE_2D: "2d", - PIPE_TEXTURE_3D: "3d", - PIPE_TEXTURE_CUBE: "cube", - }[self.target] - format = formats[self.format] - if self.target == PIPE_TEXTURE_CUBE: - face = { - PIPE_TEX_FACE_POS_X: "+x", - PIPE_TEX_FACE_NEG_X: "-x", - PIPE_TEX_FACE_POS_Y: "+y", - PIPE_TEX_FACE_NEG_Y: "-y", - PIPE_TEX_FACE_POS_Z: "+z", - PIPE_TEX_FACE_NEG_Z: "-z", - }[self.face] - else: - face = "" - return "%s %s %ux%ux%u last_level=%u face=%s level=%u zslice=%u" % ( - target, format, - self.width, self.height, self.depth, self.last_level, - face, self.level, self.zslice, - ) - + tags = ( + 'target', + 'format', + 'width', + 'height', + 'depth', + 'last_level', + 'face', + 'level', + 'zslice', + ) + def test(self): dev = self.dev -- cgit v1.2.3 From 76d43ed4c98c4e5ad23dd342ecf3ed83b35fdcd7 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 18:26:40 +0100 Subject: python: Don't use deprecated clear_value field. --- src/gallium/state_trackers/python/samples/tri.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index 72e94560af4..ed72e4383bb 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -142,8 +142,7 @@ def test(dev): fb.nr_cbufs = 1 fb.set_cbuf(0, _cbuf) ctx.set_framebuffer(fb) - _cbuf.clear_value = 0x00000000 - ctx.surface_clear(_cbuf, _cbuf.clear_value) + ctx.surface_clear(_cbuf, 0x00000000) del _cbuf # vertex shader -- cgit v1.2.3 From ffaff2736f703523a603f758254b682e6e698ae5 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 18:29:35 +0100 Subject: python: Cleanup. --- src/gallium/state_trackers/python/samples/tri.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index ed72e4383bb..d5e9dcd951a 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -134,16 +134,15 @@ def test(dev): PIPE_FORMAT_X8R8G8B8_UNORM, width, height, tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, - ) - _cbuf = cbuf.get_surface() + ).get_surface() + fb = Framebuffer() fb.width = width fb.height = height fb.nr_cbufs = 1 - fb.set_cbuf(0, _cbuf) + fb.set_cbuf(0, cbuf) ctx.set_framebuffer(fb) - ctx.surface_clear(_cbuf, 0x00000000) - del _cbuf + ctx.surface_clear(cbuf, 0x00000000) # vertex shader vs = Shader(''' @@ -204,8 +203,8 @@ def test(dev): ctx.flush() - show_image(cbuf.get_surface()) - #save_image('tri.png', cbuf.get_surface()) + show_image(cbuf) + #save_image('tri.png', cbuf) -- cgit v1.2.3 From b4de7c4c5fc1a6b103fea1139c7a01f0d6a401ad Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 19:48:30 +0100 Subject: python: Read rgba8 with a single transfer. --- src/gallium/state_trackers/python/p_texture.i | 31 ++++++++++++--------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 47bcd4ba3c6..db7a1358e14 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -225,31 +225,28 @@ struct st_surface if(!*STRING) return; - rgba = malloc(w*4*sizeof(float)); + rgba = malloc(h*w*4*sizeof(float)); if(!rgba) return; rgba8 = (unsigned char *) *STRING; - for(j = 0; j < h; ++j) { - transfer = screen->get_tex_transfer(screen, - $self->texture, - $self->face, - $self->level, - $self->zslice, - PIPE_TRANSFER_READ, - x, y + j, - w, - 1); - if(transfer) { - pipe_get_tile_rgba(transfer, - 0, 0, w, 1, - rgba); + transfer = screen->get_tex_transfer(screen, + $self->texture, + $self->face, + $self->level, + $self->zslice, + PIPE_TRANSFER_READ, + x, y, + w, h); + if(transfer) { + pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba); + for(j = 0; j < h; ++j) { for(i = 0; i < w; ++i) for(k = 0; k <4; ++k) - rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[i*4 + k]); - screen->tex_transfer_destroy(transfer); + rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]); } + screen->tex_transfer_destroy(transfer); } free(rgba); -- cgit v1.2.3 From f24ce499691a342b680e6c3d7aa257480e5d69d9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 19:49:11 +0100 Subject: python: Use depth buffer in the triangle example. --- src/gallium/state_trackers/python/samples/tri.py | 25 +++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index d5e9dcd951a..4c84d121c49 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -68,7 +68,7 @@ def test(dev): width = 255 height = 255 minz = 0.0 - maxz = 0.0 + maxz = 1.0 # disabled blending/masking blend = Blend() @@ -79,8 +79,11 @@ def test(dev): blend.colormask = PIPE_MASK_RGBA ctx.set_blend(blend) - # no-op depth/stencil/alpha + # depth/stencil/alpha depth_stencil_alpha = DepthStencilAlpha() + depth_stencil_alpha.depth.enabled = 1 + depth_stencil_alpha.depth.writemask = 1 + depth_stencil_alpha.depth.func = PIPE_FUNC_LESS ctx.set_depth_stencil_alpha(depth_stencil_alpha) # rasterizer @@ -135,14 +138,20 @@ def test(dev): width, height, tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, ).get_surface() - + zbuf = dev.texture_create( + PIPE_FORMAT_Z32_UNORM, + width, height, + tex_usage=PIPE_TEXTURE_USAGE_DEPTH_STENCIL, + ).get_surface() fb = Framebuffer() fb.width = width fb.height = height fb.nr_cbufs = 1 fb.set_cbuf(0, cbuf) + fb.set_zsbuf(zbuf) ctx.set_framebuffer(fb) ctx.surface_clear(cbuf, 0x00000000) + ctx.surface_clear(zbuf, 0xffffffff) # vertex shader vs = Shader(''' @@ -173,7 +182,7 @@ def test(dev): verts[ 0] = 0.0 # x1 verts[ 1] = 0.8 # y1 - verts[ 2] = 0.0 # z1 + verts[ 2] = 0.2 # z1 verts[ 3] = 1.0 # w1 verts[ 4] = 1.0 # r1 verts[ 5] = 0.0 # g1 @@ -181,7 +190,7 @@ def test(dev): verts[ 7] = 1.0 # a1 verts[ 8] = -0.8 # x2 verts[ 9] = -0.8 # y2 - verts[10] = 0.0 # z2 + verts[10] = 0.5 # z2 verts[11] = 1.0 # w2 verts[12] = 0.0 # r2 verts[13] = 1.0 # g2 @@ -189,7 +198,7 @@ def test(dev): verts[15] = 1.0 # a2 verts[16] = 0.8 # x3 verts[17] = -0.8 # y3 - verts[18] = 0.0 # z3 + verts[18] = 0.8 # z3 verts[19] = 1.0 # w3 verts[20] = 0.0 # r3 verts[21] = 0.0 # g3 @@ -204,7 +213,9 @@ def test(dev): ctx.flush() show_image(cbuf) - #save_image('tri.png', cbuf) + #show_image(zbuf) + #save_image('cbuf.png', cbuf) + #save_image('zbuf.png', zbuf) -- cgit v1.2.3 From 37fb2d9b23eab5dbbb43a212c3475cb8016837d8 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 30 Mar 2009 16:32:11 -0400 Subject: intel: Avoid mapping the texture image for CopyTex{,Sub}Image We don't upload the pixels with the CPU in that case, so the map will only serve as a way of triggering cache flushes over a bunch of data we don't touch. --- src/mesa/drivers/dri/intel/intel_tex_image.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index e902187637d..61ecabfa680 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -482,12 +482,13 @@ intelTexImage(GLcontext * ctx, LOCK_HARDWARE(intel); if (intelImage->mt) { - texImage->Data = intel_miptree_image_map(intel, - intelImage->mt, - intelImage->face, - intelImage->level, - &dstRowStride, - intelImage->base.ImageOffsets); + if (pixels) + texImage->Data = intel_miptree_image_map(intel, + intelImage->mt, + intelImage->face, + intelImage->level, + &dstRowStride, + intelImage->base.ImageOffsets); texImage->RowStride = dstRowStride / intelImage->mt->cpp; } else { @@ -537,17 +538,18 @@ intelTexImage(GLcontext * ctx, format, type, pixels, unpack)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } - } - /* GL_SGIS_generate_mipmap */ - if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - intel_generate_mipmap(ctx, target, texObj); + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + intel_generate_mipmap(ctx, target, texObj); + } } _mesa_unmap_teximage_pbo(ctx, unpack); if (intelImage->mt) { - intel_miptree_image_unmap(intel, intelImage->mt); + if (pixels) + intel_miptree_image_unmap(intel, intelImage->mt); texImage->Data = NULL; } -- cgit v1.2.3 From 458bfe7e8dd429b9dcb980013ac7979689db1367 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 30 Mar 2009 13:55:00 -0700 Subject: r300-gallium: Handful of small leftovers. --- src/gallium/drivers/r300/r300_state_invariant.c | 2 +- src/gallium/drivers/r300/r300_surface.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 3705ff98db5..421f01e62ec 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -86,7 +86,7 @@ void r300_emit_invariant_state(struct r300_context* r300) END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(91 + (caps->has_tcl ? 26 : 0)); + BEGIN_CS(81 + (caps->has_tcl ? 26 : 0)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 96b63986ea7..b2e0cef0b94 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -88,6 +88,7 @@ static void r300_surface_fill(struct pipe_context* pipe, float r, g, b, a, depth; unsigned pixpitch = tex->stride / tex->tex.block.size; + a = (float)((color >> 24) & 0xff) / 255.0f; r = (float)((color >> 16) & 0xff) / 255.0f; g = (float)((color >> 8) & 0xff) / 255.0f; b = (float)((color >> 0) & 0xff) / 255.0f; @@ -158,11 +159,12 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8); OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING | (1 << R300_PRIM_NUM_VERTICES_SHIFT)); + /* Position */ OUT_CS_32F(w / 2.0); OUT_CS_32F(h / 2.0); - /* XXX this should be the depth value to clear to */ OUT_CS_32F(1.0); OUT_CS_32F(1.0); + /* Color */ OUT_CS_32F(r); OUT_CS_32F(g); OUT_CS_32F(b); -- cgit v1.2.3 From 7620b3943b5f9d6ab7156e245aade3bf2a5358a2 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 30 Mar 2009 15:47:00 -0700 Subject: r300-gallium: Fix strange build error. Why didn't this come up before? --- src/gallium/drivers/r300/r300_state_invariant.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/r300/r300_state_invariant.h b/src/gallium/drivers/r300/r300_state_invariant.h index 8204bf9588b..5bea6779fe5 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.h +++ b/src/gallium/drivers/r300/r300_state_invariant.h @@ -23,6 +23,7 @@ #ifndef R300_STATE_INVARIANT_H #define R300_STATE_INVARIANT_H +#include "r300_chipset.h" #include "r300_context.h" #include "r300_cs.h" #include "r300_reg.h" -- cgit v1.2.3 From a56020fe17b3d26ea0ea933dd4e8286e5029996f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 30 Mar 2009 15:50:09 -0700 Subject: r300-gallium: Fix hardlock when no colors or textures are present. --- src/gallium/drivers/r300/r300_state_derived.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index d761a0302f0..0e7a2b6726f 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -211,7 +211,6 @@ static void r300_update_rs_block(struct r300_context* r300) rs->ip[0] |= R500_RS_COL_FMT(R300_RS_COL_FMT_0001); } - /* Set up at least one texture pointer or RS will not be happy. */ if (tex_count == 0) { rs->ip[0] |= R500_RS_SEL_S(R500_RS_IP_PTR_K0) | @@ -220,15 +219,20 @@ static void r300_update_rs_block(struct r300_context* r300) R500_RS_SEL_Q(R500_RS_IP_PTR_K1); } + /* Rasterize at least one color, or bad things happen. */ + if ((col_count == 0) && (tex_count == 0)) { + col_count++; + } + for (i = 0; i < tex_count; i++) { - rs->inst[i] |= R500_RS_INST_TEX_ID(i) | R500_RS_INST_TEX_CN_WRITE | - R500_RS_INST_TEX_ADDR(fp_offset); + rs->inst[i] |= R500_RS_INST_TEX_ID(i) | + R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_offset); fp_offset++; } for (i = 0; i < col_count; i++) { - rs->inst[i] |= R500_RS_INST_COL_ID(i) | R500_RS_INST_COL_CN_WRITE | - R500_RS_INST_COL_ADDR(fp_offset); + rs->inst[i] |= R500_RS_INST_COL_ID(i) | + R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_offset); fp_offset++; } } else { @@ -268,15 +272,20 @@ static void r300_update_rs_block(struct r300_context* r300) R300_RS_SEL_Q(R300_RS_SEL_K1); } + /* Rasterize at least one color, or bad things happen. */ + if ((col_count == 0) && (tex_count == 0)) { + col_count++; + } + for (i = 0; i < tex_count; i++) { - rs->inst[i] |= R300_RS_INST_TEX_ID(i) | R300_RS_INST_TEX_CN_WRITE | - R300_RS_INST_TEX_ADDR(fp_offset); + rs->inst[i] |= R300_RS_INST_TEX_ID(i) | + R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_offset); fp_offset++; } for (i = 0; i < col_count; i++) { - rs->inst[i] |= R300_RS_INST_COL_ID(i) | R300_RS_INST_COL_CN_WRITE | - R300_RS_INST_COL_ADDR(fp_offset); + rs->inst[i] |= R300_RS_INST_COL_ID(i) | + R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_offset); fp_offset++; } } -- cgit v1.2.3 From 4bfe784dcadf5bcb65dbd8b9c3d4db757d1824b8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 30 Mar 2009 16:15:04 -0700 Subject: r300-gallium: Emit the "right" sequence of colors. ARGB, not RGBA. --- src/gallium/drivers/r300/r300_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index b2e0cef0b94..6ecc708e000 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -165,10 +165,10 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS_32F(1.0); OUT_CS_32F(1.0); /* Color */ + OUT_CS_32F(a); OUT_CS_32F(r); OUT_CS_32F(g); OUT_CS_32F(b); - OUT_CS_32F(1.0); /* XXX figure out why this is 0xA and not 0x2 */ OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA); -- cgit v1.2.3 From 70d39c70536079eb51298086c559e4b40e6ffc03 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 30 Mar 2009 16:51:01 -0700 Subject: r300-gallium: Allow surface_fill to clear depth/stencil buffers too. --- src/gallium/drivers/r300/r300_state_inlines.h | 2 ++ src/gallium/drivers/r300/r300_surface.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index b80ff1c1aba..91b93fc367e 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -292,6 +292,7 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format) return R300_COLOR_FORMAT_ARGB4444; /* 32-bit buffers */ case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_Z24S8_UNORM: return R300_COLOR_FORMAT_ARGB8888; /* XXX Not in pipe_format case PIPE_FORMAT_A32R32G32B32: @@ -337,6 +338,7 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format) { switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_Z24S8_UNORM: return R300_US_OUT_FMT_C4_8 | R300_C0_SEL_B | R300_C1_SEL_G | R300_C2_SEL_R | R300_C3_SEL_A; diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 6ecc708e000..7e6036868a9 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -97,7 +97,7 @@ static void r300_surface_fill(struct pipe_context* pipe, dest, x, y, w, h, pixpitch, color); /* Fallback? */ - if (tex->tex.format != PIPE_FORMAT_A8R8G8B8_UNORM) { + if (FALSE) { debug_printf("r300: Falling back on surface clear..."); util_surface_fill(pipe, dest, x, y, w, h, color); return; -- cgit v1.2.3 From 70de577b14e9b0efab7a749203d50dc19540472d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 30 Mar 2009 16:58:20 -0700 Subject: r300-gallium: Properly redo shaders when constant buffer changes size. --- src/gallium/drivers/r300/r300_state.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 8c38f7c706e..c9a20c9e8ac 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -132,6 +132,7 @@ static void const struct pipe_constant_buffer* buffer) { struct r300_context* r300 = r300_context(pipe); + int i = r300->shader_constants[shader].user_count; /* This entire chunk of code seems ever-so-slightly baked. * It's as if I've got pipe_buffer* matryoshkas... */ @@ -149,6 +150,12 @@ static void } r300->dirty_state |= R300_NEW_CONSTANTS; + + /* If the number of constants have changed, invalidate the shader. */ + if (r300->shader_constants[shader].user_count != i) { + r300->fs->translated = FALSE; + r300_translate_fragment_shader(r300, r300->fs); + } } /* Create a new depth, stencil, and alpha state based on the CSO dsa state. -- cgit v1.2.3 From aafbbf77441dedf6015a4ab61cc7a82ef592415f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 30 Mar 2009 17:20:12 -0700 Subject: r300-gallium: r500-fs: If recompiling a shader, overwrite old insts. --- src/gallium/drivers/r300/r300_state_shader.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index ed9d26f0b9b..5dc7266f9b1 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -582,6 +582,11 @@ void r300_translate_fragment_shader(struct r300_context* r300, /* Setup starting offset for immediates. */ assembler->imm_offset = consts->user_count; + /* 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)) { -- cgit v1.2.3 From 3eeeaf04e31b8aed831f29d8a192f3f9a0a8ef03 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 30 Mar 2009 17:31:58 -0700 Subject: r300-gallium: RGBA, not ARGB, after all. Clearly, something else is wrong. --- src/gallium/drivers/r300/r300_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 7e6036868a9..9c4f3065a7f 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -165,10 +165,10 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS_32F(1.0); OUT_CS_32F(1.0); /* Color */ - OUT_CS_32F(a); OUT_CS_32F(r); OUT_CS_32F(g); OUT_CS_32F(b); + OUT_CS_32F(a); /* XXX figure out why this is 0xA and not 0x2 */ OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA); -- cgit v1.2.3 From 4d89eff0b6fd6902a2fccb87c474d6a8f6d61526 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 31 Mar 2009 03:18:35 +0200 Subject: fix ugly copy/paste error in mipmap generation code --- src/mesa/main/mipmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 7001211a131..bc8658beffe 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -195,7 +195,7 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, } } - if (datatype == GL_BYTE && comps == 4) { + else if (datatype == GL_BYTE && comps == 4) { GLuint i, j, k; const GLbyte(*rowA)[4] = (const GLbyte(*)[4]) srcRowA; const GLbyte(*rowB)[4] = (const GLbyte(*)[4]) srcRowB; -- cgit v1.2.3 From 382306c5732dd04f514bb1d8f2b050bd6d58a893 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 09:46:55 +0100 Subject: gallium: Move pf_is_depth_stencil to p_format.h. --- src/gallium/include/pipe/p_format.h | 7 +++++++ src/mesa/state_tracker/st_texture.h | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 3f65a604364..a279eefef9e 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -536,6 +536,13 @@ pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned h return pf_get_nblocksx(block, width)*pf_get_nblocksy(block, height); } +static INLINE boolean +pf_is_depth_stencil( enum pipe_format format ) +{ + return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) + + pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0; +} + static INLINE boolean pf_is_compressed( enum pipe_format format ) { diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index 840b7e27cc0..28c2f580f68 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -99,12 +99,6 @@ st_get_stobj_texture(struct st_texture_object *stObj) return stObj ? stObj->pt : NULL; } -static INLINE GLboolean pf_is_depth_stencil( enum pipe_format format ) -{ - return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) + - pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0; -} - extern struct pipe_texture * st_texture_create(struct st_context *st, -- cgit v1.2.3 From e848a86dbacbec0bed16fac29264c77f4c2eeb0c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 10:57:44 +0100 Subject: python: Add nblocksx/y members to surfaces. --- src/gallium/state_trackers/python/p_texture.i | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index db7a1358e14..7c1f1c361a4 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -126,6 +126,8 @@ struct st_surface unsigned format; unsigned width; unsigned height; + unsigned nblocksx; + unsigned nblocksy; ~st_surface() { pipe_texture_reference(&$self->texture, NULL); @@ -360,6 +362,18 @@ struct st_surface { return surface->texture->height[surface->level]; } + + static unsigned + st_surface_nblocksx_get(struct st_surface *surface) + { + return surface->texture->nblocksx[surface->level]; + } + + static unsigned + st_surface_nblocksy_get(struct st_surface *surface) + { + return surface->texture->nblocksy[surface->level]; + } %} /* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */ -- cgit v1.2.3 From b4b4986f1f0be2f5d0f70fcca25f29c5637e4d92 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 10:58:18 +0100 Subject: python: Make get/put_tile_raw more user friendlier. --- src/gallium/state_trackers/python/p_texture.i | 43 ++++++++++++++++++++------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 7c1f1c361a4..276fa795cce 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -134,11 +134,20 @@ struct st_surface FREE($self); } - void - get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char *raw, unsigned stride) + %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1)); + void get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH) { - struct pipe_screen *screen = $self->texture->screen; + struct pipe_texture *texture = $self->texture; + struct pipe_screen *screen = texture->screen; struct pipe_transfer *transfer; + unsigned stride; + + stride = pf_get_nblocksx(&texture->block, w) * texture->block.size; + *LENGTH = pf_get_nblocksy(&texture->block, h) * stride; + *STRING = (char *) malloc(*LENGTH); + if(!*STRING) + return; + transfer = screen->get_tex_transfer(screen, $self->texture, $self->face, @@ -147,16 +156,24 @@ struct st_surface PIPE_TRANSFER_READ, x, y, w, h); if(transfer) { - pipe_get_tile_raw(transfer, 0, 0, w, h, raw, stride); + pipe_get_tile_raw(transfer, 0, 0, w, h, *STRING, stride); screen->tex_transfer_destroy(transfer); } } - void - put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *raw, unsigned stride) + %cstring_input_binary(const char *STRING, unsigned LENGTH); + void put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *STRING, unsigned LENGTH, unsigned stride = 0) { - struct pipe_screen *screen = $self->texture->screen; + struct pipe_texture *texture = $self->texture; + struct pipe_screen *screen = texture->screen; struct pipe_transfer *transfer; + + if(stride == 0) + stride = pf_get_nblocksx(&texture->block, w) * texture->block.size; + + if(LENGTH < pf_get_nblocksy(&texture->block, h) * stride) + SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size"); + transfer = screen->get_tex_transfer(screen, $self->texture, $self->face, @@ -164,10 +181,14 @@ struct st_surface $self->zslice, PIPE_TRANSFER_WRITE, x, y, w, h); - if(transfer) { - pipe_put_tile_raw(transfer, 0, 0, w, h, raw, stride); - screen->tex_transfer_destroy(transfer); - } + if(!transfer) + SWIG_exception(SWIG_MemoryError, "couldn't initiate transfer"); + + pipe_put_tile_raw(transfer, 0, 0, w, h, STRING, stride); + screen->tex_transfer_destroy(transfer); + + fail: + return; } void -- cgit v1.2.3 From 7d5d5a6cb7021b580cbdfd1e4b5f215fa13aa8c5 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 11:00:18 +0100 Subject: python/test: More descriptive test name. --- src/gallium/state_trackers/python/tests/texture.py | 350 --------------------- .../state_trackers/python/tests/texture_sample.py | 350 +++++++++++++++++++++ 2 files changed, 350 insertions(+), 350 deletions(-) delete mode 100644 src/gallium/state_trackers/python/tests/texture.py create mode 100644 src/gallium/state_trackers/python/tests/texture_sample.py diff --git a/src/gallium/state_trackers/python/tests/texture.py b/src/gallium/state_trackers/python/tests/texture.py deleted file mode 100644 index fcb347f9a17..00000000000 --- a/src/gallium/state_trackers/python/tests/texture.py +++ /dev/null @@ -1,350 +0,0 @@ -#!/usr/bin/env python -########################################################################## -# -# 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. -# -########################################################################## - - -from gallium import * -from base import * - - -def lods(*dims): - size = max(dims) - lods = 0 - while size: - lods += 1 - size >>= 1 - return lods - - -def minify(dims, level = 1): - return [max(dim>>level, 1) for dim in dims] - - -def tex_coords(texture, face, level, zslice): - st = [ - [0.0, 0.0], - [1.0, 0.0], - [1.0, 1.0], - [0.0, 1.0], - ] - - if texture.target == PIPE_TEXTURE_2D: - return [[s, t, 0.0] for s, t in st] - elif texture.target == PIPE_TEXTURE_3D: - depth = texture.get_depth(level) - if depth > 1: - r = float(zslice)/float(depth - 1) - else: - r = 0.0 - return [[s, t, r] for s, t in st] - elif texture.target == PIPE_TEXTURE_CUBE: - result = [] - for s, t in st: - # See http://developer.nvidia.com/object/cube_map_ogl_tutorial.html - sc = 2.0*s - 1.0 - tc = 2.0*t - 1.0 - if face == PIPE_TEX_FACE_POS_X: - rx = 1.0 - ry = -tc - rz = -sc - if face == PIPE_TEX_FACE_NEG_X: - rx = -1.0 - ry = -tc - rz = sc - if face == PIPE_TEX_FACE_POS_Y: - rx = sc - ry = 1.0 - rz = tc - if face == PIPE_TEX_FACE_NEG_Y: - rx = sc - ry = -1.0 - rz = -tc - if face == PIPE_TEX_FACE_POS_Z: - rx = sc - ry = -tc - rz = 1.0 - if face == PIPE_TEX_FACE_NEG_Z: - rx = -sc - ry = -tc - rz = -1.0 - result.append([rx, ry, rz]) - return result - -def is_pot(n): - return n & (n - 1) == 0 - - -class TextureTest(TestCase): - - tags = ( - 'target', - 'format', - 'width', - 'height', - 'depth', - 'last_level', - 'face', - 'level', - 'zslice', - ) - - def test(self): - dev = self.dev - - target = self.target - format = self.format - width = self.width - height = self.height - depth = self.depth - last_level = self.last_level - face = self.face - level = self.level - zslice = self.zslice - - tex_usage = PIPE_TEXTURE_USAGE_SAMPLER - geom_flags = 0 - if width != height: - geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE - if not is_pot(width) or not is_pot(height) or not is_pot(depth): - geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO - - if not dev.is_format_supported(format, target, tex_usage, geom_flags): - raise TestSkip - - ctx = self.dev.context_create() - - # disabled blending/masking - blend = 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 - ctx.set_blend(blend) - - # no-op depth/stencil/alpha - depth_stencil_alpha = DepthStencilAlpha() - ctx.set_depth_stencil_alpha(depth_stencil_alpha) - - # rasterizer - rasterizer = Rasterizer() - rasterizer.front_winding = PIPE_WINDING_CW - rasterizer.cull_mode = PIPE_WINDING_NONE - rasterizer.bypass_vs_clip_and_viewport = 1 - ctx.set_rasterizer(rasterizer) - - # samplers - sampler = 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_NEAREST - sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST - sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST - sampler.normalized_coords = 1 - sampler.min_lod = 0 - sampler.max_lod = PIPE_MAX_TEXTURE_LEVELS - 1 - ctx.set_sampler(0, sampler) - - # texture - texture = dev.texture_create( - target = target, - format = format, - width = width, - height = height, - depth = depth, - last_level = last_level, - tex_usage = tex_usage, - ) - - expected_rgba = FloatArray(height*width*4) - texture.get_surface( - face = face, - level = level, - zslice = zslice, - ).sample_rgba(expected_rgba) - - ctx.set_sampler_texture(0, texture) - - # framebuffer - cbuf_tex = dev.texture_create( - PIPE_FORMAT_A8R8G8B8_UNORM, - width, - height, - tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET, - ) - - cbuf = cbuf_tex.get_surface() - fb = Framebuffer() - fb.width = width - fb.height = height - fb.nr_cbufs = 1 - fb.set_cbuf(0, cbuf) - ctx.set_framebuffer(fb) - ctx.surface_clear(cbuf, 0x00000000) - del fb - - # vertex shader - vs = Shader(''' - VERT1.1 - DCL IN[0], POSITION, CONSTANT - DCL IN[1], GENERIC, CONSTANT - DCL OUT[0], POSITION, CONSTANT - DCL OUT[1], GENERIC, CONSTANT - 0:MOV OUT[0], IN[0] - 1:MOV OUT[1], IN[1] - 2:END - ''') - #vs.dump() - ctx.set_vertex_shader(vs) - - # fragment shader - op = { - PIPE_TEXTURE_1D: "1D", - PIPE_TEXTURE_2D: "2D", - PIPE_TEXTURE_3D: "3D", - PIPE_TEXTURE_CUBE: "CUBE", - }[target] - fs = Shader(''' - FRAG1.1 - DCL IN[0], GENERIC[0], LINEAR - DCL OUT[0], COLOR, CONSTANT - DCL SAMP[0], CONSTANT - 0:TEX OUT[0], IN[0], SAMP[0], %s - 1:END - ''' % op) - #fs.dump() - ctx.set_fragment_shader(fs) - - nverts = 4 - nattrs = 2 - verts = FloatArray(nverts * nattrs * 4) - - x = 0 - y = 0 - w, h = minify((width, height), level) - - pos = [ - [x, y], - [x+w, y], - [x+w, y+h], - [x, y+h], - ] - - tex = tex_coords(texture, face, level, zslice) - - for i in range(0, 4): - j = 8*i - verts[j + 0] = pos[i][0] # x - verts[j + 1] = pos[i][1] # y - verts[j + 2] = 0.0 # z - verts[j + 3] = 1.0 # w - verts[j + 4] = tex[i][0] # s - verts[j + 5] = tex[i][1] # r - verts[j + 6] = tex[i][2] # q - verts[j + 7] = 1.0 - - ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN, - nverts, - nattrs, - verts) - - ctx.flush() - - cbuf = cbuf_tex.get_surface() - - self.assert_rgba(cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85) - - del ctx - - - -def main(): - dev = Device() - suite = TestSuite() - - targets = [] - targets += [PIPE_TEXTURE_2D] - targets += [PIPE_TEXTURE_CUBE] - targets += [PIPE_TEXTURE_3D] - - formats = [] - formats += [PIPE_FORMAT_A8R8G8B8_UNORM] - formats += [PIPE_FORMAT_R5G6B5_UNORM] - formats += [PIPE_FORMAT_L8_UNORM] - formats += [PIPE_FORMAT_YCBCR] - formats += [PIPE_FORMAT_DXT1_RGB] - - sizes = [64, 32, 16, 8, 4, 2, 1] - #sizes = [1020, 508, 252, 62, 30, 14, 6, 3] - #sizes = [64] - #sizes = [63] - - for target in targets: - for format in formats: - for size in sizes: - if target == PIPE_TEXTURE_CUBE: - faces = [ - PIPE_TEX_FACE_POS_X, - PIPE_TEX_FACE_NEG_X, - PIPE_TEX_FACE_POS_Y, - PIPE_TEX_FACE_NEG_Y, - PIPE_TEX_FACE_POS_Z, - PIPE_TEX_FACE_NEG_Z, - ] - #faces = [PIPE_TEX_FACE_NEG_X] - else: - faces = [0] - if target == PIPE_TEXTURE_3D: - depth = size - else: - depth = 1 - for face in faces: - levels = lods(size) - for last_level in range(levels): - for level in range(0, last_level + 1): - zslice = 0 - while zslice < depth >> level: - test = TextureTest( - 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) - zslice = (zslice + 1)*2 - 1 - suite.run() - - -if __name__ == '__main__': - main() diff --git a/src/gallium/state_trackers/python/tests/texture_sample.py b/src/gallium/state_trackers/python/tests/texture_sample.py new file mode 100644 index 00000000000..fcb347f9a17 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/texture_sample.py @@ -0,0 +1,350 @@ +#!/usr/bin/env python +########################################################################## +# +# 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. +# +########################################################################## + + +from gallium import * +from base import * + + +def lods(*dims): + size = max(dims) + lods = 0 + while size: + lods += 1 + size >>= 1 + return lods + + +def minify(dims, level = 1): + return [max(dim>>level, 1) for dim in dims] + + +def tex_coords(texture, face, level, zslice): + st = [ + [0.0, 0.0], + [1.0, 0.0], + [1.0, 1.0], + [0.0, 1.0], + ] + + if texture.target == PIPE_TEXTURE_2D: + return [[s, t, 0.0] for s, t in st] + elif texture.target == PIPE_TEXTURE_3D: + depth = texture.get_depth(level) + if depth > 1: + r = float(zslice)/float(depth - 1) + else: + r = 0.0 + return [[s, t, r] for s, t in st] + elif texture.target == PIPE_TEXTURE_CUBE: + result = [] + for s, t in st: + # See http://developer.nvidia.com/object/cube_map_ogl_tutorial.html + sc = 2.0*s - 1.0 + tc = 2.0*t - 1.0 + if face == PIPE_TEX_FACE_POS_X: + rx = 1.0 + ry = -tc + rz = -sc + if face == PIPE_TEX_FACE_NEG_X: + rx = -1.0 + ry = -tc + rz = sc + if face == PIPE_TEX_FACE_POS_Y: + rx = sc + ry = 1.0 + rz = tc + if face == PIPE_TEX_FACE_NEG_Y: + rx = sc + ry = -1.0 + rz = -tc + if face == PIPE_TEX_FACE_POS_Z: + rx = sc + ry = -tc + rz = 1.0 + if face == PIPE_TEX_FACE_NEG_Z: + rx = -sc + ry = -tc + rz = -1.0 + result.append([rx, ry, rz]) + return result + +def is_pot(n): + return n & (n - 1) == 0 + + +class TextureTest(TestCase): + + tags = ( + 'target', + 'format', + 'width', + 'height', + 'depth', + 'last_level', + 'face', + 'level', + 'zslice', + ) + + def test(self): + dev = self.dev + + target = self.target + format = self.format + width = self.width + height = self.height + depth = self.depth + last_level = self.last_level + face = self.face + level = self.level + zslice = self.zslice + + tex_usage = PIPE_TEXTURE_USAGE_SAMPLER + geom_flags = 0 + if width != height: + geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE + if not is_pot(width) or not is_pot(height) or not is_pot(depth): + geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO + + if not dev.is_format_supported(format, target, tex_usage, geom_flags): + raise TestSkip + + ctx = self.dev.context_create() + + # disabled blending/masking + blend = 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 + ctx.set_blend(blend) + + # no-op depth/stencil/alpha + depth_stencil_alpha = DepthStencilAlpha() + ctx.set_depth_stencil_alpha(depth_stencil_alpha) + + # rasterizer + rasterizer = Rasterizer() + rasterizer.front_winding = PIPE_WINDING_CW + rasterizer.cull_mode = PIPE_WINDING_NONE + rasterizer.bypass_vs_clip_and_viewport = 1 + ctx.set_rasterizer(rasterizer) + + # samplers + sampler = 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_NEAREST + sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST + sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST + sampler.normalized_coords = 1 + sampler.min_lod = 0 + sampler.max_lod = PIPE_MAX_TEXTURE_LEVELS - 1 + ctx.set_sampler(0, sampler) + + # texture + texture = dev.texture_create( + target = target, + format = format, + width = width, + height = height, + depth = depth, + last_level = last_level, + tex_usage = tex_usage, + ) + + expected_rgba = FloatArray(height*width*4) + texture.get_surface( + face = face, + level = level, + zslice = zslice, + ).sample_rgba(expected_rgba) + + ctx.set_sampler_texture(0, texture) + + # framebuffer + cbuf_tex = dev.texture_create( + PIPE_FORMAT_A8R8G8B8_UNORM, + width, + height, + tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET, + ) + + cbuf = cbuf_tex.get_surface() + fb = Framebuffer() + fb.width = width + fb.height = height + fb.nr_cbufs = 1 + fb.set_cbuf(0, cbuf) + ctx.set_framebuffer(fb) + ctx.surface_clear(cbuf, 0x00000000) + del fb + + # vertex shader + vs = Shader(''' + VERT1.1 + DCL IN[0], POSITION, CONSTANT + DCL IN[1], GENERIC, CONSTANT + DCL OUT[0], POSITION, CONSTANT + DCL OUT[1], GENERIC, CONSTANT + 0:MOV OUT[0], IN[0] + 1:MOV OUT[1], IN[1] + 2:END + ''') + #vs.dump() + ctx.set_vertex_shader(vs) + + # fragment shader + op = { + PIPE_TEXTURE_1D: "1D", + PIPE_TEXTURE_2D: "2D", + PIPE_TEXTURE_3D: "3D", + PIPE_TEXTURE_CUBE: "CUBE", + }[target] + fs = Shader(''' + FRAG1.1 + DCL IN[0], GENERIC[0], LINEAR + DCL OUT[0], COLOR, CONSTANT + DCL SAMP[0], CONSTANT + 0:TEX OUT[0], IN[0], SAMP[0], %s + 1:END + ''' % op) + #fs.dump() + ctx.set_fragment_shader(fs) + + nverts = 4 + nattrs = 2 + verts = FloatArray(nverts * nattrs * 4) + + x = 0 + y = 0 + w, h = minify((width, height), level) + + pos = [ + [x, y], + [x+w, y], + [x+w, y+h], + [x, y+h], + ] + + tex = tex_coords(texture, face, level, zslice) + + for i in range(0, 4): + j = 8*i + verts[j + 0] = pos[i][0] # x + verts[j + 1] = pos[i][1] # y + verts[j + 2] = 0.0 # z + verts[j + 3] = 1.0 # w + verts[j + 4] = tex[i][0] # s + verts[j + 5] = tex[i][1] # r + verts[j + 6] = tex[i][2] # q + verts[j + 7] = 1.0 + + ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN, + nverts, + nattrs, + verts) + + ctx.flush() + + cbuf = cbuf_tex.get_surface() + + self.assert_rgba(cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85) + + del ctx + + + +def main(): + dev = Device() + suite = TestSuite() + + targets = [] + targets += [PIPE_TEXTURE_2D] + targets += [PIPE_TEXTURE_CUBE] + targets += [PIPE_TEXTURE_3D] + + formats = [] + formats += [PIPE_FORMAT_A8R8G8B8_UNORM] + formats += [PIPE_FORMAT_R5G6B5_UNORM] + formats += [PIPE_FORMAT_L8_UNORM] + formats += [PIPE_FORMAT_YCBCR] + formats += [PIPE_FORMAT_DXT1_RGB] + + sizes = [64, 32, 16, 8, 4, 2, 1] + #sizes = [1020, 508, 252, 62, 30, 14, 6, 3] + #sizes = [64] + #sizes = [63] + + for target in targets: + for format in formats: + for size in sizes: + if target == PIPE_TEXTURE_CUBE: + faces = [ + PIPE_TEX_FACE_POS_X, + PIPE_TEX_FACE_NEG_X, + PIPE_TEX_FACE_POS_Y, + PIPE_TEX_FACE_NEG_Y, + PIPE_TEX_FACE_POS_Z, + PIPE_TEX_FACE_NEG_Z, + ] + #faces = [PIPE_TEX_FACE_NEG_X] + else: + faces = [0] + if target == PIPE_TEXTURE_3D: + depth = size + else: + depth = 1 + for face in faces: + levels = lods(size) + for last_level in range(levels): + for level in range(0, last_level + 1): + zslice = 0 + while zslice < depth >> level: + test = TextureTest( + 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) + zslice = (zslice + 1)*2 - 1 + suite.run() + + +if __name__ == '__main__': + main() -- cgit v1.2.3 From 6dd0a5f3d69bc84d4a57123dc890365f59b4a3aa Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 11:02:15 +0100 Subject: python/test: New test for texture transfers. --- .../python/tests/texture_transfer.py | 179 +++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/texture_transfer.py diff --git a/src/gallium/state_trackers/python/tests/texture_transfer.py b/src/gallium/state_trackers/python/tests/texture_transfer.py new file mode 100644 index 00000000000..e65b425adf4 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/texture_transfer.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python +########################################################################## +# +# 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 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. +# +########################################################################## + + +import os + +from gallium import * +from base import * + + +def lods(*dims): + size = max(dims) + lods = 0 + while size: + lods += 1 + size >>= 1 + return lods + + +class TextureTest(TestCase): + + tags = ( + 'target', + 'format', + 'width', + 'height', + 'depth', + 'last_level', + 'face', + 'level', + 'zslice', + ) + + def test(self): + dev = self.dev + + target = self.target + format = self.format + width = self.width + height = self.height + depth = self.depth + last_level = self.last_level + face = self.face + level = self.level + zslice = self.zslice + + tex_usage = 0 + + texture = dev.texture_create( + target = target, + format = format, + width = width, + height = height, + depth = depth, + last_level = last_level, + tex_usage = tex_usage, + ) + if texture is None: + raise TestSkip + + surface = texture.get_surface(face, level, zslice) + + stride = surface.nblocksx * texture.block.size + size = surface.nblocksy * stride + + in_raw = os.urandom(size) + + surface.put_tile_raw(0, 0, surface.width, surface.height, in_raw, stride) + + out_raw = surface.get_tile_raw(0, 0, surface.width, surface.height) + + if in_raw != out_raw: + raise TestFailure + + +def main(): + dev = Device() + suite = TestSuite() + + targets = [ + PIPE_TEXTURE_2D, + PIPE_TEXTURE_CUBE, + PIPE_TEXTURE_3D, + ] + + 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_S8_UNORM, + PIPE_FORMAT_A8_UNORM, + PIPE_FORMAT_L8_UNORM, + PIPE_FORMAT_DXT1_RGB, + PIPE_FORMAT_DXT1_RGBA, + PIPE_FORMAT_DXT3_RGBA, + PIPE_FORMAT_DXT5_RGBA, + ] + + sizes = [64, 32, 16, 8, 4, 2, 1] + #sizes = [1020, 508, 252, 62, 30, 14, 6, 3] + #sizes = [64] + #sizes = [63] + + faces = [ + PIPE_TEX_FACE_POS_X, + PIPE_TEX_FACE_NEG_X, + PIPE_TEX_FACE_POS_Y, + PIPE_TEX_FACE_NEG_Y, + PIPE_TEX_FACE_POS_Z, + PIPE_TEX_FACE_NEG_Z, + ] + + for target in targets: + for format in formats: + for size in sizes: + if target == PIPE_TEXTURE_3D: + depth = size + else: + depth = 1 + for face in faces: + if target != PIPE_TEXTURE_CUBE and face: + continue + levels = lods(size) + for last_level in range(levels): + for level in range(0, last_level + 1): + zslice = 0 + while zslice < depth >> level: + test = TextureTest( + 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) + zslice = (zslice + 1)*2 - 1 + suite.run() + + +if __name__ == '__main__': + main() -- cgit v1.2.3 From 10b808156bff157d401b5b999a215d16715a1018 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 16:38:03 +0100 Subject: python/test: Dump a classification tree of the results when finished testing. --- src/gallium/state_trackers/python/tests/base.py | 97 +++++++++++++++++++++---- src/gallium/state_trackers/python/tests/tree.py | 21 ++++++ 2 files changed, 102 insertions(+), 16 deletions(-) create mode 100644 src/gallium/state_trackers/python/tests/tree.py diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py index 10964d99568..b338f44a252 100644 --- a/src/gallium/state_trackers/python/tests/base.py +++ b/src/gallium/state_trackers/python/tests/base.py @@ -1,6 +1,7 @@ #!/usr/bin/env python ########################################################################## # +# Copyright 2009 VMware, Inc. # Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. # All Rights Reserved. # @@ -19,7 +20,7 @@ # THE SOFTWARE IS PROVIDED "AS 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 +# 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. @@ -33,6 +34,7 @@ Loosely inspired on Python's unittest module. """ +import os.path import sys from gallium import * @@ -147,16 +149,19 @@ class TestCase(Test): def description(self): descriptions = [] for tag in self.tags: - try: - method = getattr(self, '_describe_' + tag) - except AttributeError: - description = str(getattr(self, tag, None)) - else: - description = method() + description = self.describe(tag) if description is not None: descriptions.append(tag + '=' + description) return ' '.join(descriptions) + def describe(self, tag): + try: + method = getattr(self, '_describe_' + tag) + except AttributeError: + return str(getattr(self, tag, None)) + else: + return method() + def _describe_target(self): return { PIPE_TEXTURE_1D: "1d", @@ -226,27 +231,87 @@ class TestResult: self.passed = 0 self.skipped = 0 self.failed = 0 - self.failed_descriptions = [] + + self.names = ['result'] + self.types = ['pass skip fail'] + self.rows = [] def test_start(self, test): - self.tests += 1 print "Running %s..." % test.description() + self.tests += 1 def test_passed(self, test): - self.passed += 1 print "PASS" + self.passed += 1 + self.log_result(test, 'pass') def test_skipped(self, test): - self.skipped += 1 print "SKIP" + self.skipped += 1 + #self.log_result(test, 'skip') def test_failed(self, test): - self.failed += 1 - self.failed_descriptions.append(test.description()) print "FAIL" + self.failed += 1 + self.log_result(test, 'fail') + + def log_result(self, test, result): + row = [None]*len(self.names) + + # add result + assert self.names[0] == 'result' + assert result in ('pass', 'skip', 'fail') + row[0] = result + + # add tags + for tag in test.tags: + value = test.describe(tag) + if value is None: + value = '' + else: + value = str(value) + try: + col = self.names.index(tag, 1) + except ValueError: + self.names.append(tag) + self.types.append('d') + row.append(value) + else: + row[col] = value + + self.rows.append(row) def summary(self): print "%u tests, %u passed, %u skipped, %u failed" % (self.tests, self.passed, self.skipped, self.failed) - for description in self.failed_descriptions: - print " %s" % description - + + name, ext = os.path.splitext(os.path.basename(sys.argv[0])) + filename = name + '.tsv' + stream = file(filename, 'wt') + + # header + stream.write('\t'.join(self.names) + '\n') + stream.write('\t'.join(self.types) + '\n') + stream.write('class\n') + + # rows + for row in self.rows: + row += [None]*(len(self.names) - len(row)) + stream.write('\t'.join(row) + '\n') + + stream.close() + + # See http://www.ailab.si/orange/doc/ofb/c_otherclass.htm + try: + import orange + import orngTree + except ImportError: + sys.stderr.write('Install Orange from http://www.ailab.si/orange/ for a classification tree.\n') + return + + data = orange.ExampleTable(filename) + + tree = orngTree.TreeLearner(data, sameMajorityPruning=1, mForPruning=2) + + orngTree.printTxt(tree) + + orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box') diff --git a/src/gallium/state_trackers/python/tests/tree.py b/src/gallium/state_trackers/python/tests/tree.py new file mode 100644 index 00000000000..14b3599c6d7 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/tree.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# +# See also: +# http://www.ailab.si/orange/doc/ofb/c_otherclass.htm + +import os.path +import sys + +import orange +import orngTree + +for arg in sys.argv[1:]: + name, ext = os.path.splitext(arg) + + data = orange.ExampleTable(arg) + + tree = orngTree.TreeLearner(data, sameMajorityPruning=1, mForPruning=2) + + orngTree.printTxt(tree) + + orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box') -- cgit v1.2.3 From bdfc411b449b3eafec8fb803fba42fce58a49c32 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 16:39:11 +0100 Subject: python/test: Flush stdout to keep in sync with debug info on stderr. --- src/gallium/state_trackers/python/tests/base.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py index b338f44a252..401095fa908 100644 --- a/src/gallium/state_trackers/python/tests/base.py +++ b/src/gallium/state_trackers/python/tests/base.py @@ -237,21 +237,25 @@ class TestResult: self.rows = [] def test_start(self, test): - print "Running %s..." % test.description() + sys.stdout.write("Running %s...\n" % test.description()) + sys.stdout.flush() self.tests += 1 def test_passed(self, test): - print "PASS" + sys.stdout.write("PASS\n") + sys.stdout.flush() self.passed += 1 self.log_result(test, 'pass') def test_skipped(self, test): - print "SKIP" + sys.stdout.write("SKIP\n") + sys.stdout.flush() self.skipped += 1 #self.log_result(test, 'skip') def test_failed(self, test): - print "FAIL" + sys.stdout.write("FAIL\n") + sys.stdout.flush() self.failed += 1 self.log_result(test, 'fail') @@ -282,7 +286,8 @@ class TestResult: self.rows.append(row) def summary(self): - print "%u tests, %u passed, %u skipped, %u failed" % (self.tests, self.passed, self.skipped, self.failed) + sys.stdout.write("%u tests, %u passed, %u skipped, %u failed\n\n" % (self.tests, self.passed, self.skipped, self.failed)) + sys.stdout.flush() name, ext = os.path.splitext(os.path.basename(sys.argv[0])) filename = name + '.tsv' -- cgit v1.2.3 From 65554af5c3ea172891428382c13dc2318bf4b60d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 17:21:52 +0100 Subject: python/test: Infer type (continuous/discrete) from object type. --- src/gallium/state_trackers/python/tests/base.py | 42 ++++++++++++++++--------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py index 401095fa908..585fbba1272 100644 --- a/src/gallium/state_trackers/python/tests/base.py +++ b/src/gallium/state_trackers/python/tests/base.py @@ -149,20 +149,20 @@ class TestCase(Test): def description(self): descriptions = [] for tag in self.tags: - description = self.describe(tag) - if description is not None: - descriptions.append(tag + '=' + description) + value = self.get(tag) + if value is not None and value != '': + descriptions.append(tag + '=' + str(value)) return ' '.join(descriptions) - def describe(self, tag): + def get(self, tag): try: - method = getattr(self, '_describe_' + tag) + method = getattr(self, '_get_' + tag) except AttributeError: - return str(getattr(self, tag, None)) + return getattr(self, tag, None) else: return method() - def _describe_target(self): + def _get_target(self): return { PIPE_TEXTURE_1D: "1d", PIPE_TEXTURE_2D: "2d", @@ -170,14 +170,14 @@ class TestCase(Test): PIPE_TEXTURE_CUBE: "cube", }[self.target] - def _describe_format(self): + def _get_format(self): name = formats[self.format] if name.startswith('PIPE_FORMAT_'): name = name[12:] name = name.lower() return name - def _describe_face(self): + def _get_face(self): if self.target == PIPE_TEXTURE_CUBE: return { PIPE_TEX_FACE_POS_X: "+x", @@ -188,7 +188,7 @@ class TestCase(Test): PIPE_TEX_FACE_NEG_Z: "-z", }[self.face] else: - return None + return '' def test(self): raise NotImplementedError @@ -260,7 +260,7 @@ class TestResult: self.log_result(test, 'fail') def log_result(self, test, result): - row = [None]*len(self.names) + row = ['']*len(self.names) # add result assert self.names[0] == 'result' @@ -269,19 +269,31 @@ class TestResult: # add tags for tag in test.tags: - value = test.describe(tag) + value = test.get(tag) + + # infer type if value is None: - value = '' + continue + elif isinstance(value, (int, float)): + value = str(value) + type = 'c' # continous + elif isinstance(value, basestring): + type = 'd' # discrete else: + assert False value = str(value) + type = 'd' # discrete + + # insert value try: col = self.names.index(tag, 1) except ValueError: self.names.append(tag) - self.types.append('d') + self.types.append(type) row.append(value) else: row[col] = value + assert self.types[col] == type self.rows.append(row) @@ -300,7 +312,7 @@ class TestResult: # rows for row in self.rows: - row += [None]*(len(self.names) - len(row)) + row += ['']*(len(self.names) - len(row)) stream.write('\t'.join(row) + '\n') stream.close() -- cgit v1.2.3 From 71384f29f12ab599b4430802ec8e21056a4dd60f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 17:23:48 +0100 Subject: python/test: Limit tree depth. --- src/gallium/state_trackers/python/tests/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py index 585fbba1272..6b2e702955f 100644 --- a/src/gallium/state_trackers/python/tests/base.py +++ b/src/gallium/state_trackers/python/tests/base.py @@ -329,6 +329,6 @@ class TestResult: tree = orngTree.TreeLearner(data, sameMajorityPruning=1, mForPruning=2) - orngTree.printTxt(tree) + orngTree.printTxt(tree, maxDepth=4) orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box') -- cgit v1.2.3 From fcc2598fffe0f0e0412d2a30777f1b4a4ed22249 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 18:00:46 +0100 Subject: util: Enable assembly breakpointt on x86_64. A breakpoint is much nicer than abort when gdb is attached. --- src/gallium/auxiliary/util/u_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 5e88f3ebb1a..8d703e47fce 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -129,7 +129,7 @@ void debug_print_format(const char *msg, unsigned fmt ); * Hard-coded breakpoint. */ #ifdef DEBUG -#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC) +#if (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)) && defined(PIPE_CC_GCC) #define debug_break() __asm("int3") #elif defined(PIPE_CC_MSVC) #define debug_break() __debugbreak() -- cgit v1.2.3 From 4d9dd3ecef1501de31c82e8a08ce1df894b6c548 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 18:01:32 +0100 Subject: python/test: New test for rendering into textures. --- .../state_trackers/python/tests/texture_render.py | 315 +++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100755 src/gallium/state_trackers/python/tests/texture_render.py diff --git a/src/gallium/state_trackers/python/tests/texture_render.py b/src/gallium/state_trackers/python/tests/texture_render.py new file mode 100755 index 00000000000..580bf65c13b --- /dev/null +++ b/src/gallium/state_trackers/python/tests/texture_render.py @@ -0,0 +1,315 @@ +#!/usr/bin/env python +########################################################################## +# +# 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. +# +########################################################################## + + +from gallium import * +from base import * + + +def lods(*dims): + size = max(dims) + lods = 0 + while size: + lods += 1 + size >>= 1 + return lods + + +class TextureTest(TestCase): + + tags = ( + 'target', + 'format', + 'width', + 'height', + 'depth', + 'last_level', + 'face', + 'level', + 'zslice', + ) + + def test(self): + dev = self.dev + + target = self.target + format = self.format + width = self.width + height = self.height + depth = self.depth + last_level = self.last_level + face = self.face + level = self.level + zslice = self.zslice + + # textures + dst_texture = dev.texture_create( + target = target, + format = format, + width = width, + height = height, + depth = depth, + last_level = last_level, + tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET, + ) + if dst_texture is None: + raise TestSkip + + dst_surface = dst_texture.get_surface(face = face, level = level, zslice = zslice) + + ref_texture = dev.texture_create( + target = target, + format = format, + width = dst_surface.width, + height = dst_surface.height, + depth = 1, + last_level = 0, + tex_usage = PIPE_TEXTURE_USAGE_SAMPLER, + ) + + ref_surface = ref_texture.get_surface() + + src_texture = dev.texture_create( + target = target, + format = PIPE_FORMAT_A8R8G8B8_UNORM, + width = dst_surface.width, + height = dst_surface.height, + depth = 1, + last_level = 0, + tex_usage = PIPE_TEXTURE_USAGE_SAMPLER, + ) + + src_surface = src_texture.get_surface() + + expected_rgba = FloatArray(height*width*4) + ref_surface.sample_rgba(expected_rgba) + + src_surface.put_tile_rgba(0, 0, src_surface.width, src_surface.height, expected_rgba) + + ctx = self.dev.context_create() + + # disabled blending/masking + blend = 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 + ctx.set_blend(blend) + + # no-op depth/stencil/alpha + depth_stencil_alpha = DepthStencilAlpha() + ctx.set_depth_stencil_alpha(depth_stencil_alpha) + + # rasterizer + rasterizer = Rasterizer() + rasterizer.front_winding = PIPE_WINDING_CW + rasterizer.cull_mode = PIPE_WINDING_NONE + rasterizer.bypass_vs_clip_and_viewport = 1 + ctx.set_rasterizer(rasterizer) + + # samplers + sampler = 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_NEAREST + sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST + sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST + sampler.normalized_coords = 1 + sampler.min_lod = 0 + sampler.max_lod = PIPE_MAX_TEXTURE_LEVELS - 1 + ctx.set_sampler(0, sampler) + ctx.set_sampler_texture(0, src_texture) + + # framebuffer + cbuf_tex = dev.texture_create( + PIPE_FORMAT_A8R8G8B8_UNORM, + width, + height, + tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET, + ) + + fb = Framebuffer() + fb.width = dst_surface.width + fb.height = dst_surface.height + fb.nr_cbufs = 1 + fb.set_cbuf(0, dst_surface) + ctx.set_framebuffer(fb) + ctx.surface_clear(dst_surface, 0x00000000) + del fb + + # vertex shader + vs = Shader(''' + VERT1.1 + DCL IN[0], POSITION, CONSTANT + DCL IN[1], GENERIC, CONSTANT + DCL OUT[0], POSITION, CONSTANT + DCL OUT[1], GENERIC, CONSTANT + 0:MOV OUT[0], IN[0] + 1:MOV OUT[1], IN[1] + 2:END + ''') + #vs.dump() + ctx.set_vertex_shader(vs) + + # fragment shader + fs = Shader(''' + FRAG1.1 + DCL IN[0], GENERIC[0], LINEAR + DCL OUT[0], COLOR, CONSTANT + DCL SAMP[0], CONSTANT + 0:TEX OUT[0], IN[0], SAMP[0], 2D + 1:END + ''') + #fs.dump() + ctx.set_fragment_shader(fs) + + nverts = 4 + nattrs = 2 + verts = FloatArray(nverts * nattrs * 4) + + x = 0 + y = 0 + w = dst_surface.width + h = dst_surface.height + + pos = [ + [x, y], + [x+w, y], + [x+w, y+h], + [x, y+h], + ] + + tex = [ + [0.0, 0.0], + [1.0, 0.0], + [1.0, 1.0], + [0.0, 1.0], + ] + + for i in range(0, 4): + j = 8*i + verts[j + 0] = pos[i][0] # x + verts[j + 1] = pos[i][1] # y + verts[j + 2] = 0.0 # z + verts[j + 3] = 1.0 # w + verts[j + 4] = tex[i][0] # s + verts[j + 5] = tex[i][1] # r + verts[j + 6] = 0.0 + verts[j + 7] = 1.0 + + ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN, + nverts, + nattrs, + verts) + + ctx.flush() + + self.assert_rgba(dst_surface, x, y, w, h, expected_rgba, 4.0/256, 0.85) + + + +def main(): + dev = Device() + suite = TestSuite() + + targets = [ + PIPE_TEXTURE_2D, + PIPE_TEXTURE_CUBE, + #PIPE_TEXTURE_3D, + ] + + 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_S8_UNORM, + PIPE_FORMAT_A8_UNORM, + PIPE_FORMAT_L8_UNORM, + #PIPE_FORMAT_DXT1_RGB, + #PIPE_FORMAT_DXT1_RGBA, + #PIPE_FORMAT_DXT3_RGBA, + #PIPE_FORMAT_DXT5_RGBA, + ] + + sizes = [64, 32, 16, 8, 4, 2, 1] + #sizes = [1020, 508, 252, 62, 30, 14, 6, 3] + #sizes = [64] + #sizes = [63] + + faces = [ + PIPE_TEX_FACE_POS_X, + PIPE_TEX_FACE_NEG_X, + PIPE_TEX_FACE_POS_Y, + PIPE_TEX_FACE_NEG_Y, + PIPE_TEX_FACE_POS_Z, + PIPE_TEX_FACE_NEG_Z, + ] + + for target in targets: + for format in formats: + for size in sizes: + if target == PIPE_TEXTURE_3D: + depth = size + else: + depth = 1 + for face in faces: + if target != PIPE_TEXTURE_CUBE and face: + continue + levels = lods(size) + for last_level in range(levels): + for level in range(0, last_level + 1): + zslice = 0 + while zslice < depth >> level: + test = TextureTest( + 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) + zslice = (zslice + 1)*2 - 1 + suite.run() + + +if __name__ == '__main__': + main() -- cgit v1.2.3 From fee78c0c1fcfc308c84ab8da1efcc98ed8afc889 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 18:02:27 +0100 Subject: python/test: Set executable permission bit. --- src/gallium/state_trackers/python/tests/base.py | 0 src/gallium/state_trackers/python/tests/texture_sample.py | 0 src/gallium/state_trackers/python/tests/texture_transfer.py | 0 src/gallium/state_trackers/python/tests/tree.py | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 src/gallium/state_trackers/python/tests/base.py mode change 100644 => 100755 src/gallium/state_trackers/python/tests/texture_sample.py mode change 100644 => 100755 src/gallium/state_trackers/python/tests/texture_transfer.py mode change 100644 => 100755 src/gallium/state_trackers/python/tests/tree.py diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py old mode 100644 new mode 100755 diff --git a/src/gallium/state_trackers/python/tests/texture_sample.py b/src/gallium/state_trackers/python/tests/texture_sample.py old mode 100644 new mode 100755 diff --git a/src/gallium/state_trackers/python/tests/texture_transfer.py b/src/gallium/state_trackers/python/tests/texture_transfer.py old mode 100644 new mode 100755 diff --git a/src/gallium/state_trackers/python/tests/tree.py b/src/gallium/state_trackers/python/tests/tree.py old mode 100644 new mode 100755 -- cgit v1.2.3 From f784906eb96ccda2062b53867a5d4bc52653396d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 18:38:48 +0100 Subject: python/test: Dump classification tree to text file too. --- src/gallium/state_trackers/python/tests/base.py | 2 ++ src/gallium/state_trackers/python/tests/tree.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/gallium/state_trackers/python/tests/base.py b/src/gallium/state_trackers/python/tests/base.py index 6b2e702955f..1fa7fe6f3b3 100755 --- a/src/gallium/state_trackers/python/tests/base.py +++ b/src/gallium/state_trackers/python/tests/base.py @@ -331,4 +331,6 @@ class TestResult: orngTree.printTxt(tree, maxDepth=4) + file(name+'.txt', 'wt').write(orngTree.dumpTree(tree)) + orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box') diff --git a/src/gallium/state_trackers/python/tests/tree.py b/src/gallium/state_trackers/python/tests/tree.py index 14b3599c6d7..0c1bcda4cf2 100755 --- a/src/gallium/state_trackers/python/tests/tree.py +++ b/src/gallium/state_trackers/python/tests/tree.py @@ -18,4 +18,6 @@ for arg in sys.argv[1:]: orngTree.printTxt(tree) + file(name+'.txt', 'wt').write(orngTree.dumpTree(tree) + '\n') + orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box') -- cgit v1.2.3 From e2cdc997881bff382eada8c798560c8264219b0b Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 18:39:06 +0100 Subject: python/test: Cleanup. --- .../state_trackers/python/tests/texture_sample.py | 63 +++++++++++++--------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/texture_sample.py b/src/gallium/state_trackers/python/tests/texture_sample.py index fcb347f9a17..f5f49f6e515 100755 --- a/src/gallium/state_trackers/python/tests/texture_sample.py +++ b/src/gallium/state_trackers/python/tests/texture_sample.py @@ -1,6 +1,7 @@ #!/usr/bin/env python ########################################################################## # +# Copyright 2009 VMware, Inc. # Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. # All Rights Reserved. # @@ -19,7 +20,7 @@ # THE SOFTWARE IS PROVIDED "AS 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 +# 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. @@ -278,8 +279,6 @@ class TextureTest(TestCase): cbuf = cbuf_tex.get_surface() self.assert_rgba(cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85) - - del ctx @@ -287,43 +286,57 @@ def main(): dev = Device() suite = TestSuite() - targets = [] - targets += [PIPE_TEXTURE_2D] - targets += [PIPE_TEXTURE_CUBE] - targets += [PIPE_TEXTURE_3D] + targets = [ + PIPE_TEXTURE_2D, + PIPE_TEXTURE_CUBE, + PIPE_TEXTURE_3D, + ] - formats = [] - formats += [PIPE_FORMAT_A8R8G8B8_UNORM] - formats += [PIPE_FORMAT_R5G6B5_UNORM] - formats += [PIPE_FORMAT_L8_UNORM] - formats += [PIPE_FORMAT_YCBCR] - formats += [PIPE_FORMAT_DXT1_RGB] + 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_S8_UNORM, + PIPE_FORMAT_A8_UNORM, + PIPE_FORMAT_L8_UNORM, + PIPE_FORMAT_YCBCR, + PIPE_FORMAT_DXT1_RGB, + #PIPE_FORMAT_DXT1_RGBA, + #PIPE_FORMAT_DXT3_RGBA, + #PIPE_FORMAT_DXT5_RGBA, + ] sizes = [64, 32, 16, 8, 4, 2, 1] #sizes = [1020, 508, 252, 62, 30, 14, 6, 3] #sizes = [64] #sizes = [63] + faces = [ + PIPE_TEX_FACE_POS_X, + PIPE_TEX_FACE_NEG_X, + PIPE_TEX_FACE_POS_Y, + PIPE_TEX_FACE_NEG_Y, + PIPE_TEX_FACE_POS_Z, + PIPE_TEX_FACE_NEG_Z, + ] + for target in targets: for format in formats: for size in sizes: - if target == PIPE_TEXTURE_CUBE: - faces = [ - PIPE_TEX_FACE_POS_X, - PIPE_TEX_FACE_NEG_X, - PIPE_TEX_FACE_POS_Y, - PIPE_TEX_FACE_NEG_Y, - PIPE_TEX_FACE_POS_Z, - PIPE_TEX_FACE_NEG_Z, - ] - #faces = [PIPE_TEX_FACE_NEG_X] - else: - faces = [0] if target == PIPE_TEXTURE_3D: depth = size else: depth = 1 for face in faces: + if target != PIPE_TEXTURE_CUBE and face: + continue levels = lods(size) for last_level in range(levels): for level in range(0, last_level + 1): -- cgit v1.2.3 From 89ecefb887a9e2fd49489904663873e416ec4a83 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 18:39:18 +0100 Subject: python/test: Ignore test output files. --- src/gallium/state_trackers/python/tests/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/.gitignore diff --git a/src/gallium/state_trackers/python/tests/.gitignore b/src/gallium/state_trackers/python/tests/.gitignore new file mode 100644 index 00000000000..0dbbaeea16b --- /dev/null +++ b/src/gallium/state_trackers/python/tests/.gitignore @@ -0,0 +1,3 @@ +*.txt +*.tsv +*.dot -- cgit v1.2.3 From 10b987ae7f5e145bdea4cf726a1e728254ed32ad Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 31 Mar 2009 19:16:17 +0100 Subject: python/test: New test for surface copies. --- .../state_trackers/python/tests/surface_copy.py | 199 +++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100755 src/gallium/state_trackers/python/tests/surface_copy.py diff --git a/src/gallium/state_trackers/python/tests/surface_copy.py b/src/gallium/state_trackers/python/tests/surface_copy.py new file mode 100755 index 00000000000..3ceecbbd3aa --- /dev/null +++ b/src/gallium/state_trackers/python/tests/surface_copy.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python +########################################################################## +# +# 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. +# +########################################################################## + + +from gallium import * +from base import * + + +def lods(*dims): + size = max(dims) + lods = 0 + while size: + lods += 1 + size >>= 1 + return lods + + +class TextureTest(TestCase): + + tags = ( + 'target', + 'format', + 'width', + 'height', + 'depth', + 'last_level', + 'face', + 'level', + 'zslice', + ) + + def test(self): + dev = self.dev + + target = self.target + format = self.format + width = self.width + height = self.height + depth = self.depth + last_level = self.last_level + face = self.face + level = self.level + zslice = self.zslice + + # textures + dst_texture = dev.texture_create( + target = target, + format = format, + width = width, + height = height, + depth = depth, + last_level = last_level, + tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET, + ) + if dst_texture is None: + raise TestSkip + + dst_surface = dst_texture.get_surface(face = face, level = level, zslice = zslice) + + src_texture = dev.texture_create( + target = target, + format = format, + width = dst_surface.width, + height = dst_surface.height, + depth = 1, + last_level = 0, + tex_usage = PIPE_TEXTURE_USAGE_SAMPLER, + ) + + src_surface = src_texture.get_surface() + + x = 0 + y = 0 + w = dst_surface.width + h = dst_surface.height + + stride = dst_surface.nblocksx * dst_texture.block.size + size = dst_surface.nblocksy * stride + src_raw = os.urandom(size) + + src_surface.put_tile_raw(0, 0, w, h, src_raw, stride) + + ctx = self.dev.context_create() + + ctx.surface_copy(dst_surface, 0, 0, + src_surface, 0, 0, w, h) + + ctx.flush() + + dst_raw = dst_surface.get_tile_raw(0, 0, w, h) + + if dst_raw != src_raw: + raise TestFailure + + + +def main(): + dev = Device() + suite = TestSuite() + + targets = [ + PIPE_TEXTURE_2D, + PIPE_TEXTURE_CUBE, + #PIPE_TEXTURE_3D, + ] + + 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_S8_UNORM, + PIPE_FORMAT_A8_UNORM, + PIPE_FORMAT_L8_UNORM, + PIPE_FORMAT_DXT1_RGB, + PIPE_FORMAT_DXT1_RGBA, + PIPE_FORMAT_DXT3_RGBA, + PIPE_FORMAT_DXT5_RGBA, + ] + + sizes = [64, 32, 16, 8, 4, 2, 1] + #sizes = [1020, 508, 252, 62, 30, 14, 6, 3] + #sizes = [64] + #sizes = [63] + + faces = [ + PIPE_TEX_FACE_POS_X, + PIPE_TEX_FACE_NEG_X, + PIPE_TEX_FACE_POS_Y, + PIPE_TEX_FACE_NEG_Y, + PIPE_TEX_FACE_POS_Z, + PIPE_TEX_FACE_NEG_Z, + ] + + for target in targets: + for format in formats: + for size in sizes: + if target == PIPE_TEXTURE_3D: + depth = size + else: + depth = 1 + for face in faces: + if target != PIPE_TEXTURE_CUBE and face: + continue + levels = lods(size) + for last_level in range(levels): + for level in range(0, last_level + 1): + zslice = 0 + while zslice < depth >> level: + test = TextureTest( + 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) + zslice = (zslice + 1)*2 - 1 + suite.run() + + +if __name__ == '__main__': + main() -- cgit v1.2.3 From f25c6b164f324e2138784337870e8219008af754 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 31 Mar 2009 14:48:19 -0700 Subject: Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined (cherry picked from commit b65bc1b6cb72df950c2e26446936804dfcdc432c) --- src/glx/x11/indirect.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index 08d52aeea30..aea117ec32d 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -5198,9 +5198,13 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_DeleteTextures(GET_DISPATCH(), (n, textures)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); @@ -5266,9 +5270,13 @@ glGenTexturesEXT(GLsizei n, GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GenTextures(GET_DISPATCH(), (n, textures)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 4; @@ -5328,9 +5336,13 @@ glIsTextureEXT(GLuint texture) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { return CALL_IsTexture(GET_DISPATCH(), (texture)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; @@ -5641,9 +5653,13 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -5714,10 +5730,14 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetColorTableParameterfv(GET_DISPATCH(), (target, pname, params)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -5784,10 +5804,14 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetColorTableParameteriv(GET_DISPATCH(), (target, pname, params)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6107,10 +6131,14 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetConvolutionFilter(GET_DISPATCH(), (target, format, type, image)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6182,10 +6210,14 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetConvolutionParameterfv(GET_DISPATCH(), (target, pname, params)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6252,10 +6284,14 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetConvolutionParameteriv(GET_DISPATCH(), (target, pname, params)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6329,10 +6365,14 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, values)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6403,9 +6443,13 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6471,9 +6515,13 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6543,9 +6591,13 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6614,9 +6666,13 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6679,9 +6735,13 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params)); } else { +#else + { +#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; -- cgit v1.2.3 From 093ad509fcee5cb3a890663fc80ed671dcaf4000 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 31 Mar 2009 15:08:49 -0700 Subject: Updated CPU_TO_LE32 to work on darwin --- src/mesa/main/compiler.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 39b19bb7767..93103fe878d 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -230,7 +230,10 @@ extern "C" { #if defined(__linux__) #include #define CPU_TO_LE32( x ) bswap_32( x ) -#else /*__linux__*/ +#elif defined(__APPLE__) +#include +#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x ) +#else /*__linux__ __APPLE__*/ #include #define CPU_TO_LE32( x ) bswap32( x ) #endif /*__linux__*/ -- cgit v1.2.3 From 3f3db46911d11189a2487db288420f4a6a3d0069 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 00:19:46 +0200 Subject: python/regress: Initial commit for vertex shader regression tests. --- .../tests/regress/vertex-shader/vert-abs.txt | 11 + .../tests/regress/vertex-shader/vert-add.txt | 9 + .../tests/regress/vertex-shader/vert-dp3.txt | 12 ++ .../tests/regress/vertex-shader/vert-mov.txt | 8 + .../tests/regress/vertex-shader/vertex-shader.py | 240 +++++++++++++++++++++ 5 files changed, 280 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.txt new file mode 100644 index 00000000000..66c1986cef7 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.txt @@ -0,0 +1,11 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +DCL TEMP[0] +IMM FLT32 { 0.2, 0.2, 0.0, 0.0 } +ADD TEMP[0], IN[0], IMM[0] +ABS OUT[0], TEMP[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.txt new file mode 100644 index 00000000000..78753b76d8a --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.txt @@ -0,0 +1,9 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +IMM FLT32 { 0.2, -0.1, 0.0, 0.0 } +ADD OUT[0], IN[0], IMM[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.txt new file mode 100644 index 00000000000..e4c1c4a9b33 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.txt @@ -0,0 +1,12 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +DCL TEMP[0] +IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } +DP3 TEMP[0].xy, IN[0], IN[0] +MOV TEMP[0].zw, IMM[0] +MUL OUT[0], IN[0], TEMP[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.txt new file mode 100644 index 00000000000..12712ff8590 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.txt @@ -0,0 +1,8 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +MOV OUT[0], IN[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py new file mode 100644 index 00000000000..92ff2053093 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -0,0 +1,240 @@ +#!/usr/bin/env python +########################################################################## +# +# 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. +# +########################################################################## + + +from gallium import * + +def make_image(surface): + data = surface.get_tile_rgba8(0, 0, surface.width, surface.height) + + import Image + outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1) + return outimage + +def save_image(filename, surface): + outimage = make_image(surface) + outimage.save(filename, "PNG") + +def test(dev, name): + ctx = dev.context_create() + + width = 320 + height = 320 + minz = 0.0 + maxz = 1.0 + + # disabled blending/masking + blend = 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 + ctx.set_blend(blend) + + # depth/stencil/alpha + depth_stencil_alpha = DepthStencilAlpha() + depth_stencil_alpha.depth.enabled = 1 + depth_stencil_alpha.depth.writemask = 1 + depth_stencil_alpha.depth.func = PIPE_FUNC_LESS + ctx.set_depth_stencil_alpha(depth_stencil_alpha) + + # rasterizer + rasterizer = Rasterizer() + rasterizer.front_winding = PIPE_WINDING_CW + rasterizer.cull_mode = PIPE_WINDING_NONE + rasterizer.scissor = 1 + ctx.set_rasterizer(rasterizer) + + # viewport + viewport = Viewport() + scale = FloatArray(4) + scale[0] = width / 2.0 + scale[1] = -height / 2.0 + scale[2] = (maxz - minz) / 2.0 + scale[3] = 1.0 + viewport.scale = scale + translate = FloatArray(4) + translate[0] = width / 2.0 + translate[1] = height / 2.0 + translate[2] = (maxz - minz) / 2.0 + translate[3] = 0.0 + viewport.translate = translate + ctx.set_viewport(viewport) + + # samplers + sampler = 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_MIPFILTER_NEAREST + sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST + sampler.normalized_coords = 1 + ctx.set_sampler(0, sampler) + + # scissor + scissor = Scissor() + scissor.minx = 0 + scissor.miny = 0 + scissor.maxx = width + scissor.maxy = height + ctx.set_scissor(scissor) + + clip = Clip() + clip.nr = 0 + ctx.set_clip(clip) + + # framebuffer + cbuf = dev.texture_create( + PIPE_FORMAT_X8R8G8B8_UNORM, + width, height, + tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, + ).get_surface() + zbuf = dev.texture_create( + PIPE_FORMAT_Z32_UNORM, + width, height, + tex_usage=PIPE_TEXTURE_USAGE_DEPTH_STENCIL, + ).get_surface() + fb = Framebuffer() + fb.width = width + fb.height = height + fb.nr_cbufs = 1 + fb.set_cbuf(0, cbuf) + fb.set_zsbuf(zbuf) + ctx.set_framebuffer(fb) + ctx.surface_clear(cbuf, 0x80808080) + ctx.surface_clear(zbuf, 0xffffffff) + + # vertex shader + vs = Shader(file('vert-' + name + '.txt', 'rt').read()) + ctx.set_vertex_shader(vs) + + # fragment shader + fs = Shader(''' + FRAG1.1 + DCL IN[0], COLOR, LINEAR + DCL OUT[0], COLOR, CONSTANT + 0:MOV OUT[0], IN[0] + 1:END + ''') + ctx.set_fragment_shader(fs) + + xy = [ + 0.0, 0.8, + -0.2, 0.4, + 0.2, 0.4, + -0.4, 0.0, + 0.0, 0.0, + 0.4, 0.0, + -0.6, -0.4, + -0.2, -0.4, + 0.2, -0.4, + 0.6, -0.4, + -0.8, -0.8, + -0.4, -0.8, + 0.0, -0.8, + 0.4, -0.8, + 0.8, -0.8, + ] + color = [ + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + ] + tri = [ + 1, 2, 0, + 3, 4, 1, + 4, 2, 1, + 4, 5, 2, + 6, 7, 3, + 7, 4, 3, + 7, 8, 4, + 8, 5, 4, + 8, 9, 5, + 10, 11, 6, + 11, 7, 6, + 11, 12, 7, + 12, 8, 7, + 12, 13, 8, + 13, 9, 8, + 13, 14, 9, + ] + + nverts = 16 * 3 + nattrs = 2 + verts = FloatArray(nverts * nattrs * 4) + + for i in range(0, nverts): + verts[i * nattrs * 4 + 0] = xy[tri[i] * 2 + 0] # x + verts[i * nattrs * 4 + 1] = xy[tri[i] * 2 + 1] # y + verts[i * nattrs * 4 + 2] = 0.5 # z + verts[i * nattrs * 4 + 3] = 1.0 # w + verts[i * nattrs * 4 + 4] = color[(i % 3) * 3 + 0] # r + verts[i * nattrs * 4 + 5] = color[(i % 3) * 3 + 1] # g + verts[i * nattrs * 4 + 6] = color[(i % 3) * 3 + 2] # b + verts[i * nattrs * 4 + 7] = 1.0 # a + + ctx.draw_vertices(PIPE_PRIM_TRIANGLES, + nverts, + nattrs, + verts) + + ctx.flush() + + save_image('vert-' + name + '.png', cbuf) + +def main(): + tests = [ + 'abs', + 'add', + 'dp3', + 'mov', + ] + + html = ''' + + + + +
    +

    regression tests for vertex shader

    + +''' + + dev = Device() + for t in tests: + test(dev, t) + html += '' + html += '\n' + + html += '
    ' + t + '
    \n\n\n' + file('vertex-shader.htm', 'wt').write(html) + +if __name__ == '__main__': + main() -- cgit v1.2.3 From 53d507562b252718d95fd99812f5d21c9ae79713 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 15:47:05 -0600 Subject: mesa: minor reformatting, whitespace changes --- src/mesa/main/ffvertex_prog.c | 51 ++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 72b880e28ee..859f72b4586 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -363,7 +363,7 @@ struct tnl_program { }; -static const struct ureg undef = { +static const struct ureg undef = { PROGRAM_UNDEFINED, 0, 0, @@ -398,7 +398,7 @@ static struct ureg negate( struct ureg reg ) { reg.negate ^= 1; return reg; -} +} static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w ) @@ -407,7 +407,6 @@ static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w ) GET_SWZ(reg.swz, y), GET_SWZ(reg.swz, z), GET_SWZ(reg.swz, w)); - return reg; } @@ -898,8 +897,7 @@ static void build_hpos( struct tnl_program *p ) static GLuint material_attrib( GLuint side, GLuint property ) { - return ((property - STATE_AMBIENT) * 2 + - side); + return (property - STATE_AMBIENT) * 2 + side; } @@ -960,7 +958,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; } @@ -978,7 +976,7 @@ static struct ureg get_lightprod( struct tnl_program *p, GLuint light, register_param3(p, STATE_LIGHT, light, property); struct ureg material_value = get_material(p, side, property); struct ureg tmp = get_temp(p); - emit_op2(p, OPCODE_MUL, tmp, 0, light_value, material_value); + emit_op2(p, OPCODE_MUL, tmp, 0, light_value, material_value); return tmp; } else @@ -1015,7 +1013,6 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p, /* Calculate distance attenuation: */ if (p->state->unit[i].light_attenuated) { - /* 1/d,d,d,1/d */ emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist); /* 1,d,d*d,1/d */ @@ -1028,7 +1025,8 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p, emit_op1(p, OPCODE_RCP, dist, 0, dist); /* spot-atten * dist-atten */ emit_op2(p, OPCODE_MUL, att, 0, dist, att); - } else { + } + else { /* dist-atten */ emit_op1(p, OPCODE_RCP, att, 0, dist); } @@ -1082,10 +1080,10 @@ static void build_lighting( struct tnl_program *p ) /* * NOTE: - * dot.x = dot(normal, VPpli) - * dot.y = dot(normal, halfAngle) - * dot.z = back.shininess - * dot.w = front.shininess + * dots.x = dot(normal, VPpli) + * dots.y = dot(normal, halfAngle) + * dots.z = back.shininess + * dots.w = front.shininess */ for (i = 0; i < MAX_LIGHTS; i++) @@ -1097,7 +1095,7 @@ static void build_lighting( struct tnl_program *p ) { if (!p->state->material_shininess_is_zero) { struct ureg shininess = get_material(p, 0, STATE_SHININESS); - emit_op1(p, OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X)); + emit_op1(p, OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X)); release_temp(p, shininess); } @@ -1106,7 +1104,6 @@ static void build_lighting( struct tnl_program *p ) _col1 = make_temp(p, get_identity_param(p)); else _col1 = _col0; - } if (twoside) { @@ -1171,12 +1168,13 @@ static void build_lighting( struct tnl_program *p ) half = get_temp(p); emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); emit_normalize_vec3(p, half, half); - } else { + } + else { half = register_param3(p, STATE_INTERNAL, STATE_LIGHT_HALF_VECTOR, i); } } - } + } else { struct ureg Ppli = register_param3(p, STATE_INTERNAL, STATE_LIGHT_POSITION, i); @@ -1255,7 +1253,8 @@ static void build_lighting( struct tnl_program *p ) res0 = _col0; res1 = register_output( p, VERT_RESULT_COL0 ); } - } else { + } + else { mask0 = 0; mask1 = 0; res0 = _col0; @@ -1267,12 +1266,12 @@ static void build_lighting( struct tnl_program *p ) emit_op1(p, OPCODE_LIT, lit, 0, dots); emit_op2(p, OPCODE_MUL, lit, 0, lit, att); emit_op3(p, OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0); - } + } else if (!p->state->material_shininess_is_zero) { /* there's a non-zero specular term */ emit_op1(p, OPCODE_LIT, lit, 0, dots); emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0); - } + } else { /* no attenutation, no specular */ emit_degenerate_lit(p, lit, dots); @@ -1309,7 +1308,8 @@ static void build_lighting( struct tnl_program *p ) res0 = _bfc0; res1 = register_output( p, VERT_RESULT_BFC0 ); } - } else { + } + else { res0 = _bfc0; res1 = _bfc1; mask0 = 0; @@ -1325,8 +1325,8 @@ static void build_lighting( struct tnl_program *p ) } else if (!p->state->material_shininess_is_zero) { emit_op1(p, OPCODE_LIT, lit, 0, dots); - emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0); - } + emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0); /**/ + } else { emit_degenerate_lit(p, lit, dots); emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0); @@ -1578,7 +1578,7 @@ static void build_texture_transform( struct tnl_program *p ) } release_temps(p); - } + } else { emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i); } @@ -1647,7 +1647,8 @@ static void build_array_pointsize( struct tnl_program *p ) static void build_tnl_program( struct tnl_program *p ) -{ /* Emit the program, starting with modelviewproject: +{ + /* Emit the program, starting with modelviewproject: */ build_hpos(p); -- cgit v1.2.3 From 3705d03b0fbe349dee0221d982965a0590bc7cb0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 16:06:19 -0600 Subject: gallium: added util_is_inf_or_nan() function to u_math.h --- src/gallium/auxiliary/util/u_math.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 9268a9bb7ee..e5003af01d8 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -319,6 +319,18 @@ util_iround(float f) +/** + * Test if x is NaN or +/- infinity. + */ +static INLINE boolean +util_is_inf_or_nan(float x) +{ + union fi tmp; + tmp.f = x; + return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31); +} + + /** * Find first bit set in word. Least significant bit is 1. * Return 0 if no bits set. -- cgit v1.2.3 From d0f28b6dd967cd74bafb37e1e203b5934981bed0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 16:07:38 -0600 Subject: softpipe: use util_is_inf_or_nan() And print/warn NaN/Inf in print_vertex(). --- src/gallium/drivers/softpipe/sp_setup.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index 711343abe67..accc692b66f 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -252,16 +252,6 @@ static PIPE_THREAD_ROUTINE( quad_thread, param ) #endif -/** - * Test if x is NaN or +/- infinity. - */ -static INLINE boolean -is_inf_or_nan(float x) -{ - union fi tmp; - tmp.f = x; - return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31); -} /** @@ -506,6 +496,9 @@ static void print_vertex(const struct setup_context *setup, for (i = 0; i < setup->quad.nr_attrs; i++) { debug_printf(" %d: %f %f %f %f\n", i, v[i][0], v[i][1], v[i][2], v[i][3]); + if (util_is_inf_or_nan(v[i][0])) { + debug_printf(" NaN!\n"); + } } } #endif @@ -595,7 +588,7 @@ static boolean setup_sort_vertices( struct setup_context *setup, debug_printf("%s one-over-area %f area %f det %f\n", __FUNCTION__, setup->oneoverarea, area, det ); */ - if (is_inf_or_nan(setup->oneoverarea)) + if (util_is_inf_or_nan(setup->oneoverarea)) return FALSE; } @@ -1065,7 +1058,7 @@ setup_line_coefficients(struct setup_context *setup, /* NOTE: this is not really area but something proportional to it */ area = setup->emaj.dx * setup->emaj.dx + setup->emaj.dy * setup->emaj.dy; - if (area == 0.0f || is_inf_or_nan(area)) + if (area == 0.0f || util_is_inf_or_nan(area)) return FALSE; setup->oneoverarea = 1.0f / area; -- cgit v1.2.3 From ef6f1027ff0b6027976a7467b8461ffdd53ce2a8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 16:12:17 -0600 Subject: draw: added Nan/Inf assertion in debug code --- src/gallium/auxiliary/draw/draw_vs_exec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c index b3200df8112..dbbc33fffa7 100644 --- a/src/gallium/auxiliary/draw/draw_vs_exec.c +++ b/src/gallium/auxiliary/draw/draw_vs_exec.c @@ -151,6 +151,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader, output[slot][1], output[slot][2], output[slot][3]); + assert(!util_is_inf_or_nan(output[slot][0])); } #endif -- cgit v1.2.3 From 919f57078b289a273e0e46ee2214a9f042b11b1f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 16:13:14 -0600 Subject: mesa: fix bug in GPU codegen for fixed-function two-sided lighting The 'dots' register wasn't getting properly un-negated and un-swizzled after emitting the code for back-face lighting. So, if more than one light source was enabled, the specular exponent for the next light source was wrong. During execution we were evaluating pow(x, y) where y was negative instead of positive. This led to the outcome being zero or NaN. This fixes the occasional black triangles seen in isosurf when hacked to enable two-sided lighting. --- src/mesa/main/ffvertex_prog.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 859f72b4586..03f42704a7d 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -1108,6 +1108,9 @@ static void build_lighting( struct tnl_program *p ) if (twoside) { if (!p->state->material_shininess_is_zero) { + /* Note that we negate the back-face specular exponent here. + * 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, negate(swizzle1(shininess,X))); @@ -1316,6 +1319,11 @@ static void build_lighting( struct tnl_program *p ) mask1 = 0; } + /* For the back face we need to negate the X and Y component + * dot products. dots.Z has the negated back-face specular + * exponent. We swizzle that into the W position. This + * negation makes the back-face specular term positive again. + */ dots = negate(swizzle(dots,X,Y,W,Z)); if (!is_undef(att)) { @@ -1334,8 +1342,10 @@ static void build_lighting( struct tnl_program *p ) emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0); emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1); - /* restore negate flag for next lighting */ - dots = negate(dots); + /* restore dots to its original state for subsequent lights + * by negating and swizzling again. + */ + dots = negate(swizzle(dots,X,Y,W,Z)); release_temp(p, ambient); release_temp(p, diffuse); -- cgit v1.2.3 From a44f54912e4bc0f6be0b7303f8b7a1b934c5819a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 16:17:23 -0600 Subject: tgsi: added some helpful debug functions in the tgsi interpreter Check for NaN/Inf, print exec vectors, print temp registers. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 259877b500d..80b8c92445a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -127,6 +127,49 @@ static const union tgsi_exec_channel ZeroVec = { { 0.0, 0.0, 0.0, 0.0 } }; + +#ifdef DEBUG +static void +check_inf_or_nan(const union tgsi_exec_channel *chan) +{ + assert(!util_is_inf_or_nan(chan->f[0])); + assert(!util_is_inf_or_nan(chan->f[1])); + assert(!util_is_inf_or_nan(chan->f[2])); + assert(!util_is_inf_or_nan(chan->f[3])); +} +#endif + + +#ifdef DEBUG +static void +print_chan(const char *msg, const union tgsi_exec_channel *chan) +{ + debug_printf("%s = {%f, %f, %f, %f}\n", + msg, chan->f[0], chan->f[1], chan->f[2], chan->f[3]); +} +#endif + + +#ifdef DEBUG +static void +print_temp(const struct tgsi_exec_machine *mach, uint index) +{ + const struct tgsi_exec_vector *tmp = &mach->Temps[index]; + int i; + debug_printf("Temp[%u] =\n", index); + for (i = 0; i < 4; i++) { + debug_printf(" %c: { %f, %f, %f, %f }\n", + "XYZW"[i], + tmp->xyzw[i].f[0], + tmp->xyzw[i].f[1], + tmp->xyzw[i].f[2], + tmp->xyzw[i].f[3]); + } +} +#endif + + + /** * Initialize machine state by expanding tokens to full instructions, * allocating temporary storage, setting up constants, etc. @@ -282,6 +325,12 @@ tgsi_exec_machine_init( mach->Temps[TEMP_3_I].xyzw[TEMP_3_C].f[i] = 3.0f; mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C].f[i] = 0.5f; } + +#ifdef DEBUG + /* silence warnings */ + (void) print_chan; + (void) print_temp; +#endif } @@ -1285,6 +1334,10 @@ store_dest( union tgsi_exec_channel *dst; uint execmask = mach->ExecMask; +#ifdef DEBUG + check_inf_or_nan(chan); +#endif + switch (reg->DstRegister.File) { case TGSI_FILE_NULL: dst = &null; -- cgit v1.2.3 From 63529c731a090c5e41c1224ca79b544243a1e570 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 30 Mar 2009 23:54:53 -0700 Subject: r300-gallium: Stubs for vertex shaders. --- src/gallium/drivers/r300/Makefile | 1 + src/gallium/drivers/r300/r300_context.h | 22 +++ src/gallium/drivers/r300/r300_state_shader.c | 5 +- src/gallium/drivers/r300/r300_state_tcl.c | 196 +++++++++++++++++++++++++++ src/gallium/drivers/r300/r300_state_tcl.h | 72 ++++++++++ 5 files changed, 293 insertions(+), 3 deletions(-) create mode 100644 src/gallium/drivers/r300/r300_state_tcl.c create mode 100644 src/gallium/drivers/r300/r300_state_tcl.h diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index 0e4e1155325..9330c286d2b 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -16,6 +16,7 @@ C_SOURCES = \ r300_state_derived.c \ r300_state_invariant.c \ r300_state_shader.c \ + r300_state_tcl.c \ r300_surface.c \ r300_swtcl_emit.c \ r300_texture.c diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index ed6480bea79..0ca445c0918 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -231,6 +231,26 @@ struct r300_vertex_format { int tab[16]; }; +struct r300_vertex_shader { + /* Parent class */ + struct pipe_shader_state state; + struct tgsi_shader_info info; + + /* Has this shader been translated yet? */ + boolean translated; + + /* Number of used instructions */ + int instruction_count; + + /* Machine instructions */ + struct { + uint32_t inst0; + uint32_t inst1; + uint32_t inst2; + uint32_t inst3; + } instructions[128]; /*< XXX magic number */ +}; + struct r300_context { /* Parent class */ struct pipe_context context; @@ -270,6 +290,8 @@ struct r300_context { int vertex_buffer_count; /* Vertex information. */ struct r300_vertex_format vertex_info; + /* Vertex shader. */ + struct r300_vertex_shader* vs; /* Viewport state. */ struct r300_viewport_state* viewport_state; /* Bitmask of dirty state objects. */ diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index 5dc7266f9b1..1b02239ee76 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -623,15 +623,14 @@ void r300_translate_fragment_shader(struct r300_context* r300, } break; } - } - debug_printf("r300: %d texs and %d colors, first free reg is %d\n", + 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; - debug_printf("r300: %d total constants, " + 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); diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c new file mode 100644 index 00000000000..ddf43604b9a --- /dev/null +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -0,0 +1,196 @@ +/* + * Copyright 2009 Corbin Simpson + * + * 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_state_tcl.h" + +static void r300_vs_declare(struct r300_vs_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_GENERIC: + assembler->tex_count++; + break; + default: + debug_printf("r300: vs: Bad semantic declaration %d\n", + decl->Semantic.SemanticName); + break; + } + break; + case TGSI_FILE_OUTPUT: + case TGSI_FILE_CONSTANT: + break; + case TGSI_FILE_TEMPORARY: + assembler->temp_count++; + break; + default: + debug_printf("r300: vs: Bad file %d\n", decl->Declaration.File); + break; + } + + assembler->temp_offset = assembler->color_count + assembler->tex_count; +} + +static INLINE unsigned r300_vs_src(struct r300_vs_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: vs: Unimplemented src %d\n", src->File); + break; + } + return 0; +} + +static INLINE unsigned r300_vs_dst(struct r300_vs_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: vs: Unimplemented dst %d\n", dst->File); + break; + } + return 0; +} + +static void r300_vs_emit_inst(struct r300_vertex_shader* vs, + struct r300_vs_asm* assembler, + struct tgsi_full_src_register* src, + struct tgsi_full_dst_register* dst) +{ + int i = vs->instruction_count; + vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | + R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) | + R300_PVS_DST_OFFSET(dst->DstRegister.Index); +} + +static void r300_vs_instruction(struct r300_vertex_shader* vs, + struct r300_vs_asm* assembler, + struct tgsi_full_instruction* inst) +{ + switch (inst->Instruction.Opcode) { + case TGSI_OPCODE_MOV: + r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0]); + break; + case TGSI_OPCODE_END: + break; + default: + debug_printf("r300: vs: Bad opcode %d\n", + inst->Instruction.Opcode); + break; + } +} + +void r300_translate_vertex_shader(struct r300_context* r300, + struct r300_vertex_shader* vs) +{ + struct tgsi_parse_context parser; + int i; + struct r300_constant_buffer* consts = + &r300->shader_constants[PIPE_SHADER_VERTEX]; + + struct r300_vs_asm* assembler = CALLOC_STRUCT(r300_vs_asm); + if (assembler == NULL) { + return; + } + /* Setup starting offset for immediates. */ + assembler->imm_offset = consts->user_count; + + tgsi_parse_init(&parser, vs->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_vs_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: + r300_vs_instruction(vs, assembler, + &parser.FullToken.FullInstruction); + break; + } + } + + debug_printf("r300: vs: %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; + debug_printf("r300: vs: %d total constants, " + "%d from user and %d from immediates\n", consts->count, + consts->user_count, assembler->imm_count); + + tgsi_dump(vs->state.tokens); + /* XXX finish r300 vertex shader dumper */ + + tgsi_parse_free(&parser); + FREE(assembler); +} diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h new file mode 100644 index 00000000000..54900cc191a --- /dev/null +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -0,0 +1,72 @@ +/* + * Copyright 2009 Corbin Simpson + * + * 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_STATE_TCL_H +#define R300_STATE_TCL_H + +#include "tgsi/tgsi_parse.h" + +#include "r300_context.h" +#include "r300_debug.h" +#include "r300_reg.h" +#include "r300_screen.h" + +/* XXX get these to r300_reg */ +#define R300_PVS_DST_OPCODE(x) ((x) << 0) +# define R300_VE_ADD 3 +#define R300_PVS_DST_REG_TYPE(x) ((x) << 8) +# define R300_PVS_DST_REG_TEMPORARY 0 +# define R300_PVS_DST_REG_A0 1 +# define R300_PVS_DST_REG_OUT 2 +# define R300_PVS_DST_REG_OUT_REPL_X 3 +# define R300_PVS_DST_REG_ALT_TEMPORARY 4 +# define R300_PVS_DST_REG_INPUT 5 +#define R300_PVS_DST_OFFSET(x) ((x) << 13) +#define R300_PVS_DST_WE_SHIFT 20 + +/* Temporary struct used to hold assembly state while putting together + * fragment programs. */ +struct r300_vs_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; +}; + +void r300_translate_vertex_shader(struct r300_context* r300, + struct r300_vertex_shader* vs); + +#endif /* R300_STATE_TCL_H */ -- cgit v1.2.3 From ddd0c94f0440cebc5e63afc1ae0300e0f51bc0a3 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 31 Mar 2009 18:58:03 -0700 Subject: r300-gallium: Add vertex shader emit. --- src/gallium/drivers/r300/r300_emit.c | 20 ++++++++++++++++++ src/gallium/drivers/r300/r300_emit.h | 3 +++ src/gallium/drivers/r300/r300_state_invariant.c | 28 ------------------------- src/gallium/drivers/r300/r300_state_tcl.h | 12 +++++++++++ src/gallium/drivers/r300/r300_surface.c | 21 +++++++++++++++++++ src/gallium/drivers/r300/r300_surface.h | 1 + 6 files changed, 57 insertions(+), 28 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index a2e9cca39ba..4032eac1337 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -325,9 +325,29 @@ void r300_emit_vertex_format_state(struct r300_context* r300) END_CS; } +void r300_emit_vertex_shader(struct r300_context* r300, + struct r300_vertex_shader* vs) +{ + CS_LOCALS(r300); + int i; + + BEGIN_CS(1 + (vs->instruction_count * 4)); + + OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, vs->instruction_count * 4); + for (i = 0; i < vs->instruction_count; i++) { + OUT_CS(vs->instructions[i].inst0); + OUT_CS(vs->instructions[i].inst1); + OUT_CS(vs->instructions[i].inst2); + OUT_CS(vs->instructions[i].inst3); + } + END_CS; + +} + void r300_emit_viewport_state(struct r300_context* r300, struct r300_viewport_state* viewport) { + /* XXX has_tcl */ return; CS_LOCALS(r300); diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 9d92b090ace..31dbc7ab853 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -64,6 +64,9 @@ void r300_emit_texture(struct r300_context* r300, void r300_emit_vertex_format_state(struct r300_context* r300); +void r300_emit_vertex_shader(struct r300_context* r300, + struct r300_vertex_shader* vs); + void r300_emit_viewport_state(struct r300_context* r300, struct r300_viewport_state* viewport); diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 421f01e62ec..f4bd5b6c4b5 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -156,33 +156,5 @@ void r300_emit_invariant_state(struct r300_context* r300) OUT_CS(R300_US_OUT_FMT_UNUSED); OUT_CS(R300_US_OUT_FMT_UNUSED); OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W0); - /* XXX these magic numbers should be explained when - * this becomes a cached state object */ - if (caps->has_tcl) { - OUT_CS_REG(R300_VAP_CNTL, 0xA | - (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) | - (0xB << R300_VF_MAX_VTX_NUM_SHIFT) | - (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT)); - OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, 0x00100000); - OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x00000000); - OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, 0x00000001); - /* XXX translate these back into normal instructions */ - OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x1); - OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0x0); - OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, 8); - OUT_CS(0x00F00203); - OUT_CS(0x00D10001); - OUT_CS(0x01248001); - OUT_CS(0x00000000); - OUT_CS(0x00F02203); - OUT_CS(0x00D10021); - OUT_CS(0x01248021); - OUT_CS(0x00000000); - } else { - OUT_CS_REG(R300_VAP_CNTL, 0xA | - (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) | - (0x5 << R300_VF_MAX_VTX_NUM_SHIFT) | - (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT)); - } END_CS; } diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index 54900cc191a..1b44b9bb04e 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -66,6 +66,18 @@ struct r300_vs_asm { unsigned imm_count; }; +static struct r300_vertex_shader r300_passthrough_vertex_shader = { + .instruction_count = 2, + .instructions[0].inst0 = 0xF00203, + .instructions[0].inst1 = 0xD10001, + .instructions[0].inst2 = 0x1248001, + .instructions[0].inst3 = 0x0, + .instructions[1].inst0 = 0xF00203, + .instructions[1].inst1 = 0xD10021, + .instructions[1].inst2 = 0x1248021, + .instructions[1].inst3 = 0x0, +}; + void r300_translate_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs); diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 9c4f3065a7f..e524b5bf3ef 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -39,6 +39,27 @@ static void r300_surface_setup(struct pipe_context* pipe, r300_emit_dsa_state(r300, &dsa_clear_state); r300_emit_rs_state(r300, &rs_clear_state); + /* XXX these magic numbers should be explained when + * this becomes a cached state object */ + if (caps->has_tcl) { + OUT_CS_REG(R300_VAP_CNTL, 0xA | + (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) | + (0xB << R300_VF_MAX_VTX_NUM_SHIFT) | + (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT)); + OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, 0x00100000); + OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x00000000); + OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, 0x00000001); + /* XXX translate these back into normal instructions */ + OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x1); + OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0x0); + r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader); + } else { + OUT_CS_REG(R300_VAP_CNTL, 0xA | + (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) | + (0x5 << R300_VF_MAX_VTX_NUM_SHIFT) | + (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT)); + } + BEGIN_CS(15); /* Pixel scissors. */ diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h index 465b8476edf..aa34054326c 100644 --- a/src/gallium/drivers/r300/r300_surface.h +++ b/src/gallium/drivers/r300/r300_surface.h @@ -32,6 +32,7 @@ #include "r300_cs.h" #include "r300_emit.h" #include "r300_state_shader.h" +#include "r300_state_tcl.h" #include "r300_state_inlines.h" const struct r300_blend_state blend_clear_state = { -- cgit v1.2.3 From 7540c847f1f046967d31445d5c936bcfdc7ed863 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 31 Mar 2009 20:04:56 -0700 Subject: r300-gallium: Moar vert shader emit. --- src/gallium/drivers/r300/r300_emit.c | 23 ++++++++++++++++++++++- src/gallium/drivers/r300/r300_reg.h | 6 ++++++ src/gallium/drivers/r300/r300_state_invariant.c | 2 +- src/gallium/drivers/r300/r300_state_tcl.h | 1 + src/gallium/drivers/r300/r300_surface.c | 18 ++++-------------- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 4032eac1337..989fba74df0 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -329,10 +329,26 @@ void r300_emit_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs) { CS_LOCALS(r300); + struct r300_screen* r300screen = r300_screen(r300->context.screen); int i; - BEGIN_CS(1 + (vs->instruction_count * 4)); + if (!r300screen->caps->has_tcl) { + debug_printf("r300: Implementation error: emit_vertex_shader called," + " but has_tcl is FALSE!\n"); + return; + } + + BEGIN_CS(13 + (vs->instruction_count * 4)); + OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); + OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, R300_PVS_FIRST_INST(0) | + R300_PVS_LAST_INST(vs->instruction_count - 1)); + OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, vs->instruction_count - 1); + + /* XXX */ + OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x0); + + OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0); OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, vs->instruction_count * 4); for (i = 0; i < vs->instruction_count; i++) { OUT_CS(vs->instructions[i].inst0); @@ -340,6 +356,11 @@ void r300_emit_vertex_shader(struct r300_context* r300, OUT_CS(vs->instructions[i].inst2); OUT_CS(vs->instructions[i].inst3); } + + OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(10) | + R300_PVS_NUM_CNTLRS(5) | + R300_PVS_NUM_FPUS(r300screen->caps->num_vert_fpus) | + R300_PVS_VF_MAX_VTX_NUM(12)); END_CS; } diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index c9a195a6ce4..660816e1da1 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -73,6 +73,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_PVS_NUM_CNTLRS_SHIFT 4 # define R300_PVS_NUM_FPUS_SHIFT 8 # define R300_VF_MAX_VTX_NUM_SHIFT 18 +# define R300_PVS_NUM_SLOTS(x) ((x) << 0) +# define R300_PVS_NUM_CNTLRS(x) ((x) << 4) +# define R300_PVS_NUM_FPUS(x) ((x) << 8) +# define R300_PVS_VF_MAX_VTX_NUM(x) ((x) << 18) # define R300_GL_CLIP_SPACE_DEF (0 << 22) # define R300_DX_CLIP_SPACE_DEF (1 << 22) # define R500_TCL_STATE_OPTIMIZATION (1 << 23) @@ -506,6 +510,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_PVS_FIRST_INST_SHIFT 0 # define R300_PVS_XYZW_VALID_INST_SHIFT 10 # define R300_PVS_LAST_INST_SHIFT 20 +# define R300_PVS_FIRST_INST(x) ((x) << 0) +# define R300_PVS_LAST_INST(x) ((x) << 20) /* Addresses are relative the the vertex program parameters area. */ #define R300_VAP_PVS_CONST_CNTL 0x22D4 # define R300_PVS_CONST_BASE_OFFSET_SHIFT 0 diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index f4bd5b6c4b5..8bd9b41bd74 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -86,7 +86,7 @@ void r300_emit_invariant_state(struct r300_context* r300) END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(81 + (caps->has_tcl ? 26 : 0)); + BEGIN_CS(79 + (caps->has_tcl ? 7 : 0)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index 1b44b9bb04e..bc22cd984dd 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -67,6 +67,7 @@ struct r300_vs_asm { }; static struct r300_vertex_shader r300_passthrough_vertex_shader = { + /* XXX translate these back into normal instructions */ .instruction_count = 2, .instructions[0].inst0 = 0xF00203, .instructions[0].inst1 = 0xD10001, diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index e524b5bf3ef..8cafe7d1045 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -42,22 +42,12 @@ static void r300_surface_setup(struct pipe_context* pipe, /* XXX these magic numbers should be explained when * this becomes a cached state object */ if (caps->has_tcl) { - OUT_CS_REG(R300_VAP_CNTL, 0xA | - (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) | - (0xB << R300_VF_MAX_VTX_NUM_SHIFT) | - (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT)); - OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, 0x00100000); - OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x00000000); - OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, 0x00000001); - /* XXX translate these back into normal instructions */ - OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x1); - OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0x0); r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader); } else { - OUT_CS_REG(R300_VAP_CNTL, 0xA | - (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) | - (0x5 << R300_VF_MAX_VTX_NUM_SHIFT) | - (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT)); + OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) | + R300_PVS_NUM_CNTLRS(5) | + R300_PVS_NUM_FPUS(caps->num_vert_fpus) | + R300_PVS_VF_MAX_VTX_NUM(12)); } BEGIN_CS(15); -- cgit v1.2.3 From 27d886ae33d287d91c92cc353f7b98f916b4d080 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 31 Mar 2009 20:24:50 -0700 Subject: r300-gallium: Backwards test. Wow, how long's that been there? Embarrassing. --- src/gallium/drivers/r300/r300_chipset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index e01a0546b22..9d95ad918c2 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -30,7 +30,7 @@ void r300_parse_chipset(struct r300_capabilities* caps) { /* Reasonable defaults */ - caps->has_tcl = getenv("RADEON_NO_TCL") ? TRUE : FALSE; + caps->has_tcl = getenv("RADEON_NO_TCL") ? FALSE : TRUE; caps->is_r500 = FALSE; caps->num_vert_fpus = 4; -- cgit v1.2.3 From e8b5d170abdab9d3d750081e0371db5c3ce51c56 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 10:18:50 +0200 Subject: python/regress: Add more vertex shader tests. --- .../python/tests/regress/vertex-shader/vert-dp4.txt | 12 ++++++++++++ .../python/tests/regress/vertex-shader/vert-mul.txt | 9 +++++++++ .../python/tests/regress/vertex-shader/vert-sub.txt | 9 +++++++++ .../python/tests/regress/vertex-shader/vertex-shader.py | 3 +++ 4 files changed, 33 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.txt diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.txt new file mode 100644 index 00000000000..3e5f248bebc --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.txt @@ -0,0 +1,12 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +DCL TEMP[0] +IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } +DP4 TEMP[0].xy, IN[0], IN[0] +MOV TEMP[0].zw, IMM[0] +MUL OUT[0], IN[0], TEMP[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.txt new file mode 100644 index 00000000000..1289fcd2e2b --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.txt @@ -0,0 +1,9 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +IMM FLT32 { 0.6, 0.6, 1.0, 1.0 } +MUL OUT[0], IN[0], IMM[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.txt new file mode 100644 index 00000000000..9190086a22e --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.txt @@ -0,0 +1,9 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +IMM FLT32 { 0.1, 0.1, 0.0, 0.0 } +SUB OUT[0], IN[0], IMM[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 92ff2053093..b393500742c 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -214,7 +214,10 @@ def main(): 'abs', 'add', 'dp3', + 'dp4', 'mov', + 'mul', + 'sub', ] html = ''' -- cgit v1.2.3 From 541d74423abf04c6cdcf545f853980b959a70ec8 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 10:23:09 +0200 Subject: python/regress: Rename test files from *.txt to *.sh -- won't be .gitignored. --- .../python/tests/regress/vertex-shader/vert-abs.sh | 11 +++++++++++ .../python/tests/regress/vertex-shader/vert-abs.txt | 11 ----------- .../python/tests/regress/vertex-shader/vert-add.sh | 9 +++++++++ .../python/tests/regress/vertex-shader/vert-add.txt | 9 --------- .../python/tests/regress/vertex-shader/vert-dp3.sh | 12 ++++++++++++ .../python/tests/regress/vertex-shader/vert-dp3.txt | 12 ------------ .../python/tests/regress/vertex-shader/vert-dp4.sh | 12 ++++++++++++ .../python/tests/regress/vertex-shader/vert-dp4.txt | 12 ------------ .../python/tests/regress/vertex-shader/vert-mov.sh | 8 ++++++++ .../python/tests/regress/vertex-shader/vert-mov.txt | 8 -------- .../python/tests/regress/vertex-shader/vert-mul.sh | 9 +++++++++ .../python/tests/regress/vertex-shader/vert-mul.txt | 9 --------- .../python/tests/regress/vertex-shader/vert-sub.sh | 9 +++++++++ .../python/tests/regress/vertex-shader/vert-sub.txt | 9 --------- .../python/tests/regress/vertex-shader/vertex-shader.py | 2 +- 15 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh delete mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh delete mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh delete mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh delete mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh delete mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh delete mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.txt create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh delete mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.txt diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh new file mode 100644 index 00000000000..66c1986cef7 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh @@ -0,0 +1,11 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +DCL TEMP[0] +IMM FLT32 { 0.2, 0.2, 0.0, 0.0 } +ADD TEMP[0], IN[0], IMM[0] +ABS OUT[0], TEMP[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.txt deleted file mode 100644 index 66c1986cef7..00000000000 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.txt +++ /dev/null @@ -1,11 +0,0 @@ -VERT1.1 -DCL IN[0], POSITION -DCL IN[1], COLOR -DCL OUT[0], POSITION -DCL OUT[1], COLOR -DCL TEMP[0] -IMM FLT32 { 0.2, 0.2, 0.0, 0.0 } -ADD TEMP[0], IN[0], IMM[0] -ABS OUT[0], TEMP[0] -MOV OUT[1], IN[1] -END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh new file mode 100644 index 00000000000..78753b76d8a --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh @@ -0,0 +1,9 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +IMM FLT32 { 0.2, -0.1, 0.0, 0.0 } +ADD OUT[0], IN[0], IMM[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.txt deleted file mode 100644 index 78753b76d8a..00000000000 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.txt +++ /dev/null @@ -1,9 +0,0 @@ -VERT1.1 -DCL IN[0], POSITION -DCL IN[1], COLOR -DCL OUT[0], POSITION -DCL OUT[1], COLOR -IMM FLT32 { 0.2, -0.1, 0.0, 0.0 } -ADD OUT[0], IN[0], IMM[0] -MOV OUT[1], IN[1] -END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh new file mode 100644 index 00000000000..e4c1c4a9b33 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh @@ -0,0 +1,12 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +DCL TEMP[0] +IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } +DP3 TEMP[0].xy, IN[0], IN[0] +MOV TEMP[0].zw, IMM[0] +MUL OUT[0], IN[0], TEMP[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.txt deleted file mode 100644 index e4c1c4a9b33..00000000000 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.txt +++ /dev/null @@ -1,12 +0,0 @@ -VERT1.1 -DCL IN[0], POSITION -DCL IN[1], COLOR -DCL OUT[0], POSITION -DCL OUT[1], COLOR -DCL TEMP[0] -IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } -DP3 TEMP[0].xy, IN[0], IN[0] -MOV TEMP[0].zw, IMM[0] -MUL OUT[0], IN[0], TEMP[0] -MOV OUT[1], IN[1] -END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh new file mode 100644 index 00000000000..3e5f248bebc --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh @@ -0,0 +1,12 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +DCL TEMP[0] +IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } +DP4 TEMP[0].xy, IN[0], IN[0] +MOV TEMP[0].zw, IMM[0] +MUL OUT[0], IN[0], TEMP[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.txt deleted file mode 100644 index 3e5f248bebc..00000000000 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.txt +++ /dev/null @@ -1,12 +0,0 @@ -VERT1.1 -DCL IN[0], POSITION -DCL IN[1], COLOR -DCL OUT[0], POSITION -DCL OUT[1], COLOR -DCL TEMP[0] -IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } -DP4 TEMP[0].xy, IN[0], IN[0] -MOV TEMP[0].zw, IMM[0] -MUL OUT[0], IN[0], TEMP[0] -MOV OUT[1], IN[1] -END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh new file mode 100644 index 00000000000..12712ff8590 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh @@ -0,0 +1,8 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +MOV OUT[0], IN[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.txt deleted file mode 100644 index 12712ff8590..00000000000 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.txt +++ /dev/null @@ -1,8 +0,0 @@ -VERT1.1 -DCL IN[0], POSITION -DCL IN[1], COLOR -DCL OUT[0], POSITION -DCL OUT[1], COLOR -MOV OUT[0], IN[0] -MOV OUT[1], IN[1] -END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh new file mode 100644 index 00000000000..1289fcd2e2b --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh @@ -0,0 +1,9 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +IMM FLT32 { 0.6, 0.6, 1.0, 1.0 } +MUL OUT[0], IN[0], IMM[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.txt deleted file mode 100644 index 1289fcd2e2b..00000000000 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.txt +++ /dev/null @@ -1,9 +0,0 @@ -VERT1.1 -DCL IN[0], POSITION -DCL IN[1], COLOR -DCL OUT[0], POSITION -DCL OUT[1], COLOR -IMM FLT32 { 0.6, 0.6, 1.0, 1.0 } -MUL OUT[0], IN[0], IMM[0] -MOV OUT[1], IN[1] -END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh new file mode 100644 index 00000000000..9190086a22e --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh @@ -0,0 +1,9 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +IMM FLT32 { 0.1, 0.1, 0.0, 0.0 } +SUB OUT[0], IN[0], IMM[0] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.txt b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.txt deleted file mode 100644 index 9190086a22e..00000000000 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.txt +++ /dev/null @@ -1,9 +0,0 @@ -VERT1.1 -DCL IN[0], POSITION -DCL IN[1], COLOR -DCL OUT[0], POSITION -DCL OUT[1], COLOR -IMM FLT32 { 0.1, 0.1, 0.0, 0.0 } -SUB OUT[0], IN[0], IMM[0] -MOV OUT[1], IN[1] -END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index b393500742c..7e0b561d79a 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -132,7 +132,7 @@ def test(dev, name): ctx.surface_clear(zbuf, 0xffffffff) # vertex shader - vs = Shader(file('vert-' + name + '.txt', 'rt').read()) + vs = Shader(file('vert-' + name + '.sh', 'rt').read()) ctx.set_vertex_shader(vs) # fragment shader -- cgit v1.2.3 From 5d8677469b369d2b6a89519be7e379abdf4015d3 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 10:56:53 +0200 Subject: python/regress: Add vertex shader test for XPD. --- .../state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh | 8 ++++++++ .../python/tests/regress/vertex-shader/vertex-shader.py | 1 + 2 files changed, 9 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh new file mode 100644 index 00000000000..6c767cc017f --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh @@ -0,0 +1,8 @@ +VERT1.1 +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +XPD OUT[0], IN[0], IN[1] +MOV OUT[1], IN[1] +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 7e0b561d79a..c207a46ec35 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -218,6 +218,7 @@ def main(): 'mov', 'mul', 'sub', + 'xpd', ] html = ''' -- cgit v1.2.3 From dd6f1771c9e52f1c6126aa223555e363e522c088 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 10:58:46 +0200 Subject: python/regress: Indent. --- .../state_trackers/python/tests/regress/vertex-shader/vert-abs.sh | 4 ++++ .../state_trackers/python/tests/regress/vertex-shader/vert-add.sh | 4 ++++ .../state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh | 4 ++++ .../state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh | 4 ++++ .../state_trackers/python/tests/regress/vertex-shader/vert-mov.sh | 3 +++ .../state_trackers/python/tests/regress/vertex-shader/vert-mul.sh | 4 ++++ .../state_trackers/python/tests/regress/vertex-shader/vert-sub.sh | 4 ++++ .../state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh | 3 +++ 8 files changed, 30 insertions(+) diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh index 66c1986cef7..f0d0d5de171 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh @@ -1,11 +1,15 @@ VERT1.1 + DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR DCL TEMP[0] + IMM FLT32 { 0.2, 0.2, 0.0, 0.0 } + ADD TEMP[0], IN[0], IMM[0] ABS OUT[0], TEMP[0] MOV OUT[1], IN[1] + END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh index 78753b76d8a..936c851c9dc 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh @@ -1,9 +1,13 @@ VERT1.1 + DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR + IMM FLT32 { 0.2, -0.1, 0.0, 0.0 } + ADD OUT[0], IN[0], IMM[0] MOV OUT[1], IN[1] + END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh index e4c1c4a9b33..b57d68520fc 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh @@ -1,12 +1,16 @@ VERT1.1 + DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR DCL TEMP[0] + IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } + DP3 TEMP[0].xy, IN[0], IN[0] MOV TEMP[0].zw, IMM[0] MUL OUT[0], IN[0], TEMP[0] MOV OUT[1], IN[1] + END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh index 3e5f248bebc..0eb31719c58 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh @@ -1,12 +1,16 @@ VERT1.1 + DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR DCL TEMP[0] + IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } + DP4 TEMP[0].xy, IN[0], IN[0] MOV TEMP[0].zw, IMM[0] MUL OUT[0], IN[0], TEMP[0] MOV OUT[1], IN[1] + END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh index 12712ff8590..bcdec07c204 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh @@ -1,8 +1,11 @@ VERT1.1 + DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR + MOV OUT[0], IN[0] MOV OUT[1], IN[1] + END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh index 1289fcd2e2b..f3b57c30382 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh @@ -1,9 +1,13 @@ VERT1.1 + DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR + IMM FLT32 { 0.6, 0.6, 1.0, 1.0 } + MUL OUT[0], IN[0], IMM[0] MOV OUT[1], IN[1] + END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh index 9190086a22e..a583b958284 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh @@ -1,9 +1,13 @@ VERT1.1 + DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR + IMM FLT32 { 0.1, 0.1, 0.0, 0.0 } + SUB OUT[0], IN[0], IMM[0] MOV OUT[1], IN[1] + END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh index 6c767cc017f..10e421684b5 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh @@ -1,8 +1,11 @@ VERT1.1 + DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR + XPD OUT[0], IN[0], IN[1] MOV OUT[1], IN[1] + END -- cgit v1.2.3 From 65cbe7e69c30a4ac91cfbc27a964a19b59d3cedd Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 11:08:41 +0200 Subject: python/regress: Fix vertex shader XPD test. --- .../state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh index 10e421684b5..8def8943b03 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh @@ -5,7 +5,7 @@ DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR -XPD OUT[0], IN[0], IN[1] -MOV OUT[1], IN[1] +MOV OUT[0], IN[0] +XPD OUT[1], IN[0], IN[1] END -- cgit v1.2.3 From 449bab61b3209d15d71ba7d5cc266f76ee16df2b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 11:09:37 +0200 Subject: python/regress: Add vertex shader DST test. --- .../python/tests/regress/vertex-shader/vert-dst.sh | 11 +++++++++++ .../python/tests/regress/vertex-shader/vertex-shader.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh new file mode 100644 index 00000000000..dc5e0eb92e5 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh @@ -0,0 +1,11 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +MOV OUT[0], IN[0] +DST OUT[1], IN[1], IN[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index c207a46ec35..7b658165a7f 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -215,6 +215,7 @@ def main(): 'add', 'dp3', 'dp4', + 'dst', 'mov', 'mul', 'sub', -- cgit v1.2.3 From 998234ced24e2a4b73b91fbbe25b00d29c6ccc66 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 11:25:02 +0200 Subject: python/regress: Add vertex shader EX2 test. --- .../python/tests/regress/vertex-shader/vert-ex2.sh | 18 ++++++++++++++++++ .../tests/regress/vertex-shader/vertex-shader.py | 1 + 2 files changed, 19 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh new file mode 100644 index 00000000000..34057af4e66 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh @@ -0,0 +1,18 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0..1] + +IMM FLT32 { 0.3, 0.3, 0.3, 1.0 } + +EX2 TEMP[0], IN[0] +EX2 TEMP[1], IN[1].yyyy +MUL TEMP[0], TEMP[0], IMM[0] +MOV OUT[0], IN[0] +MUL OUT[1], TEMP[0], TEMP[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 7b658165a7f..72ea88b1860 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -216,6 +216,7 @@ def main(): 'dp3', 'dp4', 'dst', + 'ex2', 'mov', 'mul', 'sub', -- cgit v1.2.3 From 9d77663abb6ebb5eae66fac18088079e76f508d3 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 11:25:58 +0200 Subject: tgsi/doc: Fix typo. --- src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index a20ad689c08..a3f4947c734 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -262,7 +262,7 @@ TGSI Instruction Specification dst.w = round(src.w) -1.3.10 EXPBASE2 - Exponent Base 2 +1.3.10 EXPBASE2 - Exponential Base 2 dst.x = pow(2.0, src.x) dst.y = pow(2.0, src.x) -- cgit v1.2.3 From 1aa4b79dc772825cabfcc97de90b7247cc4b10a0 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 11:45:25 +0200 Subject: tgsi: Provide alternate instruction mnemonics in tgsi info. --- src/gallium/auxiliary/tgsi/tgsi_info.c | 58 +++++++++++++++++----------------- src/gallium/auxiliary/tgsi/tgsi_info.h | 2 ++ 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 2b8a6f0fb19..22034c7a0ba 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -33,42 +33,42 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 1, 0, 0, "ARL" }, { 1, 1, 0, 0, "MOV" }, { 1, 1, 0, 0, "LIT" }, - { 1, 1, 0, 0, "RCP" }, - { 1, 1, 0, 0, "RSQ" }, - { 1, 1, 0, 0, "EXP" }, + { 1, 1, 0, 0, "RCP", "RECIP" }, + { 1, 1, 0, 0, "RSQ", "RECIPSQRT" }, + { 1, 1, 0, 0, "EXP", "EXPP" }, { 1, 1, 0, 0, "LOG" }, { 1, 2, 0, 0, "MUL" }, { 1, 2, 0, 0, "ADD" }, - { 1, 2, 0, 0, "DP3" }, - { 1, 2, 0, 0, "DP4" }, + { 1, 2, 0, 0, "DP3", "DOT3" }, + { 1, 2, 0, 0, "DP4", "DOT4" }, { 1, 2, 0, 0, "DST" }, { 1, 2, 0, 0, "MIN" }, { 1, 2, 0, 0, "MAX" }, - { 1, 2, 0, 0, "SLT" }, - { 1, 2, 0, 0, "SGE" }, - { 1, 3, 0, 0, "MAD" }, + { 1, 2, 0, 0, "SLT", "SETLT" }, + { 1, 2, 0, 0, "SGE", "SETGE" }, + { 1, 3, 0, 0, "MAD", "MADD" }, { 1, 2, 0, 0, "SUB" }, - { 1, 3, 0, 0, "LERP" }, + { 1, 3, 0, 0, "LRP", "LERP" }, { 1, 3, 0, 0, "CND" }, { 1, 3, 0, 0, "CND0" }, - { 1, 3, 0, 0, "DOT2ADD" }, + { 1, 3, 0, 0, "DP2A", "DP2ADD", "DOT2ADD" }, { 1, 2, 0, 0, "INDEX" }, { 1, 1, 0, 0, "NEGATE" }, - { 1, 1, 0, 0, "FRAC" }, + { 1, 1, 0, 0, "FRC", "FRAC" }, { 1, 3, 0, 0, "CLAMP" }, - { 1, 1, 0, 0, "FLOOR" }, + { 1, 1, 0, 0, "FLR", "FLOOR" }, { 1, 1, 0, 0, "ROUND" }, - { 1, 1, 0, 0, "EXPBASE2" }, - { 1, 1, 0, 0, "LOGBASE2" }, - { 1, 2, 0, 0, "POWER" }, - { 1, 2, 0, 0, "CROSSPRODUCT" }, - { 1, 2, 0, 0, "MULTIPLYMATRIX" }, + { 1, 1, 0, 0, "EX2", "EXPBASE2" }, + { 1, 1, 0, 0, "LG2", "LOGBASE2", "LOGP" }, + { 1, 2, 0, 0, "POW", "POWER" }, + { 1, 2, 0, 0, "XPD", "CRS", "CROSSPRODUCT" }, + { 1, 2, 0, 0, "M4X4", "MULTIPLYMATRIX" }, { 1, 1, 0, 0, "ABS" }, { 1, 1, 0, 0, "RCC" }, { 1, 2, 0, 0, "DPH" }, { 1, 1, 0, 0, "COS" }, - { 1, 1, 0, 0, "DDX" }, - { 1, 1, 0, 0, "DDY" }, + { 1, 1, 0, 0, "DDX", "DSX" }, + { 1, 1, 0, 0, "DDY", "DSY" }, { 0, 0, 0, 0, "KILP" }, { 1, 1, 0, 0, "PK2H" }, { 1, 1, 0, 0, "PK2US" }, @@ -82,8 +82,8 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 2, 0, 0, "SLE" }, { 1, 2, 0, 0, "SNE" }, { 1, 2, 0, 0, "STR" }, - { 1, 2, 1, 0, "TEX" }, - { 1, 4, 1, 0, "TXD" }, + { 1, 2, 1, 0, "TEX", "TEXLD" }, + { 1, 4, 1, 0, "TXD", "TEXLDD" }, { 1, 2, 1, 0, "TXP" }, { 1, 1, 0, 0, "UP2H" }, { 1, 1, 0, 0, "UP2US" }, @@ -91,19 +91,19 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 1, 0, 0, "UP4UB" }, { 1, 3, 0, 0, "X2D" }, { 1, 1, 0, 0, "ARA" }, - { 1, 1, 0, 0, "ARR" }, + { 1, 1, 0, 0, "ARR", "MOVA" }, { 0, 1, 0, 0, "BRA" }, - { 0, 0, 0, 1, "CAL" }, + { 0, 0, 0, 1, "CAL", "CALL" }, { 0, 0, 0, 0, "RET" }, - { 1, 1, 0, 0, "SSG" }, + { 1, 1, 0, 0, "SGN", "SSG" }, { 1, 3, 0, 0, "CMP" }, - { 1, 1, 0, 0, "SCS" }, - { 1, 2, 1, 0, "TXB" }, + { 1, 1, 0, 0, "SCS", "SINCOS" }, + { 1, 2, 1, 0, "TXB", "TEXLDB" }, { 1, 1, 0, 0, "NRM" }, { 1, 2, 0, 0, "DIV" }, { 1, 2, 0, 0, "DP2" }, { 1, 2, 1, 0, "TXL" }, - { 0, 0, 0, 0, "BRK" }, + { 0, 0, 0, 0, "BRK", "BREAK" }, { 0, 1, 0, 1, "IF" }, { 0, 0, 0, 0, "LOOP" }, { 0, 1, 0, 0, "REP" }, @@ -116,7 +116,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 1, 0, 0, "CEIL" }, { 1, 1, 0, 0, "I2F" }, { 1, 1, 0, 0, "NOT" }, - { 1, 1, 0, 0, "TRUNC" }, + { 1, 1, 0, 0, "INT", "TRUNC" }, { 1, 2, 0, 0, "SHL" }, { 1, 2, 0, 0, "SHR" }, { 1, 2, 0, 0, "AND" }, @@ -146,7 +146,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 0, 1, 0, 0, "CALLNZ" }, { 0, 1, 0, 0, "IFC" }, { 0, 1, 0, 0, "BREAKC" }, - { 0, 1, 0, 0, "KIL" }, + { 0, 1, 0, 0, "KIL", "TEXKILL" }, { 0, 0, 0, 0, "END" }, { 1, 1, 0, 0, "SWZ" } }; diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h b/src/gallium/auxiliary/tgsi/tgsi_info.h index 7230bdaae33..077e25acd7f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.h +++ b/src/gallium/auxiliary/tgsi/tgsi_info.h @@ -41,6 +41,8 @@ struct tgsi_opcode_info boolean is_tex; boolean is_branch; const char *mnemonic; + const char *alt_mnemonic1; + const char *alt_mnemonic2; }; const struct tgsi_opcode_info * -- cgit v1.2.3 From daec1035a2d23ee4d3122f10fd6e676216527d53 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 11:49:55 +0200 Subject: tgsi: Lookup alternate instruction mnemonics when parsing tgsi text. --- src/gallium/auxiliary/tgsi/tgsi_text.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 58fe07c11d1..fdaee9b060b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -740,6 +740,26 @@ static const char *texture_names[TGSI_TEXTURE_COUNT] = "SHADOWRECT" }; +static boolean +match_inst_mnemonic(const char **pcur, + const struct tgsi_opcode_info *info) +{ + if (str_match_no_case(pcur, info->mnemonic)) { + return TRUE; + } + if (info->alt_mnemonic1) { + if (str_match_no_case(pcur, info->alt_mnemonic1)) { + return TRUE; + } + if (info->alt_mnemonic2) { + if (str_match_no_case(pcur, info->alt_mnemonic2)) { + return TRUE; + } + } + } + return FALSE; +} + static boolean parse_instruction( struct translate_ctx *ctx, @@ -758,7 +778,7 @@ parse_instruction( const char *cur = ctx->cur; info = tgsi_get_opcode_info( i ); - if (str_match_no_case( &cur, info->mnemonic )) { + if (match_inst_mnemonic(&cur, info)) { if (str_match_no_case( &cur, "_SATNV" )) saturate = TGSI_SAT_MINUS_PLUS_ONE; else if (str_match_no_case( &cur, "_SAT" )) -- cgit v1.2.3 From 2555bed7fcc6f9ba35e9fb91e84a144621ccc995 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 07:33:50 -0600 Subject: mesa: minor tweaks in append_token() for printing state var strings --- src/mesa/shader/prog_statevars.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index aeb7cf6de20..9c155fbe07a 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -760,28 +760,28 @@ append_token(char *dst, gl_state_index k) append(dst, ".spot.cutoff"); break; case STATE_TEXGEN_EYE_S: - append(dst, "eye.s"); + append(dst, ".eye.s"); break; case STATE_TEXGEN_EYE_T: - append(dst, "eye.t"); + append(dst, ".eye.t"); break; case STATE_TEXGEN_EYE_R: - append(dst, "eye.r"); + append(dst, ".eye.r"); break; case STATE_TEXGEN_EYE_Q: - append(dst, "eye.q"); + append(dst, ".eye.q"); break; case STATE_TEXGEN_OBJECT_S: - append(dst, "object.s"); + append(dst, ".object.s"); break; case STATE_TEXGEN_OBJECT_T: - append(dst, "object.t"); + append(dst, ".object.t"); break; case STATE_TEXGEN_OBJECT_R: - append(dst, "object.r"); + append(dst, ".object.r"); break; case STATE_TEXGEN_OBJECT_Q: - append(dst, "object.q"); + append(dst, ".object.q"); break; case STATE_TEXENV_COLOR: append(dst, "texenv"); -- cgit v1.2.3 From f8dd6594bf1d597b883af44e5d724a181c1e2b53 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 07:35:07 -0600 Subject: glsl: fix texgen state variable tokens in emit_statevars() This fixes broken variable indexing into the gl_Eye/ObjectPlaneS/T/R/Q arrays. See bug 20986. --- src/mesa/shader/slang/slang_builtin.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c index 9858a0f7fdc..83e76b77db3 100644 --- a/src/mesa/shader/slang/slang_builtin.c +++ b/src/mesa/shader/slang/slang_builtin.c @@ -457,28 +457,36 @@ emit_statevars(const char *name, int array_len, tokens[0] = STATE_TEXENV_COLOR; } else if (strcmp(name, "gl_EyePlaneS") == 0) { - tokens[0] = STATE_TEXGEN_EYE_S; + tokens[0] = STATE_TEXGEN; + tokens[2] = STATE_TEXGEN_EYE_S; } else if (strcmp(name, "gl_EyePlaneT") == 0) { - tokens[0] = STATE_TEXGEN_EYE_T; + tokens[0] = STATE_TEXGEN; + tokens[2] = STATE_TEXGEN_EYE_T; } else if (strcmp(name, "gl_EyePlaneR") == 0) { - tokens[0] = STATE_TEXGEN_EYE_R; + tokens[0] = STATE_TEXGEN; + tokens[2] = STATE_TEXGEN_EYE_R; } else if (strcmp(name, "gl_EyePlaneQ") == 0) { - tokens[0] = STATE_TEXGEN_EYE_Q; + tokens[0] = STATE_TEXGEN; + tokens[2] = STATE_TEXGEN_EYE_Q; } else if (strcmp(name, "gl_ObjectPlaneS") == 0) { - tokens[0] = STATE_TEXGEN_OBJECT_S; + tokens[0] = STATE_TEXGEN; + tokens[2] = STATE_TEXGEN_OBJECT_S; } else if (strcmp(name, "gl_ObjectPlaneT") == 0) { - tokens[0] = STATE_TEXGEN_OBJECT_T; + tokens[0] = STATE_TEXGEN; + tokens[2] = STATE_TEXGEN_OBJECT_T; } else if (strcmp(name, "gl_ObjectPlaneR") == 0) { - tokens[0] = STATE_TEXGEN_OBJECT_R; + tokens[0] = STATE_TEXGEN; + tokens[2] = STATE_TEXGEN_OBJECT_R; } else if (strcmp(name, "gl_ObjectPlaneQ") == 0) { - tokens[0] = STATE_TEXGEN_OBJECT_Q; + tokens[0] = STATE_TEXGEN; + tokens[2] = STATE_TEXGEN_OBJECT_Q; } else { return -1; /* invalid array name */ -- cgit v1.2.3 From 16c281dfb537ccad02ab205298e94353c5bb1a2a Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 15:41:36 +0200 Subject: python/regress: Add vertex shader FRC test. --- .../python/tests/regress/vertex-shader/vert-frc.sh | 16 ++++++++++++++++ .../python/tests/regress/vertex-shader/vertex-shader.py | 1 + 2 files changed, 17 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh new file mode 100644 index 00000000000..91c0f9c70dd --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh @@ -0,0 +1,16 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +IMM FLT32 { 2.7, 3.1, 4.5, 1.0 } + +MUL TEMP[0], IN[0].xyxw, IMM[0] +MOV OUT[0], IN[0] +FRC OUT[1], TEMP[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 72ea88b1860..4f7878ee8dc 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -217,6 +217,7 @@ def main(): 'dp4', 'dst', 'ex2', + 'frc', 'mov', 'mul', 'sub', -- cgit v1.2.3 From 4900545bbaff238c75130cf14dd399505a1cde71 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 16:05:29 +0200 Subject: python/regress: Add vertex shader LRP test. --- .../python/tests/regress/vertex-shader/vert-lrp.sh | 14 ++++++++++++++ .../python/tests/regress/vertex-shader/vertex-shader.py | 1 + 2 files changed, 15 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh new file mode 100644 index 00000000000..8c262580e23 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh @@ -0,0 +1,14 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +ABS TEMP[0], IN[0] +MOV OUT[0], IN[0] +LRP OUT[1], TEMP[0], IN[1].xxxx, IN[1].yyyy + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 4f7878ee8dc..97f6240dec5 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -218,6 +218,7 @@ def main(): 'dst', 'ex2', 'frc', + 'lrp', 'mov', 'mul', 'sub', -- cgit v1.2.3 From d11a476ead3e617e45b091f73bd1f67042643a0f Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 1 Apr 2009 22:06:53 +0200 Subject: tgsi: Fix structure members initialisation. --- src/gallium/auxiliary/tgsi/tgsi_info.c | 232 ++++++++++++++++----------------- 1 file changed, 116 insertions(+), 116 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 22034c7a0ba..37f2b66d1f6 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -30,125 +30,125 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { - { 1, 1, 0, 0, "ARL" }, - { 1, 1, 0, 0, "MOV" }, - { 1, 1, 0, 0, "LIT" }, - { 1, 1, 0, 0, "RCP", "RECIP" }, - { 1, 1, 0, 0, "RSQ", "RECIPSQRT" }, - { 1, 1, 0, 0, "EXP", "EXPP" }, - { 1, 1, 0, 0, "LOG" }, - { 1, 2, 0, 0, "MUL" }, - { 1, 2, 0, 0, "ADD" }, - { 1, 2, 0, 0, "DP3", "DOT3" }, - { 1, 2, 0, 0, "DP4", "DOT4" }, - { 1, 2, 0, 0, "DST" }, - { 1, 2, 0, 0, "MIN" }, - { 1, 2, 0, 0, "MAX" }, - { 1, 2, 0, 0, "SLT", "SETLT" }, - { 1, 2, 0, 0, "SGE", "SETGE" }, - { 1, 3, 0, 0, "MAD", "MADD" }, - { 1, 2, 0, 0, "SUB" }, - { 1, 3, 0, 0, "LRP", "LERP" }, - { 1, 3, 0, 0, "CND" }, - { 1, 3, 0, 0, "CND0" }, + { 1, 1, 0, 0, "ARL", NULL, NULL }, + { 1, 1, 0, 0, "MOV", NULL, NULL }, + { 1, 1, 0, 0, "LIT", NULL, NULL }, + { 1, 1, 0, 0, "RCP", "RECIP", NULL }, + { 1, 1, 0, 0, "RSQ", "RECIPSQRT", NULL }, + { 1, 1, 0, 0, "EXP", "EXPP", NULL }, + { 1, 1, 0, 0, "LOG", NULL, NULL }, + { 1, 2, 0, 0, "MUL", NULL, NULL }, + { 1, 2, 0, 0, "ADD", NULL, NULL }, + { 1, 2, 0, 0, "DP3", "DOT3", NULL }, + { 1, 2, 0, 0, "DP4", "DOT4", NULL }, + { 1, 2, 0, 0, "DST", NULL, NULL }, + { 1, 2, 0, 0, "MIN", NULL, NULL }, + { 1, 2, 0, 0, "MAX", NULL, NULL }, + { 1, 2, 0, 0, "SLT", "SETLT", NULL }, + { 1, 2, 0, 0, "SGE", "SETGE", NULL }, + { 1, 3, 0, 0, "MAD", "MADD", NULL }, + { 1, 2, 0, 0, "SUB", NULL, NULL }, + { 1, 3, 0, 0, "LRP", "LERP", NULL }, + { 1, 3, 0, 0, "CND", NULL, NULL }, + { 1, 3, 0, 0, "CND0", NULL, NULL }, { 1, 3, 0, 0, "DP2A", "DP2ADD", "DOT2ADD" }, - { 1, 2, 0, 0, "INDEX" }, - { 1, 1, 0, 0, "NEGATE" }, - { 1, 1, 0, 0, "FRC", "FRAC" }, - { 1, 3, 0, 0, "CLAMP" }, - { 1, 1, 0, 0, "FLR", "FLOOR" }, - { 1, 1, 0, 0, "ROUND" }, - { 1, 1, 0, 0, "EX2", "EXPBASE2" }, + { 1, 2, 0, 0, "INDEX", NULL, NULL }, + { 1, 1, 0, 0, "NEGATE", NULL, NULL }, + { 1, 1, 0, 0, "FRC", "FRAC", NULL }, + { 1, 3, 0, 0, "CLAMP", NULL, NULL }, + { 1, 1, 0, 0, "FLR", "FLOOR", NULL }, + { 1, 1, 0, 0, "ROUND", NULL, NULL }, + { 1, 1, 0, 0, "EX2", "EXPBASE2", NULL }, { 1, 1, 0, 0, "LG2", "LOGBASE2", "LOGP" }, - { 1, 2, 0, 0, "POW", "POWER" }, + { 1, 2, 0, 0, "POW", "POWER", NULL }, { 1, 2, 0, 0, "XPD", "CRS", "CROSSPRODUCT" }, - { 1, 2, 0, 0, "M4X4", "MULTIPLYMATRIX" }, - { 1, 1, 0, 0, "ABS" }, - { 1, 1, 0, 0, "RCC" }, - { 1, 2, 0, 0, "DPH" }, - { 1, 1, 0, 0, "COS" }, - { 1, 1, 0, 0, "DDX", "DSX" }, - { 1, 1, 0, 0, "DDY", "DSY" }, - { 0, 0, 0, 0, "KILP" }, - { 1, 1, 0, 0, "PK2H" }, - { 1, 1, 0, 0, "PK2US" }, - { 1, 1, 0, 0, "PK4B" }, - { 1, 1, 0, 0, "PK4UB" }, - { 1, 2, 0, 0, "RFL" }, - { 1, 2, 0, 0, "SEQ" }, - { 1, 2, 0, 0, "SFL" }, - { 1, 2, 0, 0, "SGT" }, - { 1, 1, 0, 0, "SIN" }, - { 1, 2, 0, 0, "SLE" }, - { 1, 2, 0, 0, "SNE" }, - { 1, 2, 0, 0, "STR" }, - { 1, 2, 1, 0, "TEX", "TEXLD" }, - { 1, 4, 1, 0, "TXD", "TEXLDD" }, - { 1, 2, 1, 0, "TXP" }, - { 1, 1, 0, 0, "UP2H" }, - { 1, 1, 0, 0, "UP2US" }, - { 1, 1, 0, 0, "UP4B" }, - { 1, 1, 0, 0, "UP4UB" }, - { 1, 3, 0, 0, "X2D" }, - { 1, 1, 0, 0, "ARA" }, - { 1, 1, 0, 0, "ARR", "MOVA" }, - { 0, 1, 0, 0, "BRA" }, - { 0, 0, 0, 1, "CAL", "CALL" }, - { 0, 0, 0, 0, "RET" }, - { 1, 1, 0, 0, "SGN", "SSG" }, - { 1, 3, 0, 0, "CMP" }, - { 1, 1, 0, 0, "SCS", "SINCOS" }, - { 1, 2, 1, 0, "TXB", "TEXLDB" }, - { 1, 1, 0, 0, "NRM" }, - { 1, 2, 0, 0, "DIV" }, - { 1, 2, 0, 0, "DP2" }, - { 1, 2, 1, 0, "TXL" }, - { 0, 0, 0, 0, "BRK", "BREAK" }, - { 0, 1, 0, 1, "IF" }, - { 0, 0, 0, 0, "LOOP" }, - { 0, 1, 0, 0, "REP" }, - { 0, 0, 0, 1, "ELSE" }, - { 0, 0, 0, 0, "ENDIF" }, - { 0, 0, 0, 0, "ENDLOOP" }, - { 0, 0, 0, 0, "ENDREP" }, - { 0, 1, 0, 0, "PUSHA" }, - { 1, 0, 0, 0, "POPA" }, - { 1, 1, 0, 0, "CEIL" }, - { 1, 1, 0, 0, "I2F" }, - { 1, 1, 0, 0, "NOT" }, - { 1, 1, 0, 0, "INT", "TRUNC" }, - { 1, 2, 0, 0, "SHL" }, - { 1, 2, 0, 0, "SHR" }, - { 1, 2, 0, 0, "AND" }, - { 1, 2, 0, 0, "OR" }, - { 1, 2, 0, 0, "MOD" }, - { 1, 2, 0, 0, "XOR" }, - { 1, 3, 0, 0, "SAD" }, - { 1, 2, 1, 0, "TXF" }, - { 1, 2, 1, 0, "TXQ" }, - { 0, 0, 0, 0, "CONT" }, - { 0, 0, 0, 0, "EMIT" }, - { 0, 0, 0, 0, "ENDPRIM" }, - { 0, 0, 0, 1, "BGNLOOP2" }, - { 0, 0, 0, 0, "BGNSUB" }, - { 0, 0, 0, 1, "ENDLOOP2" }, - { 0, 0, 0, 0, "ENDSUB" }, - { 1, 1, 0, 0, "NOISE1" }, - { 1, 1, 0, 0, "NOISE2" }, - { 1, 1, 0, 0, "NOISE3" }, - { 1, 1, 0, 0, "NOISE4" }, - { 0, 0, 0, 0, "NOP" }, - { 1, 2, 0, 0, "M4X3" }, - { 1, 2, 0, 0, "M3X4" }, - { 1, 2, 0, 0, "M3X3" }, - { 1, 2, 0, 0, "M3X2" }, - { 1, 1, 0, 0, "NRM4" }, - { 0, 1, 0, 0, "CALLNZ" }, - { 0, 1, 0, 0, "IFC" }, - { 0, 1, 0, 0, "BREAKC" }, - { 0, 1, 0, 0, "KIL", "TEXKILL" }, - { 0, 0, 0, 0, "END" }, - { 1, 1, 0, 0, "SWZ" } + { 1, 2, 0, 0, "M4X4", "MULTIPLYMATRIX", NULL }, + { 1, 1, 0, 0, "ABS", NULL, NULL }, + { 1, 1, 0, 0, "RCC", NULL, NULL }, + { 1, 2, 0, 0, "DPH", NULL, NULL }, + { 1, 1, 0, 0, "COS", NULL, NULL }, + { 1, 1, 0, 0, "DDX", "DSX", NULL }, + { 1, 1, 0, 0, "DDY", "DSY", NULL }, + { 0, 0, 0, 0, "KILP", NULL, NULL }, + { 1, 1, 0, 0, "PK2H", NULL, NULL }, + { 1, 1, 0, 0, "PK2US", NULL, NULL }, + { 1, 1, 0, 0, "PK4B", NULL, NULL }, + { 1, 1, 0, 0, "PK4UB", NULL, NULL }, + { 1, 2, 0, 0, "RFL", NULL, NULL }, + { 1, 2, 0, 0, "SEQ", NULL, NULL }, + { 1, 2, 0, 0, "SFL", NULL, NULL }, + { 1, 2, 0, 0, "SGT", NULL, NULL }, + { 1, 1, 0, 0, "SIN", NULL, NULL }, + { 1, 2, 0, 0, "SLE", NULL, NULL }, + { 1, 2, 0, 0, "SNE", NULL, NULL }, + { 1, 2, 0, 0, "STR", NULL, NULL }, + { 1, 2, 1, 0, "TEX", "TEXLD", NULL }, + { 1, 4, 1, 0, "TXD", "TEXLDD", NULL }, + { 1, 2, 1, 0, "TXP", NULL, NULL }, + { 1, 1, 0, 0, "UP2H", NULL, NULL }, + { 1, 1, 0, 0, "UP2US", NULL, NULL }, + { 1, 1, 0, 0, "UP4B", NULL, NULL }, + { 1, 1, 0, 0, "UP4UB", NULL, NULL }, + { 1, 3, 0, 0, "X2D", NULL, NULL }, + { 1, 1, 0, 0, "ARA", NULL, NULL }, + { 1, 1, 0, 0, "ARR", "MOVA", NULL }, + { 0, 1, 0, 0, "BRA", NULL, NULL }, + { 0, 0, 0, 1, "CAL", "CALL", NULL }, + { 0, 0, 0, 0, "RET", NULL, NULL }, + { 1, 1, 0, 0, "SGN", "SSG", NULL }, + { 1, 3, 0, 0, "CMP", NULL, NULL }, + { 1, 1, 0, 0, "SCS", "SINCOS", NULL }, + { 1, 2, 1, 0, "TXB", "TEXLDB", NULL }, + { 1, 1, 0, 0, "NRM", NULL, NULL }, + { 1, 2, 0, 0, "DIV", NULL, NULL }, + { 1, 2, 0, 0, "DP2", NULL, NULL }, + { 1, 2, 1, 0, "TXL", NULL, NULL }, + { 0, 0, 0, 0, "BRK", "BREAK", NULL }, + { 0, 1, 0, 1, "IF", NULL, NULL }, + { 0, 0, 0, 0, "LOOP", NULL, NULL }, + { 0, 1, 0, 0, "REP", NULL, NULL }, + { 0, 0, 0, 1, "ELSE", NULL, NULL }, + { 0, 0, 0, 0, "ENDIF", NULL, NULL }, + { 0, 0, 0, 0, "ENDLOOP", NULL, NULL }, + { 0, 0, 0, 0, "ENDREP", NULL, NULL }, + { 0, 1, 0, 0, "PUSHA", NULL, NULL }, + { 1, 0, 0, 0, "POPA", NULL, NULL }, + { 1, 1, 0, 0, "CEIL", NULL, NULL }, + { 1, 1, 0, 0, "I2F", NULL, NULL }, + { 1, 1, 0, 0, "NOT", NULL, NULL }, + { 1, 1, 0, 0, "INT", "TRUNC", NULL }, + { 1, 2, 0, 0, "SHL", NULL, NULL }, + { 1, 2, 0, 0, "SHR", NULL, NULL }, + { 1, 2, 0, 0, "AND", NULL, NULL }, + { 1, 2, 0, 0, "OR", NULL, NULL }, + { 1, 2, 0, 0, "MOD", NULL, NULL }, + { 1, 2, 0, 0, "XOR", NULL, NULL }, + { 1, 3, 0, 0, "SAD", NULL, NULL }, + { 1, 2, 1, 0, "TXF", NULL, NULL }, + { 1, 2, 1, 0, "TXQ", NULL, NULL }, + { 0, 0, 0, 0, "CONT", NULL, NULL }, + { 0, 0, 0, 0, "EMIT", NULL, NULL }, + { 0, 0, 0, 0, "ENDPRIM", NULL, NULL }, + { 0, 0, 0, 1, "BGNLOOP2", NULL, NULL }, + { 0, 0, 0, 0, "BGNSUB", NULL, NULL }, + { 0, 0, 0, 1, "ENDLOOP2", NULL, NULL }, + { 0, 0, 0, 0, "ENDSUB", NULL, NULL }, + { 1, 1, 0, 0, "NOISE1", NULL, NULL }, + { 1, 1, 0, 0, "NOISE2", NULL, NULL }, + { 1, 1, 0, 0, "NOISE3", NULL, NULL }, + { 1, 1, 0, 0, "NOISE4", NULL, NULL }, + { 0, 0, 0, 0, "NOP", NULL, NULL }, + { 1, 2, 0, 0, "M4X3", NULL, NULL }, + { 1, 2, 0, 0, "M3X4", NULL, NULL }, + { 1, 2, 0, 0, "M3X3", NULL, NULL }, + { 1, 2, 0, 0, "M3X2", NULL, NULL }, + { 1, 1, 0, 0, "NRM4", NULL, NULL }, + { 0, 1, 0, 0, "CALLNZ", NULL, NULL }, + { 0, 1, 0, 0, "IFC", NULL, NULL }, + { 0, 1, 0, 0, "BREAKC", NULL, NULL }, + { 0, 1, 0, 0, "KIL", "TEXKILL", NULL }, + { 0, 0, 0, 0, "END", NULL, NULL }, + { 1, 1, 0, 0, "SWZ", NULL, NULL } }; const struct tgsi_opcode_info * -- cgit v1.2.3 From 346e12773219b8a514b6cab7a670777c0fb554b6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 1 Apr 2009 21:00:59 +0100 Subject: util: Lookup symbol names from addresses. Nice for stack backtraces. Windows-only for now. --- src/gallium/auxiliary/util/Makefile | 2 + src/gallium/auxiliary/util/SConscript | 1 + src/gallium/auxiliary/util/u_debug_stack.c | 3 +- src/gallium/auxiliary/util/u_debug_symbol.c | 250 ++++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_debug_symbol.h | 53 ++++++ 5 files changed, 308 insertions(+), 1 deletion(-) create mode 100644 src/gallium/auxiliary/util/u_debug_symbol.c create mode 100644 src/gallium/auxiliary/util/u_debug_symbol.h diff --git a/src/gallium/auxiliary/util/Makefile b/src/gallium/auxiliary/util/Makefile index d68bdeadcc8..5035e9cc133 100644 --- a/src/gallium/auxiliary/util/Makefile +++ b/src/gallium/auxiliary/util/Makefile @@ -5,6 +5,8 @@ LIBNAME = util C_SOURCES = \ u_debug.c \ + u_debug_symbol.c \ + u_debug_stack.c \ u_blit.c \ u_cache.c \ u_draw_quad.c \ diff --git a/src/gallium/auxiliary/util/SConscript b/src/gallium/auxiliary/util/SConscript index 0f15c632c3f..8317263bb8b 100644 --- a/src/gallium/auxiliary/util/SConscript +++ b/src/gallium/auxiliary/util/SConscript @@ -10,6 +10,7 @@ util = env.ConvenienceLibrary( 'u_debug_memory.c', 'u_debug_profile.c', 'u_debug_stack.c', + 'u_debug_symbol.c', 'u_draw_quad.c', 'u_gen_mipmap.c', 'u_handle_table.c', diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c index e5d61907c0e..e9891fde8a3 100644 --- a/src/gallium/auxiliary/util/u_debug_stack.c +++ b/src/gallium/auxiliary/util/u_debug_stack.c @@ -33,6 +33,7 @@ */ #include "u_debug.h" +#include "u_debug_symbol.h" #include "u_debug_stack.h" @@ -91,7 +92,7 @@ debug_backtrace_dump(const struct debug_stack_frame *backtrace, for(i = 0; i < nr_frames; ++i) { if(!backtrace[i].function) break; - debug_printf("\t%p\n", backtrace[i].function); + debug_symbol_print(backtrace[i].function); } } diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c new file mode 100644 index 00000000000..7036f6bf968 --- /dev/null +++ b/src/gallium/auxiliary/util/u_debug_symbol.c @@ -0,0 +1,250 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +/** + * @file + * Symbol lookup. + * + * @author Jose Fonseca + */ + +#include "pipe/p_compiler.h" + +#include "u_debug.h" +#include "u_debug_symbol.h" + +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86) + +#include +#include +#include + +/* + * TODO: Cleanup code. + * TODO: Support x86_64 + */ + +static BOOL bSymInitialized = FALSE; + +static HMODULE hModule_Imagehlp = NULL; + +typedef BOOL (WINAPI *PFNSYMINITIALIZE)(HANDLE, LPSTR, BOOL); +static PFNSYMINITIALIZE pfnSymInitialize = NULL; + +static +BOOL WINAPI j_SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess) +{ + if( + (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) && + (pfnSymInitialize || (pfnSymInitialize = (PFNSYMINITIALIZE) GetProcAddress(hModule_Imagehlp, "SymInitialize"))) + ) + return pfnSymInitialize(hProcess, UserSearchPath, fInvadeProcess); + else + return FALSE; +} + +typedef BOOL (WINAPI *PFNSYMCLEANUP)(HANDLE); +static PFNSYMCLEANUP pfnSymCleanup = NULL; + +static +BOOL WINAPI j_SymCleanup(HANDLE hProcess) +{ + if( + (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) && + (pfnSymCleanup || (pfnSymCleanup = (PFNSYMCLEANUP) GetProcAddress(hModule_Imagehlp, "SymCleanup"))) + ) + return pfnSymCleanup(hProcess); + else + return FALSE; +} + +typedef DWORD (WINAPI *PFNSYMSETOPTIONS)(DWORD); +static PFNSYMSETOPTIONS pfnSymSetOptions = NULL; + +static +DWORD WINAPI j_SymSetOptions(DWORD SymOptions) +{ + if( + (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) && + (pfnSymSetOptions || (pfnSymSetOptions = (PFNSYMSETOPTIONS) GetProcAddress(hModule_Imagehlp, "SymSetOptions"))) + ) + return pfnSymSetOptions(SymOptions); + else + return FALSE; +} + +typedef BOOL (WINAPI *PFNSYMUNDNAME)(PIMAGEHLP_SYMBOL, PSTR, DWORD); +static PFNSYMUNDNAME pfnSymUnDName = NULL; + +static +BOOL WINAPI j_SymUnDName(PIMAGEHLP_SYMBOL Symbol, PSTR UnDecName, DWORD UnDecNameLength) +{ + if( + (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) && + (pfnSymUnDName || (pfnSymUnDName = (PFNSYMUNDNAME) GetProcAddress(hModule_Imagehlp, "SymUnDName"))) + ) + return pfnSymUnDName(Symbol, UnDecName, UnDecNameLength); + else + return FALSE; +} + +typedef PFUNCTION_TABLE_ACCESS_ROUTINE PFNSYMFUNCTIONTABLEACCESS; +static PFNSYMFUNCTIONTABLEACCESS pfnSymFunctionTableAccess = NULL; + +static +PVOID WINAPI j_SymFunctionTableAccess(HANDLE hProcess, DWORD AddrBase) +{ + if( + (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) && + (pfnSymFunctionTableAccess || (pfnSymFunctionTableAccess = (PFNSYMFUNCTIONTABLEACCESS) GetProcAddress(hModule_Imagehlp, "SymFunctionTableAccess"))) + ) + return pfnSymFunctionTableAccess(hProcess, AddrBase); + else + return NULL; +} + +typedef PGET_MODULE_BASE_ROUTINE PFNSYMGETMODULEBASE; +static PFNSYMGETMODULEBASE pfnSymGetModuleBase = NULL; + +static +DWORD WINAPI j_SymGetModuleBase(HANDLE hProcess, DWORD dwAddr) +{ + if( + (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) && + (pfnSymGetModuleBase || (pfnSymGetModuleBase = (PFNSYMGETMODULEBASE) GetProcAddress(hModule_Imagehlp, "SymGetModuleBase"))) + ) + return pfnSymGetModuleBase(hProcess, dwAddr); + else + return 0; +} + +typedef BOOL (WINAPI *PFNSTACKWALK)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE); +static PFNSTACKWALK pfnStackWalk = NULL; + +static +BOOL WINAPI j_StackWalk( + DWORD MachineType, + HANDLE hProcess, + HANDLE hThread, + LPSTACKFRAME StackFrame, + PVOID ContextRecord, + PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine, + PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine, + PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine, + PTRANSLATE_ADDRESS_ROUTINE TranslateAddress +) +{ + if( + (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) && + (pfnStackWalk || (pfnStackWalk = (PFNSTACKWALK) GetProcAddress(hModule_Imagehlp, "StackWalk"))) + ) + return pfnStackWalk( + MachineType, + hProcess, + hThread, + StackFrame, + ContextRecord, + ReadMemoryRoutine, + FunctionTableAccessRoutine, + GetModuleBaseRoutine, + TranslateAddress + ); + else + return FALSE; +} + +typedef BOOL (WINAPI *PFNSYMGETSYMFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_SYMBOL); +static PFNSYMGETSYMFROMADDR pfnSymGetSymFromAddr = NULL; + +static +BOOL WINAPI j_SymGetSymFromAddr(HANDLE hProcess, DWORD Address, PDWORD Displacement, PIMAGEHLP_SYMBOL Symbol) +{ + if( + (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) && + (pfnSymGetSymFromAddr || (pfnSymGetSymFromAddr = (PFNSYMGETSYMFROMADDR) GetProcAddress(hModule_Imagehlp, "SymGetSymFromAddr"))) + ) + return pfnSymGetSymFromAddr(hProcess, Address, Displacement, Symbol); + else + return FALSE; +} + +typedef BOOL (WINAPI *PFNSYMGETLINEFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_LINE); +static PFNSYMGETLINEFROMADDR pfnSymGetLineFromAddr = NULL; + +static +BOOL WINAPI j_SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE Line) +{ + if( + (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) && + (pfnSymGetLineFromAddr || (pfnSymGetLineFromAddr = (PFNSYMGETLINEFROMADDR) GetProcAddress(hModule_Imagehlp, "SymGetLineFromAddr"))) + ) + return pfnSymGetLineFromAddr(hProcess, dwAddr, pdwDisplacement, Line); + else + return FALSE; +} + + +static INLINE boolean +debug_symbol_print_imagehlp(const void *addr) +{ + HANDLE hProcess; + BYTE symbolBuffer[1024]; + PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL) symbolBuffer; + DWORD dwDisplacement = 0; // Displacement of the input address, relative to the start of the symbol + + hProcess = GetCurrentProcess(); + + pSymbol->SizeOfStruct = sizeof(symbolBuffer); + pSymbol->MaxNameLength = sizeof(symbolBuffer) - offsetof(IMAGEHLP_SYMBOL, Name); + + if(!bSymInitialized) { + j_SymSetOptions(/* SYMOPT_UNDNAME | */ SYMOPT_LOAD_LINES); + if(j_SymInitialize(hProcess, NULL, TRUE)) + bSymInitialized = TRUE; + } + + if(!j_SymGetSymFromAddr(hProcess, (DWORD)addr, &dwDisplacement, pSymbol)) + return FALSE; + + debug_printf("\t%s\n", pSymbol->Name); + + return TRUE; + +} +#endif + + +void +debug_symbol_print(const void *addr) +{ +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) + if(debug_symbol_print_imagehlp(addr)) + return; +#endif + + debug_printf("\t%p\n", addr); +} diff --git a/src/gallium/auxiliary/util/u_debug_symbol.h b/src/gallium/auxiliary/util/u_debug_symbol.h new file mode 100644 index 00000000000..021586987b6 --- /dev/null +++ b/src/gallium/auxiliary/util/u_debug_symbol.h @@ -0,0 +1,53 @@ +/************************************************************************** + * + * 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 U_DEBUG_SYMBOL_H_ +#define U_DEBUG_SYMBOL_H_ + + +/** + * @file + * Symbol lookup. + * + * @author Jose Fonseca + */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +void +debug_symbol_print(const void *addr); + + +#ifdef __cplusplus +} +#endif + +#endif /* U_DEBUG_SYMBOL_H_ */ -- cgit v1.2.3 From 8d72caea3f10a26e4b11a522f4f973ce61f95127 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 1 Apr 2009 22:05:07 +0100 Subject: util: Fix x86_64 build. --- src/gallium/auxiliary/util/u_debug_symbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c index 7036f6bf968..811931f81b0 100644 --- a/src/gallium/auxiliary/util/u_debug_symbol.c +++ b/src/gallium/auxiliary/util/u_debug_symbol.c @@ -241,7 +241,7 @@ debug_symbol_print_imagehlp(const void *addr) void debug_symbol_print(const void *addr) { -#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86) if(debug_symbol_print_imagehlp(addr)) return; #endif -- cgit v1.2.3 From c4fb791909e687d5af5b95d88ebd6332c82c3095 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 1 Apr 2009 15:14:19 -0700 Subject: r300-gallium: Add vertex shader for surface_copy. --- src/gallium/drivers/r300/r300_state_tcl.h | 13 ++++++++++++ src/gallium/drivers/r300/r300_surface.c | 35 +++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index bc22cd984dd..06767c9b02f 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -79,6 +79,19 @@ static struct r300_vertex_shader r300_passthrough_vertex_shader = { .instructions[1].inst3 = 0x0, }; +static struct r300_vertex_shader r300_texture_vertex_shader = { + /* XXX translate these back into normal instructions */ + .instruction_count = 2, + .instructions[0].inst0 = 0xF00203, + .instructions[0].inst1 = 0xD10001, + .instructions[0].inst2 = 0x1248001, + .instructions[0].inst3 = 0x0, + .instructions[1].inst0 = 0xF00203, + .instructions[1].inst1 = 0xD10061, + .instructions[1].inst2 = 0x1248061, + .instructions[1].inst3 = 0x0, +}; + void r300_translate_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs); diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 8cafe7d1045..ab0ecac35a4 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -39,17 +39,6 @@ static void r300_surface_setup(struct pipe_context* pipe, r300_emit_dsa_state(r300, &dsa_clear_state); r300_emit_rs_state(r300, &rs_clear_state); - /* XXX these magic numbers should be explained when - * this becomes a cached state object */ - if (caps->has_tcl) { - r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader); - } else { - OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) | - R300_PVS_NUM_CNTLRS(5) | - R300_PVS_NUM_FPUS(caps->num_vert_fpus) | - R300_PVS_VF_MAX_VTX_NUM(12)); - } - BEGIN_CS(15); /* Pixel scissors. */ @@ -116,6 +105,18 @@ static void r300_surface_fill(struct pipe_context* pipe, r300_surface_setup(r300, dest, x, y, w, h); + /* Vertex shader setup */ + if (caps->has_tcl) { + r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader); + } else { + BEGIN_CS(2); + OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) | + R300_PVS_NUM_CNTLRS(5) | + R300_PVS_NUM_FPUS(caps->num_vert_fpus) | + R300_PVS_VF_MAX_VTX_NUM(12)); + END_CS; + } + /* Fragment shader setup */ if (caps->is_r500) { r500_emit_fragment_shader(r300, &r500_passthrough_fragment_shader); @@ -222,6 +223,18 @@ static void r300_surface_copy(struct pipe_context* pipe, r300_emit_texture(r300, srctex, 0); r300_flush_textures(r300); + /* Vertex shader setup */ + if (caps->has_tcl) { + r300_emit_vertex_shader(r300, &r300_texture_vertex_shader); + } else { + BEGIN_CS(2); + OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) | + R300_PVS_NUM_CNTLRS(5) | + R300_PVS_NUM_FPUS(caps->num_vert_fpus) | + R300_PVS_VF_MAX_VTX_NUM(12)); + END_CS; + } + /* Fragment shader setup */ if (caps->is_r500) { r500_emit_fragment_shader(r300, &r500_texture_fragment_shader); -- cgit v1.2.3 From 28fa809c9eb9168ab6b80fd66c7cf6ce2b9ccf98 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 1 Apr 2009 15:24:28 -0700 Subject: r300-gallium: Fix compiler warnings. "const" is the right keyword, but I can't do that without adding a bunch of really annoying and ugly const casts everywhere, and frankly, that's really stupid, so instead, just don't make them const. --- src/gallium/drivers/r300/r300_state_shader.h | 8 ++++---- src/gallium/drivers/r300/r300_surface.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index 3c5f036d2ae..76f2989fd13 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -104,7 +104,7 @@ struct r300_fs_asm { void r300_translate_fragment_shader(struct r300_context* r300, struct r3xx_fragment_shader* fs); -static const struct r300_fragment_shader r300_passthrough_fragment_shader = { +static struct r300_fragment_shader r300_passthrough_fragment_shader = { /* XXX This is the emission code. TODO: decode OUT_CS_REG(R300_US_CONFIG, 0); OUT_CS_REG(R300_US_CODE_OFFSET, 0x0); @@ -132,7 +132,7 @@ static const struct r300_fragment_shader r300_passthrough_fragment_shader = { R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT, }; -static const struct r500_fragment_shader r500_passthrough_fragment_shader = { +static struct r500_fragment_shader r500_passthrough_fragment_shader = { .shader.stack_size = 0, .instruction_count = 1, .instructions[0].inst0 = R500_INST_TYPE_OUT | @@ -158,7 +158,7 @@ static const struct r500_fragment_shader r500_passthrough_fragment_shader = { R500_ALU_RGBA_A_SWIZ_0, }; -static const struct r300_fragment_shader r300_texture_fragment_shader = { +static struct r300_fragment_shader r300_texture_fragment_shader = { /* XXX This is the emission code. TODO: decode OUT_CS_REG(R300_US_CONFIG, 0); OUT_CS_REG(R300_US_CODE_OFFSET, 0x0); @@ -186,7 +186,7 @@ static const struct r300_fragment_shader r300_texture_fragment_shader = { R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT, }; -static const struct r500_fragment_shader r500_texture_fragment_shader = { +static struct r500_fragment_shader r500_texture_fragment_shader = { .shader.stack_size = 0, .instruction_count = 1, .instructions[0].inst0 = R500_INST_TYPE_OUT | diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h index aa34054326c..36090882f13 100644 --- a/src/gallium/drivers/r300/r300_surface.h +++ b/src/gallium/drivers/r300/r300_surface.h @@ -35,20 +35,20 @@ #include "r300_state_tcl.h" #include "r300_state_inlines.h" -const struct r300_blend_state blend_clear_state = { +static struct r300_blend_state blend_clear_state = { .blend_control = 0x0, .alpha_blend_control = 0x0, .rop = 0x0, .dither = 0x0, }; -const struct r300_blend_color_state blend_color_clear_state = { +static struct r300_blend_color_state blend_color_clear_state = { .blend_color = 0x0, .blend_color_red_alpha = 0x0, .blend_color_green_blue = 0x0, }; -const struct r300_dsa_state dsa_clear_state = { +static struct r300_dsa_state dsa_clear_state = { .alpha_function = 0x0, .alpha_reference = 0x0, .z_buffer_control = 0x0, @@ -58,7 +58,7 @@ const struct r300_dsa_state dsa_clear_state = { .stencil_ref_bf = 0x0, }; -const struct r300_rs_state rs_clear_state = { +static struct r300_rs_state rs_clear_state = { .point_minmax = 0x36000006, .line_control = 0x00030006, .depth_scale_front = 0x0, @@ -72,7 +72,7 @@ const struct r300_rs_state rs_clear_state = { .color_control = R300_SHADE_MODEL_FLAT, }; -const struct r300_rs_block r300_rs_block_clear_state = { +static struct r300_rs_block r300_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 @@ const struct r300_rs_block r300_rs_block_clear_state = { .inst_count = 0, }; -const struct r300_rs_block r500_rs_block_clear_state = { +static struct r300_rs_block r500_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 @@ const struct r300_rs_block r500_rs_block_clear_state = { /* The following state is used for surface_copy only. */ -const struct r300_rs_block r300_rs_block_copy_state = { +static struct r300_rs_block r300_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 @@ const struct r300_rs_block r300_rs_block_copy_state = { .inst_count = R300_RS_TX_OFFSET(6), }; -const struct r300_rs_block r500_rs_block_copy_state = { +static struct r300_rs_block r500_rs_block_copy_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) | @@ -114,7 +114,7 @@ const struct r300_rs_block r500_rs_block_copy_state = { .inst_count = R300_RS_TX_OFFSET(6), }; -const struct r300_sampler_state r300_sampler_copy_state = { +static struct r300_sampler_state r300_sampler_copy_state = { .filter0 = R300_TX_WRAP_S(R300_TX_CLAMP) | R300_TX_WRAP_T(R300_TX_CLAMP) | R300_TX_MAG_FILTER_NEAREST | -- cgit v1.2.3 From 935e6b19245542d177ab26ced416dd665a79048d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 1 Apr 2009 15:52:32 -0700 Subject: r300-gallium: Translate vertex shader magic numbers. --- src/gallium/drivers/r300/r300_state_tcl.h | 64 ++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index 06767c9b02f..b947f0d1cf6 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -41,7 +41,33 @@ # define R300_PVS_DST_REG_ALT_TEMPORARY 4 # define R300_PVS_DST_REG_INPUT 5 #define R300_PVS_DST_OFFSET(x) ((x) << 13) -#define R300_PVS_DST_WE_SHIFT 20 +#define R300_PVS_DST_WE(x) ((x) << 20) +#define R300_PVS_DST_WE_XYZW (0xf << 20) + +#define R300_PVS_SRC_REG_TYPE(x) ((x) << 0) +# define R300_PVS_SRC_REG_TEMPORARY 0 +# define R300_PVS_SRC_REG_INPUT 1 +# define R300_PVS_SRC_REG_CONSTANT 2 +# define R300_PVS_SRC_REG_ALT_TEMPORARY 3 +#define R300_PVS_SRC_OFFSET(x) ((x) << 5) +#define R300_PVS_SRC_SWIZZLE(x) ((x) << 13) +# define R300_PVS_SRC_SELECT_X 0 +# define R300_PVS_SRC_SELECT_Y 1 +# define R300_PVS_SRC_SELECT_Z 2 +# define R300_PVS_SRC_SELECT_W 3 +# define R300_PVS_SRC_SELECT_FORCE_0 4 +# define R300_PVS_SRC_SELECT_FORCE_1 5 +# define R300_PVS_SRC_SWIZZLE_XYZW \ + ((R300_PVS_SRC_SELECT_X | (R300_PVS_SRC_SELECT_Y << 3) | \ + (R300_PVS_SRC_SELECT_Z << 6) | (R300_PVS_SRC_SELECT_W << 9)) << 13) +# define R300_PVS_SRC_SWIZZLE_ZERO \ + ((R300_PVS_SRC_SELECT_FORCE_0 | (R300_PVS_SRC_SELECT_FORCE_0 << 3) | \ + (R300_PVS_SRC_SELECT_FORCE_0 << 6) | \ + (R300_PVS_SRC_SELECT_FORCE_0 << 9)) << 13) +# define R300_PVS_SRC_SWIZZLE_ONE \ + ((R300_PVS_SRC_SELECT_FORCE_1 | (R300_PVS_SRC_SELECT_FORCE_1 << 3) | \ + (R300_PVS_SRC_SELECT_FORCE_1 << 6) | \ + (R300_PVS_SRC_SELECT_FORCE_1 << 9)) << 13) /* Temporary struct used to hold assembly state while putting together * fragment programs. */ @@ -69,26 +95,38 @@ struct r300_vs_asm { static struct r300_vertex_shader r300_passthrough_vertex_shader = { /* XXX translate these back into normal instructions */ .instruction_count = 2, - .instructions[0].inst0 = 0xF00203, - .instructions[0].inst1 = 0xD10001, - .instructions[0].inst2 = 0x1248001, + .instructions[0].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | + R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) | + R300_PVS_DST_OFFSET(0) | R300_PVS_DST_WE_XYZW, + .instructions[0].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) | + R300_PVS_SRC_OFFSET(0) | R300_PVS_SRC_SWIZZLE_XYZW, + .instructions[0].inst2 = R300_PVS_SRC_SWIZZLE_ZERO, .instructions[0].inst3 = 0x0, - .instructions[1].inst0 = 0xF00203, - .instructions[1].inst1 = 0xD10021, - .instructions[1].inst2 = 0x1248021, + .instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | + R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) | + R300_PVS_DST_OFFSET(2) | R300_PVS_DST_WE_XYZW, + .instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) | + R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW, + .instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO, .instructions[1].inst3 = 0x0, }; static struct r300_vertex_shader r300_texture_vertex_shader = { /* XXX translate these back into normal instructions */ .instruction_count = 2, - .instructions[0].inst0 = 0xF00203, - .instructions[0].inst1 = 0xD10001, - .instructions[0].inst2 = 0x1248001, + .instructions[0].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | + R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) | + R300_PVS_DST_OFFSET(0) | R300_PVS_DST_WE_XYZW, + .instructions[0].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) | + R300_PVS_SRC_OFFSET(0) | R300_PVS_SRC_SWIZZLE_XYZW, + .instructions[0].inst2 = R300_PVS_SRC_SWIZZLE_ZERO, .instructions[0].inst3 = 0x0, - .instructions[1].inst0 = 0xF00203, - .instructions[1].inst1 = 0xD10061, - .instructions[1].inst2 = 0x1248061, + .instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | + R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) | + R300_PVS_DST_OFFSET(6) | R300_PVS_DST_WE_XYZW, + .instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) | + R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW, + .instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO, .instructions[1].inst3 = 0x0, }; -- cgit v1.2.3 From e4b27b4a69f28ca71944fef5f809023bed630a95 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 17:34:16 -0600 Subject: mesa: fix a recursive display list problem This fixes an issue when compiling glCallList() into another display list when the mode is GL_COMPILE_AND_EXECUTE. Before, the call to glCallList() called _mesa_save_CallList() which called neutral_CallList() which then called _mesa_save_CallList() again. In the end, the parent display list contained two calls to the child display list instead of one. Let's be on the lookout for regressions caused by this change for a while before we cherry-pick this elsewhere. --- src/mesa/main/dlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 8f7f703da96..537ff5881f3 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -975,7 +975,7 @@ _mesa_save_CallList(GLuint list) ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; if (ctx->ExecuteFlag) { - CALL_CallList(ctx->Exec, (list)); + _mesa_CallList(list); } } -- cgit v1.2.3 From 9cc79fc2dcdd8e21d9616cc65a931f1f5859fc30 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 18:44:15 -0600 Subject: swrast: fix glDrawBuffer(GL_FRONT_AND_BACK) We weren't putting the right colors into the back buffer in this mode. --- src/mesa/swrast/s_span.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 15a783b236b..08d725c5ebf 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1403,11 +1403,17 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) } /* - * Write to renderbuffers + * Write to renderbuffers. + * Depending on glDrawBuffer() state and the which color outputs are + * written by the fragment shader, we may either replicate one color to + * all renderbuffers or write a different color to each renderbuffer. + * multiFragOutputs=TRUE for the later case. */ { const GLuint numBuffers = fb->_NumColorDrawBuffers; - const GLboolean multiFragOutputs = numBuffers > 1; + const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; + const GLboolean multiFragOutputs = + (fp && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0)); GLuint buf; for (buf = 0; buf < numBuffers; buf++) { -- cgit v1.2.3 From 1ab225017ed1ea8bd9e266d10ee56ab914bb28c1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 18:50:07 -0600 Subject: mesa: use correct tex unit lod bias for TXB instruction --- src/mesa/shader/prog_execute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index a60cda674ba..0bc8d5f6a79 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -1540,8 +1540,8 @@ _mesa_execute_program(GLcontext * ctx, case OPCODE_TXB: /* GL_ARB_fragment_program only */ /* Texel lookup with LOD bias */ { - const struct gl_texture_unit *texUnit - = &ctx->Texture.Unit[inst->TexSrcUnit]; + const GLuint unit = machine->Samplers[inst->TexSrcUnit]; + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLfloat texcoord[4], color[4], lodBias; fetch_vector4(&inst->SrcReg[0], machine, texcoord); -- cgit v1.2.3 From 49fb750a6884c3f647f46270ffce8652f664f908 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 19:50:28 -0600 Subject: glsl: implement compiling/linking of separate compilation units A shader program may consist of multiple shaders (source code units). If we find there are unresolved functions after compiling the unit that defines main(), we'll concatenate all the respective vertex or fragment shaders then recompile. This isn't foolproof but should work in most cases. --- src/mesa/main/mtypes.h | 1 + src/mesa/shader/slang/slang_codegen.c | 19 +++-- src/mesa/shader/slang/slang_codegen.h | 1 + src/mesa/shader/slang/slang_compile.c | 2 + src/mesa/shader/slang/slang_emit.c | 7 +- src/mesa/shader/slang/slang_link.c | 132 +++++++++++++++++++++++++++++----- 6 files changed, 139 insertions(+), 23 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a5d3be3543d..e77dd1d226a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1974,6 +1974,7 @@ struct gl_shader GLboolean DeletePending; GLboolean CompileStatus; GLboolean Main; /**< shader defines main() */ + GLboolean UnresolvedRefs; const GLchar *Source; /**< Source code string */ struct gl_program *Program; /**< Post-compile assembly code */ GLchar *InfoLog; diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index a7cfc45e6f0..6d693c9027a 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2199,12 +2199,13 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, name); return NULL; } + if (!fun->body) { - slang_info_log_error(A->log, - "Function '%s' prototyped but not defined. " - "Separate compilation units not supported.", - name); - return NULL; + /* The function body may be in another compilation unit. + * We'll try concatenating the shaders and recompile at link time. + */ + A->UnresolvedRefs = GL_TRUE; + return new_node1(IR_NOP, NULL); } /* type checking to be sure function's return type matches 'dest' type */ @@ -4648,6 +4649,14 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun) printf("************* End codegen function ************\n\n"); #endif + if (A->UnresolvedRefs) { + /* Can't codegen at this time. + * At link time we'll concatenate all the vertex shaders and/or all + * the fragment shaders and try recompiling. + */ + return GL_TRUE; + } + /* Emit program instructions */ success = _slang_emit_code(n, A->vartable, A->program, A->pragmas, GL_TRUE, A->log); _slang_free_ir_tree(n); diff --git a/src/mesa/shader/slang/slang_codegen.h b/src/mesa/shader/slang/slang_codegen.h index e812c1f7ea5..d80013ad341 100644 --- a/src/mesa/shader/slang/slang_codegen.h +++ b/src/mesa/shader/slang/slang_codegen.h @@ -43,6 +43,7 @@ typedef struct slang_assemble_ctx_ struct slang_ir_node_ *CurLoop; struct slang_function_ *CurFunction; GLuint UnrollLoop; + GLboolean UnresolvedRefs; } slang_assemble_ctx; diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index fb7128841c4..6348f799aa2 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2435,6 +2435,8 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, _slang_codegen_function(&A, mainFunc); shader->Main = GL_TRUE; /* this shader defines main() */ + + shader->UnresolvedRefs = A.UnresolvedRefs; } _slang_pop_var_table(o.vartable); diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 1b1edb44609..8493c490fbc 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -62,6 +62,8 @@ typedef struct GLuint MaxInstructions; /**< size of prog->Instructions[] buffer */ + GLboolean UnresolvedFunctions; + /* code-gen options */ GLboolean EmitHighLevelInstructions; GLboolean EmitCondCodes; @@ -872,6 +874,7 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) emit(emitInfo, n->Children[1]); if (n->Children[0]->Store->Size != n->Children[1]->Store->Size) { + /* XXX this error should have been caught in slang_codegen.c */ slang_info_log_error(emitInfo->log, "invalid operands to == or !="); n->Store = NULL; return NULL; @@ -1356,7 +1359,8 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n) inst = emit(emitInfo, n->Children[1]); if (!n->Children[1]->Store || n->Children[1]->Store->Index < 0) { - if (!emitInfo->log->text) { + if (!emitInfo->log->text && !emitInfo->UnresolvedFunctions) { + /* XXX this error should have been caught in slang_codegen.c */ slang_info_log_error(emitInfo->log, "invalid assignment"); } return NULL; @@ -2155,6 +2159,7 @@ emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n) if (index < 0) { /* error */ char s[100]; + /* XXX isn't this really an out of memory/resources error? */ _mesa_snprintf(s, sizeof(s), "Undefined variable '%s'", (char *) n->Var->a_name); slang_info_log_error(emitInfo->log, s); diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index f98434892b6..e2daf72e7de 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -534,6 +534,106 @@ _slang_update_inputs_outputs(struct gl_program *prog) } + + + +/** + * Return a new shader whose source code is the concatenation of + * all the shader sources of the given type. + */ +static struct gl_shader * +concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) +{ + struct gl_shader *newShader; + const struct gl_shader *firstShader = NULL; + GLuint shaderLengths[100]; + GLchar *source; + GLuint totalLen = 0, len = 0; + GLuint i; + + /* compute total size of new shader source code */ + for (i = 0; i < shProg->NumShaders; i++) { + const struct gl_shader *shader = shProg->Shaders[i]; + if (shader->Type == shaderType) { + shaderLengths[i] = _mesa_strlen(shader->Source); + totalLen += shaderLengths[i]; + if (!firstShader) + firstShader = shader; + } + } + + source = (GLchar *) _mesa_malloc(totalLen + 1); + if (!source) + return NULL; + + /* concatenate shaders */ + for (i = 0; i < shProg->NumShaders; i++) { + const struct gl_shader *shader = shProg->Shaders[i]; + if (shader->Type == shaderType) { + _mesa_memcpy(source + len, shader->Source, shaderLengths[i]); + len += shaderLengths[i]; + } + } + source[len] = '\0'; + /* + _mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source); + */ + + newShader = CALLOC_STRUCT(gl_shader); + newShader->Type = shaderType; + newShader->Source = source; + newShader->Pragmas = firstShader->Pragmas; + + return newShader; +} + + +/** + * Search the shader program's list of shaders to find the one that + * defines main(). + * This will involve shader concatenation and recompilation if needed. + */ +static struct gl_shader * +get_main_shader(GLcontext *ctx, + struct gl_shader_program *shProg, GLenum type) +{ + struct gl_shader *shader = NULL; + GLuint i; + + /* + * Look for a shader that defines main() and has no unresolved references. + */ + for (i = 0; i < shProg->NumShaders; i++) { + shader = shProg->Shaders[i]; + if (shader->Type == type && + shader->Main && + !shader->UnresolvedRefs) { + /* All set! */ + return shader; + } + } + + /* + * There must have been unresolved references during the original + * compilation. Try concatenating all the shaders of the given type + * and recompile that. + */ + shader = concat_shaders(shProg, type); + + _slang_compile(ctx, shader); + + /* Finally, check if recompiling failed */ + if (!shader->CompileStatus || + !shader->Main || + shader->UnresolvedRefs) { + link_error(shProg, "Unresolved symbols"); + return NULL; + } + + return shader; +} + + /** * Shader linker. Currently: * @@ -557,6 +657,9 @@ _slang_link(GLcontext *ctx, _mesa_clear_shader_program_data(ctx, shProg); + /* Initialize LinkStatus to "success". Will be cleared if error. */ + shProg->LinkStatus = GL_TRUE; + /* check that all programs compiled successfully */ for (i = 0; i < shProg->NumShaders; i++) { if (!shProg->Shaders[i]->CompileStatus) { @@ -568,24 +671,19 @@ _slang_link(GLcontext *ctx, shProg->Uniforms = _mesa_new_uniform_list(); shProg->Varying = _mesa_new_parameter_list(); - /** - * Find attached vertex, fragment shaders defining main() + /* + * Find the vertex and fragment shaders which define main() */ - vertProg = NULL; - fragProg = NULL; - for (i = 0; i < shProg->NumShaders; i++) { - struct gl_shader *shader = shProg->Shaders[i]; - if (shader->Type == GL_VERTEX_SHADER) { - if (shader->Main) - vertProg = vertex_program(shader->Program); - } - else if (shader->Type == GL_FRAGMENT_SHADER) { - if (shader->Main) - fragProg = fragment_program(shader->Program); - } - else { - _mesa_problem(ctx, "unexpected shader target in slang_link()"); - } + { + struct gl_shader *vertShader, *fragShader; + vertShader = get_main_shader(ctx, shProg, GL_VERTEX_SHADER); + fragShader = get_main_shader(ctx, shProg, GL_FRAGMENT_SHADER); + if (vertShader) + vertProg = vertex_program(vertShader->Program); + if (fragShader) + fragProg = fragment_program(fragShader->Program); + if (!shProg->LinkStatus) + return; } #if FEATURE_es2_glsl -- cgit v1.2.3 From f8304bf1ed27dc87f52593a437785f2793344767 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 19:53:40 -0600 Subject: demos: added progs/glsl/linktest.c to test linking of separate compilation units --- progs/glsl/Makefile | 7 ++ progs/glsl/linktest.c | 258 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 265 insertions(+) create mode 100644 progs/glsl/linktest.c diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile index 80612770332..0f1a299570f 100644 --- a/progs/glsl/Makefile +++ b/progs/glsl/Makefile @@ -17,6 +17,7 @@ PROGS = \ deriv \ identity \ fragcoord \ + linktest \ mandelbrot \ multinoise \ multitex \ @@ -128,6 +129,12 @@ fragcoord: fragcoord.o shaderutil.o $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) fragcoord.o shaderutil.o $(LIBS) -o $@ +linktest.o: linktest.c extfuncs.h shaderutil.h + $(APP_CC) -c -I$(INCDIR) $(CFLAGS) linktest.c + +linktest: linktest.o shaderutil.o + $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) linktest.o shaderutil.o $(LIBS) -o $@ + mandelbrot.o: mandelbrot.c extfuncs.h shaderutil.h $(APP_CC) -c -I$(INCDIR) $(CFLAGS) mandelbrot.c diff --git a/progs/glsl/linktest.c b/progs/glsl/linktest.c new file mode 100644 index 00000000000..601b24e893e --- /dev/null +++ b/progs/glsl/linktest.c @@ -0,0 +1,258 @@ +/** + * Test linking of multiple compilation units. + * Brian Paul + * 28 March 2009 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "extfuncs.h" +#include "shaderutil.h" + + +static GLfloat diffuse[4] = { 0.5f, 1.0f, 0.5f, 1.0f }; +static GLfloat specular[4] = { 0.8f, 0.8f, 0.8f, 1.0f }; +static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 0.0f }; +static GLfloat delta = 1.0f; + +static GLuint VertShader1; +static GLuint VertShader2; +static GLuint FragShader1; +static GLuint FragShader2; +static GLuint Program; + +static GLint uDiffuse; +static GLint uSpecular; +static GLint uTexture; + +static GLint Win = 0; +static GLboolean anim = GL_TRUE; + + + +static const char *FragShaderSource1 = + "float compute_dotprod(const vec3 normal) \n" + "{ \n" + " float dotProd = max(dot(gl_LightSource[0].position.xyz, \n" + " normalize(normal)), 0.0); \n" + " return dotProd; \n" + "} \n"; + +static const char *FragShaderSource2 = + "uniform vec4 diffuse;\n" + "uniform vec4 specular;\n" + "varying vec3 normal;\n" + "\n" + "// external function \n" + "float compute_dotprod(const vec3 normal); \n" + "\n" + "void main() \n" + "{ \n" + " float dotProd = compute_dotprod(normal); \n" + " gl_FragColor = diffuse * dotProd + specular * pow(dotProd, 20.0); \n" + "} \n"; + + +static const char *VertShaderSource1 = + "vec3 compute_normal() \n" + "{ \n" + " return gl_NormalMatrix * gl_Normal; \n" + "} \n"; + +static const char *VertShaderSource2 = + "varying vec3 normal;\n" + "\n" + "// external function \n" + "vec3 compute_normal(); \n" + "\n" + "void main() \n" + "{ \n" + " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n" + " normal = compute_normal(); \n" + "} \n"; + + +static void +normalize(GLfloat *dst, const GLfloat *src) +{ + GLfloat len = sqrt(src[0] * src[0] + src[1] * src[1] + src[2] * src[2]); + dst[0] = src[0] / len; + dst[1] = src[1] / len; + dst[2] = src[2] / len; + dst[3] = src[3]; +} + + +static void +Redisplay(void) +{ + GLfloat vec[4]; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + /* update light position */ + normalize(vec, lightPos); + glLightfv(GL_LIGHT0, GL_POSITION, vec); + + glutSolidSphere(2.0, 10, 5); + + glutSwapBuffers(); +} + + +static void +Idle(void) +{ + lightPos[0] += delta; + if (lightPos[0] > 25.0f || lightPos[0] < -25.0f) + delta = -delta; + glutPostRedisplay(); +} + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0f, 0.0f, -15.0f); +} + + +static void +CleanUp(void) +{ + glDeleteShader_func(VertShader1); + glDeleteShader_func(VertShader2); + glDeleteShader_func(FragShader1); + glDeleteShader_func(FragShader2); + glDeleteProgram_func(Program); + glutDestroyWindow(Win); +} + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + + switch(key) { + case ' ': + case 'a': + anim = !anim; + if (anim) + glutIdleFunc(Idle); + else + glutIdleFunc(NULL); + break; + case 'x': + lightPos[0] -= 1.0f; + break; + case 'X': + lightPos[0] += 1.0f; + break; + case 27: + CleanUp(); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +CheckLink(GLuint prog) +{ + GLint stat; + glGetProgramiv_func(prog, GL_LINK_STATUS, &stat); + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetProgramInfoLog_func(prog, 1000, &len, log); + fprintf(stderr, "Linker error:\n%s\n", log); + } +} + + +static void +Init(void) +{ + if (!ShadersSupported()) + exit(1); + + GetExtensionFuncs(); + + printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); + + VertShader1 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource1); + VertShader2 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource2); + FragShader1 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource1); + FragShader2 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource2); + + Program = glCreateProgram_func(); + glAttachShader_func(Program, VertShader1); + glAttachShader_func(Program, VertShader2); + glAttachShader_func(Program, FragShader1); + glAttachShader_func(Program, FragShader2); + + glLinkProgram_func(Program); + + CheckLink(Program); + + glUseProgram_func(Program); + + uDiffuse = glGetUniformLocation_func(Program, "diffuse"); + uSpecular = glGetUniformLocation_func(Program, "specular"); + uTexture = glGetUniformLocation_func(Program, "texture"); + printf("DiffusePos %d SpecularPos %d TexturePos %d\n", + uDiffuse, uSpecular, uTexture); + + glUniform4fv_func(uDiffuse, 1, diffuse); + glUniform4fv_func(uSpecular, 1, specular); + + glClearColor(0.3f, 0.3f, 0.3f, 0.0f); + glEnable(GL_DEPTH_TEST); + + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0f); + + assert(glIsProgram_func(Program)); + assert(glIsShader_func(VertShader1)); + assert(glIsShader_func(VertShader2)); + assert(glIsShader_func(FragShader1)); + assert(glIsShader_func(FragShader2)); + + glColor3f(1, 0, 0); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowPosition( 0, 0); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + Win = glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Redisplay); + if (anim) + glutIdleFunc(Idle); + Init(); + glutMainLoop(); + return 0; +} + + -- cgit v1.2.3 From de2afd8688ceb45013d15be7c6e0995199b80e5a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 8 Mar 2009 13:49:57 -0600 Subject: swrast: do texture sampling/combining in floating point The code's cleaner and a step toward supporting float-valued texture sampling. Some optimizations for common cases can be added and re-enabled... --- src/mesa/main/colormac.h | 9 - src/mesa/swrast/s_atifragshader.c | 7 +- src/mesa/swrast/s_context.c | 4 +- src/mesa/swrast/s_context.h | 4 +- src/mesa/swrast/s_fragprog.c | 19 +- src/mesa/swrast/s_texcombine.c | 827 +++++++++++++++----------------------- src/mesa/swrast/s_texfilter.c | 414 +++++++++---------- src/mesa/tnl/t_vb_program.c | 7 +- 8 files changed, 512 insertions(+), 779 deletions(-) diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h index 74692e9a988..815624ee508 100644 --- a/src/mesa/main/colormac.h +++ b/src/mesa/main/colormac.h @@ -71,9 +71,6 @@ /** \def COPY_CHAN4 * Copy a GLchan[4] array */ -/** \def CHAN_PRODUCT - * Scaled product (usually approximated) between two GLchan arguments */ - #if CHAN_BITS == 8 #define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (GLchan) (b)) @@ -91,8 +88,6 @@ #define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC) -#define CHAN_PRODUCT(a, b) ((GLubyte) (((GLint)(a) * ((GLint)(b) + 1)) >> 8)) - #elif CHAN_BITS == 16 #define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (((GLchan) (b)) * 516)) @@ -110,8 +105,6 @@ #define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC) -#define CHAN_PRODUCT(a, b) ((GLchan) ((((GLuint) (a)) * ((GLuint) (b))) / 65535)) - #elif CHAN_BITS == 32 /* XXX floating-point color channels not fully thought-out */ @@ -130,8 +123,6 @@ #define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC) -#define CHAN_PRODUCT(a, b) ((a) * (b)) - #else #error unexpected CHAN_BITS size diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c index 458fe18163e..5fefae6c42b 100644 --- a/src/mesa/swrast/s_atifragshader.c +++ b/src/mesa/swrast/s_atifragshader.c @@ -47,17 +47,12 @@ static void fetch_texel(GLcontext * ctx, const GLfloat texcoord[4], GLfloat lambda, GLuint unit, GLfloat color[4]) { - GLchan rgba[4]; SWcontext *swrast = SWRAST_CONTEXT(ctx); /* XXX use a float-valued TextureSample routine here!!! */ swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current, 1, (const GLfloat(*)[4]) texcoord, - &lambda, &rgba); - color[0] = CHAN_TO_FLOAT(rgba[0]); - color[1] = CHAN_TO_FLOAT(rgba[1]); - color[2] = CHAN_TO_FLOAT(rgba[2]); - color[3] = CHAN_TO_FLOAT(rgba[3]); + &lambda, (GLfloat (*)[4]) color); } static void diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 4dbccbb2d59..0257abc34ac 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -820,8 +820,8 @@ _swrast_CreateContext( GLcontext *ctx ) swrast->PointSpan.facing = 0; swrast->PointSpan.array = swrast->SpanArrays; - swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureImageUnits * - MAX_WIDTH * 4 * sizeof(GLchan)); + swrast->TexelBuffer = (GLfloat *) MALLOC(ctx->Const.MaxTextureImageUnits * + MAX_WIDTH * 4 * sizeof(GLfloat)); if (!swrast->TexelBuffer) { FREE(swrast->SpanArrays); FREE(swrast); diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index 6e8d080704d..4cf57c6fc67 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -52,7 +52,7 @@ typedef void (*texture_sample_func)(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]); + const GLfloat lambda[], GLfloat rgba[][4]); typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[], @@ -221,7 +221,7 @@ typedef struct /** Buffer for saving the sampled texture colors. * Needed for GL_ARB_texture_env_crossbar implementation. */ - GLchan *TexelBuffer; + GLfloat *TexelBuffer; validate_texture_image_func ValidateTextureImage; diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index ae1dea16a07..5f032bbd69d 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -37,20 +37,17 @@ * and return results in 'colorOut'. */ static INLINE void -swizzle_texel(const GLchan texel[4], GLfloat colorOut[4], GLuint swizzle) +swizzle_texel(const GLfloat texel[4], GLfloat colorOut[4], GLuint swizzle) { if (swizzle == SWIZZLE_NOOP) { - colorOut[0] = CHAN_TO_FLOAT(texel[0]); - colorOut[1] = CHAN_TO_FLOAT(texel[1]); - colorOut[2] = CHAN_TO_FLOAT(texel[2]); - colorOut[3] = CHAN_TO_FLOAT(texel[3]); + COPY_4V(colorOut, texel); } else { GLfloat vector[6]; - vector[SWIZZLE_X] = CHAN_TO_FLOAT(texel[0]); - vector[SWIZZLE_Y] = CHAN_TO_FLOAT(texel[1]); - vector[SWIZZLE_Z] = CHAN_TO_FLOAT(texel[2]); - vector[SWIZZLE_W] = CHAN_TO_FLOAT(texel[3]); + vector[SWIZZLE_X] = texel[0]; + vector[SWIZZLE_Y] = texel[1]; + vector[SWIZZLE_Z] = texel[2]; + vector[SWIZZLE_W] = texel[3]; vector[SWIZZLE_ZERO] = 0.0F; vector[SWIZZLE_ONE] = 1.0F; colorOut[0] = vector[GET_SWZ(swizzle, 0)]; @@ -73,7 +70,7 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, if (texObj) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLchan rgba[4]; + GLfloat rgba[4]; lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); @@ -108,7 +105,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], const GLfloat texW = (GLfloat) texImg->WidthScale; const GLfloat texH = (GLfloat) texImg->HeightScale; GLfloat lambda; - GLchan rgba[4]; + GLfloat rgba[4]; lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */ texdx[1], texdy[1], /* dt/dx, dt/dy */ diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index aa28311672d..c48a6fb1141 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -37,13 +37,7 @@ #include "s_texcombine.h" -#define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) ) -#define S_PROD(A,B) ( (GLint)(A) * ((GLint)(B)+1) ) -#if CHAN_BITS == 32 -typedef GLfloat ChanTemp; -#else -typedef GLuint ChanTemp; -#endif +#define MAX_COMBINER_TERMS 4 /** @@ -63,32 +57,36 @@ typedef GLuint ChanTemp; */ static void texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, - CONST GLchan (*primary_rgba)[4], - CONST GLchan *texelBuffer, - GLchan (*rgba)[4] ) + CONST GLfloat (*primary_rgba)[4], + CONST GLfloat *texelBuffer, + GLchan (*rgbaChan)[4] ) { const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]); - const GLchan (*argRGB [4])[4]; - const GLchan (*argA [4])[4]; + const GLfloat (*argRGB [MAX_COMBINER_TERMS])[4]; + const GLfloat (*argA [MAX_COMBINER_TERMS])[4]; const GLint RGBshift = textureUnit->_CurrentCombine->ScaleShiftRGB; const GLuint Ashift = textureUnit->_CurrentCombine->ScaleShiftA; -#if CHAN_TYPE == GL_FLOAT - const GLchan RGBmult = (GLfloat) (1 << RGBshift); - const GLchan Amult = (GLfloat) (1 << Ashift); -#else - const GLint half = (CHAN_MAX + 1) / 2; -#endif - static const GLchan one[4] = { CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX }; - static const GLchan zero[4] = { 0, 0, 0, 0 }; + const GLfloat RGBmult = (GLfloat) (1 << RGBshift); + const GLfloat Amult = (GLfloat) (1 << Ashift); + static const GLfloat one[4] = { 1, 1, 1, 1 }; + static const GLfloat zero[4] = { 0, 0, 0, 0 }; const GLuint numColorArgs = textureUnit->_CurrentCombine->_NumArgsRGB; const GLuint numAlphaArgs = textureUnit->_CurrentCombine->_NumArgsA; - GLchan ccolor[4][MAX_WIDTH][4]; + GLfloat ccolor[MAX_COMBINER_TERMS][MAX_WIDTH][4]; /* temp color buffers */ + GLfloat rgba[MAX_WIDTH][4]; GLuint i, j; ASSERT(ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine); ASSERT(CONST_SWRAST_CONTEXT(ctx)->_AnyTextureCombine); + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = CHAN_TO_FLOAT(rgbaChan[i][RCOMP]); + rgba[i][GCOMP] = CHAN_TO_FLOAT(rgbaChan[i][GCOMP]); + rgba[i][BCOMP] = CHAN_TO_FLOAT(rgbaChan[i][BCOMP]); + rgba[i][ACOMP] = CHAN_TO_FLOAT(rgbaChan[i][ACOMP]); + } + /* printf("modeRGB 0x%x modeA 0x%x srcRGB1 0x%x srcA1 0x%x srcRGB2 0x%x srcA2 0x%x\n", textureUnit->_CurrentCombine->ModeRGB, @@ -107,39 +105,47 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (srcRGB) { case GL_TEXTURE: - argRGB[j] = (const GLchan (*)[4]) - (texelBuffer + unit * (n * 4 * sizeof(GLchan))); + argRGB[j] = (const GLfloat (*)[4]) + (texelBuffer + unit * (n * 4 * sizeof(GLfloat))); break; case GL_PRIMARY_COLOR: argRGB[j] = primary_rgba; break; case GL_PREVIOUS: - argRGB[j] = (const GLchan (*)[4]) rgba; + argRGB[j] = (const GLfloat (*)[4]) rgba; break; case GL_CONSTANT: { - GLchan (*c)[4] = ccolor[j]; - GLchan red, green, blue, alpha; - UNCLAMPED_FLOAT_TO_CHAN(red, textureUnit->EnvColor[0]); - UNCLAMPED_FLOAT_TO_CHAN(green, textureUnit->EnvColor[1]); - UNCLAMPED_FLOAT_TO_CHAN(blue, textureUnit->EnvColor[2]); - UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); + GLfloat (*c)[4] = ccolor[j]; + GLfloat red = textureUnit->EnvColor[0]; + GLfloat green = textureUnit->EnvColor[1]; + GLfloat blue = textureUnit->EnvColor[2]; + GLfloat alpha = textureUnit->EnvColor[3]; for (i = 0; i < n; i++) { - c[i][RCOMP] = red; - c[i][GCOMP] = green; - c[i][BCOMP] = blue; - c[i][ACOMP] = alpha; + ASSIGN_4V(c[i], red, green, blue, alpha); } - argRGB[j] = (const GLchan (*)[4]) ccolor[j]; + argRGB[j] = (const GLfloat (*)[4]) ccolor[j]; } break; /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. */ case GL_ZERO: - argRGB[j] = & zero; + { + GLfloat (*c)[4] = ccolor[j]; + for (i = 0; i < n; i++) { + ASSIGN_4V(c[i], 0.0F, 0.0F, 0.0F, 0.0F); + } + argRGB[j] = (const GLfloat (*)[4]) ccolor[j]; + } break; case GL_ONE: - argRGB[j] = & one; + { + GLfloat (*c)[4] = ccolor[j]; + for (i = 0; i < n; i++) { + ASSIGN_4V(c[i], 1.0F, 1.0F, 1.0F, 1.0F); + } + argRGB[j] = (const GLfloat (*)[4]) ccolor[j]; + } break; default: /* ARB_texture_env_crossbar source */ @@ -148,23 +154,23 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; - argRGB[j] = (const GLchan (*)[4]) - (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); + argRGB[j] = (const GLfloat (*)[4]) + (texelBuffer + srcUnit * (n * 4 * sizeof(GLfloat))); } } if (textureUnit->_CurrentCombine->OperandRGB[j] != GL_SRC_COLOR) { - const GLchan (*src)[4] = argRGB[j]; - GLchan (*dst)[4] = ccolor[j]; + const GLfloat (*src)[4] = argRGB[j]; + GLfloat (*dst)[4] = ccolor[j]; /* point to new arg[j] storage */ - argRGB[j] = (const GLchan (*)[4]) ccolor[j]; + argRGB[j] = (const GLfloat (*)[4]) ccolor[j]; if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_ONE_MINUS_SRC_COLOR) { for (i = 0; i < n; i++) { - dst[i][RCOMP] = CHAN_MAX - src[i][RCOMP]; - dst[i][GCOMP] = CHAN_MAX - src[i][GCOMP]; - dst[i][BCOMP] = CHAN_MAX - src[i][BCOMP]; + dst[i][RCOMP] = 1.0F - src[i][RCOMP]; + dst[i][GCOMP] = 1.0F - src[i][GCOMP]; + dst[i][BCOMP] = 1.0F - src[i][BCOMP]; } } else if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_SRC_ALPHA) { @@ -177,9 +183,9 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, else { ASSERT(textureUnit->_CurrentCombine->OperandRGB[j] ==GL_ONE_MINUS_SRC_ALPHA); for (i = 0; i < n; i++) { - dst[i][RCOMP] = CHAN_MAX - src[i][ACOMP]; - dst[i][GCOMP] = CHAN_MAX - src[i][ACOMP]; - dst[i][BCOMP] = CHAN_MAX - src[i][ACOMP]; + dst[i][RCOMP] = 1.0F - src[i][ACOMP]; + dst[i][GCOMP] = 1.0F - src[i][ACOMP]; + dst[i][BCOMP] = 1.0F - src[i][ACOMP]; } } } @@ -193,22 +199,22 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (srcA) { case GL_TEXTURE: - argA[j] = (const GLchan (*)[4]) - (texelBuffer + unit * (n * 4 * sizeof(GLchan))); + argA[j] = (const GLfloat (*)[4]) + (texelBuffer + unit * (n * 4 * sizeof(GLfloat))); break; case GL_PRIMARY_COLOR: argA[j] = primary_rgba; break; case GL_PREVIOUS: - argA[j] = (const GLchan (*)[4]) rgba; + argA[j] = (const GLfloat (*)[4]) rgba; break; case GL_CONSTANT: { - GLchan alpha, (*c)[4] = ccolor[j]; - UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); + GLfloat alpha, (*c)[4] = ccolor[j]; + alpha = textureUnit->EnvColor[3]; for (i = 0; i < n; i++) c[i][ACOMP] = alpha; - argA[j] = (const GLchan (*)[4]) ccolor[j]; + argA[j] = (const GLfloat (*)[4]) ccolor[j]; } break; /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. @@ -226,17 +232,17 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; - argA[j] = (const GLchan (*)[4]) - (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); + argA[j] = (const GLfloat (*)[4]) + (texelBuffer + srcUnit * (n * 4 * sizeof(GLfloat))); } } if (textureUnit->_CurrentCombine->OperandA[j] == GL_ONE_MINUS_SRC_ALPHA) { - const GLchan (*src)[4] = argA[j]; - GLchan (*dst)[4] = ccolor[j]; - argA[j] = (const GLchan (*)[4]) ccolor[j]; + const GLfloat (*src)[4] = argA[j]; + GLfloat (*dst)[4] = ccolor[j]; + argA[j] = (const GLfloat (*)[4]) ccolor[j]; for (i = 0; i < n; i++) { - dst[i][ACOMP] = CHAN_MAX - src[i][ACOMP]; + dst[i][ACOMP] = 1.0F - src[i][ACOMP]; } } } @@ -247,21 +253,12 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (textureUnit->_CurrentCombine->ModeRGB) { case GL_REPLACE: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; if (RGBshift) { for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult; rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult; rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult; -#else - GLuint r = (GLuint) arg0[i][RCOMP] << RGBshift; - GLuint g = (GLuint) arg0[i][GCOMP] << RGBshift; - GLuint b = (GLuint) arg0[i][BCOMP] << RGBshift; - rgba[i][RCOMP] = MIN2(r, CHAN_MAX); - rgba[i][GCOMP] = MIN2(g, CHAN_MAX); - rgba[i][BCOMP] = MIN2(b, CHAN_MAX); -#endif } } else { @@ -275,179 +272,91 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, break; case GL_MODULATE: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - RGBshift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult; rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult; rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult; -#else - GLuint r = PROD(arg0[i][RCOMP], arg1[i][RCOMP]) >> shift; - GLuint g = PROD(arg0[i][GCOMP], arg1[i][GCOMP]) >> shift; - GLuint b = PROD(arg0[i][BCOMP], arg1[i][BCOMP]) >> shift; - rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); -#endif } } break; case GL_ADD: if (textureUnit->EnvMode == GL_COMBINE4_NV) { /* (a * b) + (c * d) */ - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; - const GLchan (*arg3)[4] = (const GLchan (*)[4]) argRGB[3]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; + const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argRGB[3]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] + arg2[i][RCOMP] * arg3[i][RCOMP]) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] + arg2[i][GCOMP] * arg3[i][GCOMP]) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] + arg2[i][BCOMP] * arg3[i][BCOMP]) * RGBmult; -#else - const GLint shift = CHAN_BITS - RGBshift; - GLint r = (PROD(arg0[i][RCOMP], arg1[i][RCOMP]) >> shift) + - (PROD(arg2[i][RCOMP], arg3[i][RCOMP]) >> shift); - GLint g = (PROD(arg0[i][GCOMP], arg1[i][GCOMP]) >> shift) + - (PROD(arg2[i][GCOMP], arg3[i][GCOMP]) >> shift); - GLint b = (PROD(arg0[i][BCOMP], arg1[i][BCOMP]) >> shift) + - (PROD(arg2[i][BCOMP], arg3[i][BCOMP]) >> shift); - rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); -#endif } } else { /* 2-term addition */ - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * RGBmult; -#else - GLint r = ((GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP]) << RGBshift; - GLint g = ((GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP]) << RGBshift; - GLint b = ((GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP]) << RGBshift; - rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); -#endif } } break; case GL_ADD_SIGNED: if (textureUnit->EnvMode == GL_COMBINE4_NV) { /* (a * b) + (c * d) - 0.5 */ - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; - const GLchan (*arg3)[4] = (const GLchan (*)[4]) argRGB[3]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; + const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argRGB[3]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] * arg2[i][RCOMP] + arg3[i][RCOMP] - 0.5) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] * arg2[i][GCOMP] + arg3[i][GCOMP] - 0.5) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] * arg2[i][BCOMP] + arg3[i][BCOMP] - 0.5) * RGBmult; -#else - GLint r = (((PROD(arg0[i][RCOMP], arg1[i][RCOMP]) + - PROD(arg2[i][RCOMP], arg3[i][RCOMP])) >> CHAN_BITS) - half) - << RGBshift; - GLint g = (((PROD(arg0[i][GCOMP], arg1[i][GCOMP]) + - PROD(arg2[i][GCOMP], arg3[i][GCOMP])) >> CHAN_BITS) - half) - << RGBshift; - GLint b = (((PROD(arg0[i][BCOMP], arg1[i][BCOMP]) + - PROD(arg2[i][BCOMP], arg3[i][BCOMP])) >> CHAN_BITS) - half) - << RGBshift; - rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); -#endif } } else { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * RGBmult; -#else - GLint r = (GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP] - half; - GLint g = (GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP] - half; - GLint b = (GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP] - half; - r = (r < 0) ? 0 : r << RGBshift; - g = (g < 0) ? 0 : g << RGBshift; - b = (b < 0) ? 0 : b << RGBshift; - rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); -#endif } } break; case GL_INTERPOLATE: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - RGBshift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] + - arg1[i][RCOMP] * (CHAN_MAXF - arg2[i][RCOMP])) * RGBmult; + arg1[i][RCOMP] * (1.0F - arg2[i][RCOMP])) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] + - arg1[i][GCOMP] * (CHAN_MAXF - arg2[i][GCOMP])) * RGBmult; + arg1[i][GCOMP] * (1.0F - arg2[i][GCOMP])) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] + - arg1[i][BCOMP] * (CHAN_MAXF - arg2[i][BCOMP])) * RGBmult; -#else - GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP]) - + PROD(arg1[i][RCOMP], CHAN_MAX - arg2[i][RCOMP])) - >> shift; - GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP]) - + PROD(arg1[i][GCOMP], CHAN_MAX - arg2[i][GCOMP])) - >> shift; - GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP]) - + PROD(arg1[i][BCOMP], CHAN_MAX - arg2[i][BCOMP])) - >> shift; - rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); -#endif + arg1[i][BCOMP] * (1.0F - arg2[i][BCOMP])) * RGBmult; } } break; case GL_SUBTRACT: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult; -#else - GLint r = ((GLint) arg0[i][RCOMP] - (GLint) arg1[i][RCOMP]) << RGBshift; - GLint g = ((GLint) arg0[i][GCOMP] - (GLint) arg1[i][GCOMP]) << RGBshift; - GLint b = ((GLint) arg0[i][BCOMP] - (GLint) arg1[i][BCOMP]) << RGBshift; - rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); -#endif } } break; @@ -455,25 +364,15 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, case GL_DOT3_RGBA_EXT: { /* Do not scale the result by 1 2 or 4 */ - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT - GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + + GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) * 4.0F; - dot = CLAMP(dot, 0.0F, CHAN_MAXF); -#else - GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half, - (GLint)arg1[i][RCOMP] - half) + - S_PROD((GLint)arg0[i][GCOMP] - half, - (GLint)arg1[i][GCOMP] - half) + - S_PROD((GLint)arg0[i][BCOMP] - half, - (GLint)arg1[i][BCOMP] - half)) >> 6; - dot = CLAMP(dot, 0, CHAN_MAX); -#endif - rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot; + dot = CLAMP(dot, 0.0F, 1.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; } } break; @@ -481,113 +380,60 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, case GL_DOT3_RGBA: { /* DO scale the result by 1 2 or 4 */ - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT - GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + + GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) * 4.0F * RGBmult; - dot = CLAMP(dot, 0.0, CHAN_MAXF); -#else - GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half, - (GLint)arg1[i][RCOMP] - half) + - S_PROD((GLint)arg0[i][GCOMP] - half, - (GLint)arg1[i][GCOMP] - half) + - S_PROD((GLint)arg0[i][BCOMP] - half, - (GLint)arg1[i][BCOMP] - half)) >> 6; - dot <<= RGBshift; - dot = CLAMP(dot, 0, CHAN_MAX); -#endif - rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot; + dot = CLAMP(dot, 0.0, 1.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; } } break; case GL_MODULATE_ADD_ATI: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - RGBshift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT - rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP]) * RGBmult; - rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP]) * RGBmult; - rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP]) * RGBmult; -#else - GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP]) - + ((GLuint) arg1[i][RCOMP] << CHAN_BITS)) >> shift; - GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP]) - + ((GLuint) arg1[i][GCOMP] << CHAN_BITS)) >> shift; - GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP]) - + ((GLuint) arg1[i][BCOMP] << CHAN_BITS)) >> shift; - rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); -#endif + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + + arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + + arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + + arg1[i][BCOMP]) * RGBmult; } } break; case GL_MODULATE_SIGNED_ADD_ATI: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - RGBshift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT - rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP] - 0.5) * RGBmult; - rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP] - 0.5) * RGBmult; - rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP] - 0.5) * RGBmult; -#else - GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP]) - + (((GLint) arg1[i][RCOMP] - half) << CHAN_BITS)) - >> shift; - GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP]) - + (((GLint) arg1[i][GCOMP] - half) << CHAN_BITS)) - >> shift; - GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP]) - + (((GLint) arg1[i][BCOMP] - half) << CHAN_BITS)) - >> shift; - rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); -#endif + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + + arg1[i][RCOMP] - 0.5) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + + arg1[i][GCOMP] - 0.5) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + + arg1[i][BCOMP] - 0.5) * RGBmult; } } break; case GL_MODULATE_SUBTRACT_ATI: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - RGBshift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT - rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - arg1[i][RCOMP]) * RGBmult; - rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - arg1[i][GCOMP]) * RGBmult; - rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - arg1[i][BCOMP]) * RGBmult; -#else - GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP]) - - ((GLint) arg1[i][RCOMP] << CHAN_BITS)) - >> shift; - GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP]) - - ((GLint) arg1[i][GCOMP] << CHAN_BITS)) - >> shift; - GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP]) - - ((GLint) arg1[i][BCOMP] << CHAN_BITS)) - >> shift; - rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); -#endif + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - + arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - + arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - + arg1[i][BCOMP]) * RGBmult; } } break; @@ -617,15 +463,11 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (textureUnit->_CurrentCombine->ModeA) { case GL_REPLACE: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; if (Ashift) { for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT - GLchan a = arg0[i][ACOMP] * Amult; -#else - GLuint a = (GLuint) arg0[i][ACOMP] << Ashift; -#endif - rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); + GLfloat a = arg0[i][ACOMP] * Amult; + rgba[i][ACOMP] = (GLfloat) MIN2(a, 1.0F); } } else { @@ -637,182 +479,107 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, break; case GL_MODULATE: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - Ashift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult; -#else - GLuint a = (PROD(arg0[i][ACOMP], arg1[i][ACOMP]) >> shift); - rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); -#endif } } break; case GL_ADD: if (textureUnit->EnvMode == GL_COMBINE4_NV) { /* (a * b) + (c * d) */ - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; - const GLchan (*arg3)[4] = (const GLchan (*)[4]) argA[3]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; + const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argA[3]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + arg2[i][ACOMP] * arg3[i][ACOMP]) * Amult; -#else - const GLint shift = CHAN_BITS - Ashift; - GLint a = (PROD(arg0[i][ACOMP], arg1[i][ACOMP]) >> shift) + - (PROD(arg2[i][ACOMP], arg3[i][ACOMP]) >> shift); - rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); -#endif } } else { /* two-term add */ - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult; -#else - GLint a = ((GLint) arg0[i][ACOMP] + arg1[i][ACOMP]) << Ashift; - rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); -#endif } } break; case GL_ADD_SIGNED: if (textureUnit->EnvMode == GL_COMBINE4_NV) { /* (a * b) + (c * d) - 0.5 */ - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; - const GLchan (*arg3)[4] = (const GLchan (*)[4]) argA[3]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; + const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argA[3]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + arg2[i][ACOMP] * arg3[i][ACOMP] - 0.5) * Amult; -#else - GLint a = (((PROD(arg0[i][ACOMP], arg1[i][ACOMP]) + - PROD(arg2[i][ACOMP], arg3[i][ACOMP])) >> CHAN_BITS) - half) - << Ashift; - rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); -#endif } } else { /* a + b - 0.5 */ - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult; -#else - GLint a = (GLint) arg0[i][ACOMP] + (GLint) arg1[i][ACOMP] -half; - a = (a < 0) ? 0 : a << Ashift; - rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); -#endif } } break; case GL_INTERPOLATE: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - Ashift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; for (i=0; i> shift; - rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); -#endif } } break; case GL_SUBTRACT: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = (arg0[i][ACOMP] - arg1[i][ACOMP]) * Amult; -#else - GLint a = ((GLint) arg0[i][ACOMP] - (GLint) arg1[i][ACOMP]) << Ashift; - rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); -#endif } } break; case GL_MODULATE_ADD_ATI: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - Ashift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT - rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP]) * Amult; -#else - GLint a = (PROD(arg0[i][ACOMP], arg2[i][ACOMP]) - + ((GLuint) arg1[i][ACOMP] << CHAN_BITS)) - >> shift; - rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); -#endif + rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + + arg1[i][ACOMP]) * Amult; } } break; case GL_MODULATE_SIGNED_ADD_ATI: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - Ashift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT - rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP] - 0.5F) * Amult; -#else - GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP]) - + (((GLint) arg1[i][ACOMP] - half) << CHAN_BITS)) - >> shift; - rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); -#endif + rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + + arg1[i][ACOMP] - 0.5F) * Amult; } } break; case GL_MODULATE_SUBTRACT_ATI: { - const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; - const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; - const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; -#if CHAN_TYPE != GL_FLOAT - const GLint shift = CHAN_BITS - Ashift; -#endif + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; for (i = 0; i < n; i++) { -#if CHAN_TYPE == GL_FLOAT - rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) - arg1[i][ACOMP]) * Amult; -#else - GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP]) - - ((GLint) arg1[i][ACOMP] << CHAN_BITS)) - >> shift; - rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); -#endif + rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + - arg1[i][ACOMP]) * Amult; } } break; @@ -831,8 +598,15 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, rgba[i][ACOMP] = rgba[i][RCOMP]; } } + + for (i = 0; i < n; i++) { + UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][RCOMP], rgba[i][RCOMP]); + UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][GCOMP], rgba[i][GCOMP]); + UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][BCOMP], rgba[i][BCOMP]); + UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][ACOMP], rgba[i][ACOMP]); + } } -#undef PROD + /** @@ -840,17 +614,17 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, * See GL_EXT_texture_swizzle. */ static void -swizzle_texels(GLuint swizzle, GLuint count, GLchan (*texels)[4]) +swizzle_texels(GLuint swizzle, GLuint count, GLfloat (*texels)[4]) { const GLuint swzR = GET_SWZ(swizzle, 0); const GLuint swzG = GET_SWZ(swizzle, 1); const GLuint swzB = GET_SWZ(swizzle, 2); const GLuint swzA = GET_SWZ(swizzle, 3); - GLchan vector[6]; + GLfloat vector[6]; GLuint i; vector[SWIZZLE_ZERO] = 0; - vector[SWIZZLE_ONE] = CHAN_MAX; + vector[SWIZZLE_ONE] = 1.0F; for (i = 0; i < count; i++) { vector[SWIZZLE_X] = texels[i][0]; @@ -880,13 +654,15 @@ static void texture_apply( const GLcontext *ctx, const struct gl_texture_unit *texUnit, GLuint n, - CONST GLchan primary_rgba[][4], CONST GLchan texel[][4], - GLchan rgba[][4] ) + CONST GLfloat primary_rgba[][4], CONST GLfloat texel[][4], + GLchan rgbaChan[][4] ) { GLint baseLevel; GLuint i; - GLchan Rc, Gc, Bc, Ac; + GLfloat Rc, Gc, Bc, Ac; GLenum format; + GLfloat rgba[MAX_WIDTH][4]; + (void) primary_rgba; ASSERT(texUnit); @@ -904,6 +680,16 @@ texture_apply( const GLcontext *ctx, format = texUnit->_Current->DepthMode; } + if (texUnit->EnvMode != GL_REPLACE) { + /* convert GLchan colors to GLfloat */ + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = CHAN_TO_FLOAT(rgbaChan[i][RCOMP]); + rgba[i][GCOMP] = CHAN_TO_FLOAT(rgbaChan[i][GCOMP]); + rgba[i][BCOMP] = CHAN_TO_FLOAT(rgbaChan[i][BCOMP]); + rgba[i][ACOMP] = CHAN_TO_FLOAT(rgbaChan[i][ACOMP]); + } + } + switch (texUnit->EnvMode) { case GL_REPLACE: switch (format) { @@ -917,14 +703,14 @@ texture_apply( const GLcontext *ctx, case GL_LUMINANCE: for (i=0;iEnvColor[0]); - UNCLAMPED_FLOAT_TO_CHAN(Gc, texUnit->EnvColor[1]); - UNCLAMPED_FLOAT_TO_CHAN(Bc, texUnit->EnvColor[2]); - UNCLAMPED_FLOAT_TO_CHAN(Ac, texUnit->EnvColor[3]); + Rc = texUnit->EnvColor[0]; + Gc = texUnit->EnvColor[1]; + Bc = texUnit->EnvColor[2]; + Ac = texUnit->EnvColor[3]; switch (format) { case GL_ALPHA: for (i=0;iend < MAX_WIDTH); @@ -1234,8 +1034,15 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) /* * Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR) */ - if (swrast->_AnyTextureCombine) - MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan)); + if (swrast->_AnyTextureCombine) { + GLuint i; + for (i = 0; i < span->end; i++) { + primary_rgba[i][RCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][RCOMP]); + primary_rgba[i][GCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][GCOMP]); + primary_rgba[i][BCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][BCOMP]); + primary_rgba[i][ACOMP] = CHAN_TO_FLOAT(span->array->rgba[i][ACOMP]); + } + } /* First must sample all bump maps */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { @@ -1323,8 +1130,8 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *curObj = texUnit->_Current; GLfloat *lambda = span->array->lambda[unit]; - GLchan (*texels)[4] = (GLchan (*)[4]) - (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan))); + GLfloat (*texels)[4] = (GLfloat (*)[4]) + (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLfloat))); /* adjust texture lod (lambda) */ if (span->arrayMask & SPAN_LAMBDA) { @@ -1357,13 +1164,7 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) /* GL_SGI_texture_color_table */ if (texUnit->ColorTableEnabled) { -#if CHAN_TYPE == GL_UNSIGNED_BYTE - _mesa_lookup_rgba_ubyte(&texUnit->ColorTable, span->end, texels); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - _mesa_lookup_rgba_ubyte(&texUnit->ColorTable, span->end, texels); -#else _mesa_lookup_rgba_float(&texUnit->ColorTable, span->end, texels); -#endif } /* GL_EXT_texture_swizzle */ @@ -1383,19 +1184,19 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; if (texUnit->_CurrentCombine != &texUnit->_EnvMode ) { texture_combine( ctx, unit, span->end, - (CONST GLchan (*)[4]) primary_rgba, + (CONST GLfloat (*)[4]) primary_rgba, swrast->TexelBuffer, span->array->rgba ); } else { /* conventional texture blend */ - const GLchan (*texels)[4] = (const GLchan (*)[4]) + const GLfloat (*texels)[4] = (const GLfloat (*)[4]) (swrast->TexelBuffer + unit * - (span->end * 4 * sizeof(GLchan))); + (span->end * 4 * sizeof(GLfloat))); texture_apply( ctx, texUnit, span->end, - (CONST GLchan (*)[4]) primary_rgba, texels, + (CONST GLfloat (*)[4]) primary_rgba, texels, span->array->rgba ); } } diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 19317c393a9..b76de045f82 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -133,27 +133,12 @@ ilerp_3d(GLint ia, GLint ib, GLint ic, * Do linear interpolation of colors. */ static INLINE void -lerp_rgba(GLchan result[4], GLfloat t, const GLchan a[4], const GLchan b[4]) +lerp_rgba(GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4]) { -#if CHAN_TYPE == GL_FLOAT result[0] = LERP(t, a[0], b[0]); result[1] = LERP(t, a[1], b[1]); result[2] = LERP(t, a[2], b[2]); result[3] = LERP(t, a[3], b[3]); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - result[0] = (GLchan) (LERP(t, a[0], b[0]) + 0.5); - result[1] = (GLchan) (LERP(t, a[1], b[1]) + 0.5); - result[2] = (GLchan) (LERP(t, a[2], b[2]) + 0.5); - result[3] = (GLchan) (LERP(t, a[3], b[3]) + 0.5); -#else - /* fixed point interpolants in [0, ILERP_SCALE] */ - const GLint it = IROUND_POS(t * ILERP_SCALE); - ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); - result[0] = ILERP(it, a[0], b[0]); - result[1] = ILERP(it, a[1], b[1]); - result[2] = ILERP(it, a[2], b[2]); - result[3] = ILERP(it, a[3], b[3]); -#endif } @@ -161,29 +146,14 @@ lerp_rgba(GLchan result[4], GLfloat t, const GLchan a[4], const GLchan b[4]) * Do bilinear interpolation of colors. */ static INLINE void -lerp_rgba_2d(GLchan result[4], GLfloat a, GLfloat b, - const GLchan t00[4], const GLchan t10[4], - const GLchan t01[4], const GLchan t11[4]) +lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b, + const GLfloat t00[4], const GLfloat t10[4], + const GLfloat t01[4], const GLfloat t11[4]) { -#if CHAN_TYPE == GL_FLOAT result[0] = lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]); result[1] = lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]); result[2] = lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]); result[3] = lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - result[0] = (GLchan) (lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5); - result[1] = (GLchan) (lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5); - result[2] = (GLchan) (lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5); - result[3] = (GLchan) (lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]) + 0.5); -#else - const GLint ia = IROUND_POS(a * ILERP_SCALE); - const GLint ib = IROUND_POS(b * ILERP_SCALE); - ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); - result[0] = ilerp_2d(ia, ib, t00[0], t10[0], t01[0], t11[0]); - result[1] = ilerp_2d(ia, ib, t00[1], t10[1], t01[1], t11[1]); - result[2] = ilerp_2d(ia, ib, t00[2], t10[2], t01[2], t11[2]); - result[3] = ilerp_2d(ia, ib, t00[3], t10[3], t01[3], t11[3]); -#endif } @@ -191,34 +161,18 @@ lerp_rgba_2d(GLchan result[4], GLfloat a, GLfloat b, * Do trilinear interpolation of colors. */ static INLINE void -lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c, - const GLchan t000[4], const GLchan t100[4], - const GLchan t010[4], const GLchan t110[4], - const GLchan t001[4], const GLchan t101[4], - const GLchan t011[4], const GLchan t111[4]) +lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c, + const GLfloat t000[4], const GLfloat t100[4], + const GLfloat t010[4], const GLfloat t110[4], + const GLfloat t001[4], const GLfloat t101[4], + const GLfloat t011[4], const GLfloat t111[4]) { GLuint k; /* compiler should unroll these short loops */ -#if CHAN_TYPE == GL_FLOAT for (k = 0; k < 4; k++) { result[k] = lerp_3d(a, b, c, t000[k], t100[k], t010[k], t110[k], t001[k], t101[k], t011[k], t111[k]); } -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - for (k = 0; k < 4; k++) { - result[k] = (GLchan)(lerp_3d(a, b, c, - t000[k], t100[k], t010[k], t110[k], - t001[k], t101[k], t011[k], t111[k]) + 0.5F); - } -#else - GLint ia = IROUND_POS(a * ILERP_SCALE); - GLint ib = IROUND_POS(b * ILERP_SCALE); - GLint ic = IROUND_POS(c * ILERP_SCALE); - for (k = 0; k < 4; k++) { - result[k] = ilerp_3d(ia, ib, ic, t000[k], t100[k], t010[k], t110[k], - t001[k], t101[k], t011[k], t111[k]); - } -#endif } @@ -671,7 +625,7 @@ static INLINE void sample_1d_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, - const GLfloat texcoord[4], GLchan rgba[4]) + const GLfloat texcoord[4], GLfloat rgba[4]) { const GLint width = img->Width2; /* without border, power of two */ GLint i; @@ -680,10 +634,10 @@ sample_1d_nearest(GLcontext *ctx, i += img->Border; if (i < 0 || i >= (GLint) img->Width) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_CHAN4(rgba, tObj->_BorderChan); + COPY_4V(rgba, tObj->BorderColor); } else { - img->FetchTexelc(img, i, 0, 0, rgba); + img->FetchTexelf(img, i, 0, 0, rgba); } } @@ -695,13 +649,13 @@ static INLINE void sample_1d_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, - const GLfloat texcoord[4], GLchan rgba[4]) + const GLfloat texcoord[4], GLfloat rgba[4]) { const GLint width = img->Width2; GLint i0, i1; GLbitfield useBorderColor = 0x0; GLfloat a; - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); @@ -716,16 +670,16 @@ sample_1d_linear(GLcontext *ctx, /* fetch texel colors */ if (useBorderColor & I0BIT) { - COPY_CHAN4(t0, tObj->_BorderChan); + COPY_4V(t0, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, 0, 0, t0); + img->FetchTexelf(img, i0, 0, 0, t0); } if (useBorderColor & I1BIT) { - COPY_CHAN4(t1, tObj->_BorderChan); + COPY_4V(t1, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, 0, 0, t1); + img->FetchTexelf(img, i1, 0, 0, t1); } lerp_rgba(rgba, a, t0, t1); @@ -736,7 +690,7 @@ static void sample_1d_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -751,7 +705,7 @@ static void sample_1d_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -766,7 +720,7 @@ static void sample_1d_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -777,7 +731,7 @@ sample_1d_nearest_mipmap_linear(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; + GLfloat t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); sample_1d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_1d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); @@ -791,7 +745,7 @@ static void sample_1d_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -802,7 +756,7 @@ sample_1d_linear_mipmap_linear(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; + GLfloat t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); sample_1d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_1d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); @@ -817,7 +771,7 @@ static void sample_nearest_1d( GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4] ) + GLfloat rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -833,7 +787,7 @@ static void sample_linear_1d( GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4] ) + GLfloat rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -849,7 +803,7 @@ static void sample_lambda_1d( GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4] ) + const GLfloat lambda[], GLfloat rgba[][4] ) { GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ @@ -929,7 +883,7 @@ sample_2d_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], - GLchan rgba[]) + GLfloat rgba[]) { const GLint width = img->Width2; /* without border, power of two */ const GLint height = img->Height2; /* without border, power of two */ @@ -945,10 +899,10 @@ sample_2d_nearest(GLcontext *ctx, if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_CHAN4(rgba, tObj->_BorderChan); + COPY_4V(rgba, tObj->BorderColor); } else { - img->FetchTexelc(img, i, j, 0, rgba); + img->FetchTexelf(img, i, j, 0, rgba); } } @@ -962,14 +916,14 @@ sample_2d_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], - GLchan rgba[]) + GLfloat rgba[]) { const GLint width = img->Width2; const GLint height = img->Height2; GLint i0, j0, i1, j1; GLbitfield useBorderColor = 0x0; GLfloat a, b; - GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */ + GLfloat t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */ linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b); @@ -989,28 +943,28 @@ sample_2d_linear(GLcontext *ctx, /* fetch four texel colors */ if (useBorderColor & (I0BIT | J0BIT)) { - COPY_CHAN4(t00, tObj->_BorderChan); + COPY_4V(t00, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, j0, 0, t00); + img->FetchTexelf(img, i0, j0, 0, t00); } if (useBorderColor & (I1BIT | J0BIT)) { - COPY_CHAN4(t10, tObj->_BorderChan); + COPY_4V(t10, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, j0, 0, t10); + img->FetchTexelf(img, i1, j0, 0, t10); } if (useBorderColor & (I0BIT | J1BIT)) { - COPY_CHAN4(t01, tObj->_BorderChan); + COPY_4V(t01, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, j1, 0, t01); + img->FetchTexelf(img, i0, j1, 0, t01); } if (useBorderColor & (I1BIT | J1BIT)) { - COPY_CHAN4(t11, tObj->_BorderChan); + COPY_4V(t11, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, j1, 0, t11); + img->FetchTexelf(img, i1, j1, 0, t11); } lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11); @@ -1026,13 +980,13 @@ sample_2d_linear_repeat(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], - GLchan rgba[]) + GLfloat rgba[]) { const GLint width = img->Width2; const GLint height = img->Height2; GLint i0, j0, i1, j1; GLfloat wi, wj; - GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */ + GLfloat t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */ (void) ctx; @@ -1045,10 +999,10 @@ sample_2d_linear_repeat(GLcontext *ctx, linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi); linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj); - img->FetchTexelc(img, i0, j0, 0, t00); - img->FetchTexelc(img, i1, j0, 0, t10); - img->FetchTexelc(img, i0, j1, 0, t01); - img->FetchTexelc(img, i1, j1, 0, t11); + img->FetchTexelf(img, i0, j0, 0, t00); + img->FetchTexelf(img, i1, j0, 0, t10); + img->FetchTexelf(img, i0, j1, 0, t01); + img->FetchTexelf(img, i1, j1, 0, t11); lerp_rgba_2d(rgba, wi, wj, t00, t10, t01, t11); } @@ -1058,7 +1012,7 @@ static void sample_2d_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; for (i = 0; i < n; i++) { @@ -1072,7 +1026,7 @@ static void sample_2d_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1087,7 +1041,7 @@ static void sample_2d_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1098,7 +1052,7 @@ sample_2d_nearest_mipmap_linear(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_2d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); @@ -1112,7 +1066,7 @@ static void sample_2d_linear_mipmap_linear( GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4] ) + const GLfloat lambda[], GLfloat rgba[][4] ) { GLuint i; ASSERT(lambda != NULL); @@ -1123,7 +1077,7 @@ sample_2d_linear_mipmap_linear( GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_2d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); @@ -1137,7 +1091,7 @@ static void sample_2d_linear_mipmap_linear_repeat(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1150,7 +1104,7 @@ sample_2d_linear_mipmap_linear_repeat(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); @@ -1167,7 +1121,7 @@ static void sample_nearest_2d(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -1183,7 +1137,7 @@ static void sample_linear_2d(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -1279,7 +1233,7 @@ opt_sample_rgba_2d(GLcontext *ctx, const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; const GLint pos = (row << shift) | col; const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */ - COPY_CHAN4(rgba[i], texel); + COPY_4V(rgba[i], texel); } } @@ -1289,7 +1243,7 @@ static void sample_lambda_2d(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel]; GLuint minStart, minEnd; /* texels with minification */ @@ -1312,6 +1266,7 @@ sample_lambda_2d(GLcontext *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { +#if 0 case MESA_FORMAT_RGB: opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); @@ -1320,6 +1275,7 @@ sample_lambda_2d(GLcontext *ctx, opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; +#endif default: sample_nearest_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart ); @@ -1369,6 +1325,7 @@ sample_lambda_2d(GLcontext *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { +#if 0 case MESA_FORMAT_RGB: opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); @@ -1377,6 +1334,7 @@ sample_lambda_2d(GLcontext *ctx, opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; +#endif default: sample_nearest_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart ); @@ -1411,7 +1369,7 @@ sample_3d_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], - GLchan rgba[4]) + GLfloat rgba[4]) { const GLint width = img->Width2; /* without border, power of two */ const GLint height = img->Height2; /* without border, power of two */ @@ -1427,10 +1385,10 @@ sample_3d_nearest(GLcontext *ctx, j < 0 || j >= (GLint) img->Height || k < 0 || k >= (GLint) img->Depth) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_CHAN4(rgba, tObj->_BorderChan); + COPY_4V(rgba, tObj->BorderColor); } else { - img->FetchTexelc(img, i, j, k, rgba); + img->FetchTexelf(img, i, j, k, rgba); } } @@ -1443,7 +1401,7 @@ sample_3d_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], - GLchan rgba[4]) + GLfloat rgba[4]) { const GLint width = img->Width2; const GLint height = img->Height2; @@ -1451,8 +1409,8 @@ sample_3d_linear(GLcontext *ctx, GLint i0, j0, k0, i1, j1, k1; GLbitfield useBorderColor = 0x0; GLfloat a, b, c; - GLchan t000[4], t010[4], t001[4], t011[4]; - GLchan t100[4], t110[4], t101[4], t111[4]; + GLfloat t000[4], t010[4], t001[4], t011[4]; + GLfloat t100[4], t110[4], t101[4], t111[4]; linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b); @@ -1478,53 +1436,53 @@ sample_3d_linear(GLcontext *ctx, /* Fetch texels */ if (useBorderColor & (I0BIT | J0BIT | K0BIT)) { - COPY_CHAN4(t000, tObj->_BorderChan); + COPY_4V(t000, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, j0, k0, t000); + img->FetchTexelf(img, i0, j0, k0, t000); } if (useBorderColor & (I1BIT | J0BIT | K0BIT)) { - COPY_CHAN4(t100, tObj->_BorderChan); + COPY_4V(t100, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, j0, k0, t100); + img->FetchTexelf(img, i1, j0, k0, t100); } if (useBorderColor & (I0BIT | J1BIT | K0BIT)) { - COPY_CHAN4(t010, tObj->_BorderChan); + COPY_4V(t010, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, j1, k0, t010); + img->FetchTexelf(img, i0, j1, k0, t010); } if (useBorderColor & (I1BIT | J1BIT | K0BIT)) { - COPY_CHAN4(t110, tObj->_BorderChan); + COPY_4V(t110, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, j1, k0, t110); + img->FetchTexelf(img, i1, j1, k0, t110); } if (useBorderColor & (I0BIT | J0BIT | K1BIT)) { - COPY_CHAN4(t001, tObj->_BorderChan); + COPY_4V(t001, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, j0, k1, t001); + img->FetchTexelf(img, i0, j0, k1, t001); } if (useBorderColor & (I1BIT | J0BIT | K1BIT)) { - COPY_CHAN4(t101, tObj->_BorderChan); + COPY_4V(t101, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, j0, k1, t101); + img->FetchTexelf(img, i1, j0, k1, t101); } if (useBorderColor & (I0BIT | J1BIT | K1BIT)) { - COPY_CHAN4(t011, tObj->_BorderChan); + COPY_4V(t011, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, j1, k1, t011); + img->FetchTexelf(img, i0, j1, k1, t011); } if (useBorderColor & (I1BIT | J1BIT | K1BIT)) { - COPY_CHAN4(t111, tObj->_BorderChan); + COPY_4V(t111, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, j1, k1, t111); + img->FetchTexelf(img, i1, j1, k1, t111); } /* trilinear interpolation of samples */ @@ -1536,7 +1494,7 @@ static void sample_3d_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4] ) + const GLfloat lambda[], GLfloat rgba[][4] ) { GLuint i; for (i = 0; i < n; i++) { @@ -1550,7 +1508,7 @@ static void sample_3d_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1565,7 +1523,7 @@ static void sample_3d_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1576,7 +1534,7 @@ sample_3d_nearest_mipmap_linear(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_3d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_3d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); @@ -1590,7 +1548,7 @@ static void sample_3d_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1601,7 +1559,7 @@ sample_3d_linear_mipmap_linear(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_3d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_3d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); @@ -1616,7 +1574,7 @@ static void sample_nearest_3d(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -1632,7 +1590,7 @@ static void sample_linear_3d(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -1648,7 +1606,7 @@ static void sample_lambda_3d(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ @@ -1799,7 +1757,7 @@ static void sample_nearest_cube(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint i; (void) lambda; @@ -1817,7 +1775,7 @@ static void sample_linear_cube(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; (void) lambda; @@ -1835,7 +1793,7 @@ static void sample_cube_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1864,7 +1822,7 @@ static void sample_cube_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1883,7 +1841,7 @@ static void sample_cube_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1898,7 +1856,7 @@ sample_cube_nearest_mipmap_linear(GLcontext *ctx, newCoord, rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_nearest(ctx, tObj, images[level ], newCoord, t0); sample_2d_nearest(ctx, tObj, images[level+1], newCoord, t1); @@ -1912,7 +1870,7 @@ static void sample_cube_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -1927,7 +1885,7 @@ sample_cube_linear_mipmap_linear(GLcontext *ctx, newCoord, rgba[i]); } else { - GLchan t0[4], t1[4]; + GLfloat t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); sample_2d_linear(ctx, tObj, images[level ], newCoord, t0); sample_2d_linear(ctx, tObj, images[level+1], newCoord, t1); @@ -1942,7 +1900,7 @@ static void sample_lambda_cube(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ @@ -2076,7 +2034,7 @@ static void sample_nearest_rect(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { const struct gl_texture_image *img = tObj->Image[0][0]; const GLint width = img->Width; @@ -2099,9 +2057,9 @@ sample_nearest_rect(GLcontext *ctx, col = clamp_rect_coord_nearest(tObj->WrapS, texcoords[i][0], width); row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height); if (col < 0 || col >= width || row < 0 || row >= height) - COPY_CHAN4(rgba[i], tObj->_BorderChan); + COPY_4V(rgba[i], tObj->BorderColor); else - img->FetchTexelc(img, col, row, 0, rgba[i]); + img->FetchTexelf(img, col, row, 0, rgba[i]); } } @@ -2110,7 +2068,7 @@ static void sample_linear_rect(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { const struct gl_texture_image *img = tObj->Image[0][0]; const GLint width = img->Width; @@ -2130,7 +2088,7 @@ sample_linear_rect(GLcontext *ctx, for (i = 0; i < n; i++) { GLint i0, j0, i1, j1; - GLchan t00[4], t01[4], t10[4], t11[4]; + GLfloat t00[4], t01[4], t10[4], t11[4]; GLfloat a, b; GLbitfield useBorderColor = 0x0; @@ -2147,24 +2105,24 @@ sample_linear_rect(GLcontext *ctx, /* get four texel samples */ if (useBorderColor & (I0BIT | J0BIT)) - COPY_CHAN4(t00, tObj->_BorderChan); + COPY_4V(t00, tObj->BorderColor); else - img->FetchTexelc(img, i0, j0, 0, t00); + img->FetchTexelf(img, i0, j0, 0, t00); if (useBorderColor & (I1BIT | J0BIT)) - COPY_CHAN4(t10, tObj->_BorderChan); + COPY_4V(t10, tObj->BorderColor); else - img->FetchTexelc(img, i1, j0, 0, t10); + img->FetchTexelf(img, i1, j0, 0, t10); if (useBorderColor & (I0BIT | J1BIT)) - COPY_CHAN4(t01, tObj->_BorderChan); + COPY_4V(t01, tObj->BorderColor); else - img->FetchTexelc(img, i0, j1, 0, t01); + img->FetchTexelf(img, i0, j1, 0, t01); if (useBorderColor & (I1BIT | J1BIT)) - COPY_CHAN4(t11, tObj->_BorderChan); + COPY_4V(t11, tObj->BorderColor); else - img->FetchTexelc(img, i1, j1, 0, t11); + img->FetchTexelf(img, i1, j1, 0, t11); lerp_rgba_2d(rgba[i], a, b, t00, t10, t01, t11); } @@ -2176,7 +2134,7 @@ static void sample_lambda_rect(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint minStart, minEnd, magStart, magEnd; @@ -2222,7 +2180,7 @@ sample_2d_array_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], - GLchan rgba[4]) + GLfloat rgba[4]) { const GLint width = img->Width2; /* without border, power of two */ const GLint height = img->Height2; /* without border, power of two */ @@ -2239,10 +2197,10 @@ sample_2d_array_nearest(GLcontext *ctx, j < 0 || j >= (GLint) img->Height || array < 0 || array >= (GLint) img->Depth) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_CHAN4(rgba, tObj->_BorderChan); + COPY_4V(rgba, tObj->BorderColor); } else { - img->FetchTexelc(img, i, j, array, rgba); + img->FetchTexelf(img, i, j, array, rgba); } } @@ -2255,7 +2213,7 @@ sample_2d_array_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], - GLchan rgba[4]) + GLfloat rgba[4]) { const GLint width = img->Width2; const GLint height = img->Height2; @@ -2264,14 +2222,14 @@ sample_2d_array_linear(GLcontext *ctx, GLint array; GLbitfield useBorderColor = 0x0; GLfloat a, b; - GLchan t00[4], t01[4], t10[4], t11[4]; + GLfloat t00[4], t01[4], t10[4], t11[4]; linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b); array = clamp_rect_coord_nearest(tObj->WrapR, texcoord[2], depth); if (array < 0 || array >= depth) { - COPY_CHAN4(rgba, tObj->_BorderChan); + COPY_4V(rgba, tObj->BorderColor); } else { if (img->Border) { @@ -2290,28 +2248,28 @@ sample_2d_array_linear(GLcontext *ctx, /* Fetch texels */ if (useBorderColor & (I0BIT | J0BIT)) { - COPY_CHAN4(t00, tObj->_BorderChan); + COPY_4V(t00, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, j0, array, t00); + img->FetchTexelf(img, i0, j0, array, t00); } if (useBorderColor & (I1BIT | J0BIT)) { - COPY_CHAN4(t10, tObj->_BorderChan); + COPY_4V(t10, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, j0, array, t10); + img->FetchTexelf(img, i1, j0, array, t10); } if (useBorderColor & (I0BIT | J1BIT)) { - COPY_CHAN4(t01, tObj->_BorderChan); + COPY_4V(t01, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, j1, array, t01); + img->FetchTexelf(img, i0, j1, array, t01); } if (useBorderColor & (I1BIT | J1BIT)) { - COPY_CHAN4(t11, tObj->_BorderChan); + COPY_4V(t11, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, j1, array, t11); + img->FetchTexelf(img, i1, j1, array, t11); } /* trilinear interpolation of samples */ @@ -2324,7 +2282,7 @@ static void sample_2d_array_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; for (i = 0; i < n; i++) { @@ -2339,7 +2297,7 @@ static void sample_2d_array_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -2355,7 +2313,7 @@ static void sample_2d_array_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -2366,7 +2324,7 @@ sample_2d_array_nearest_mipmap_linear(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_array_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); @@ -2382,7 +2340,7 @@ static void sample_2d_array_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -2393,7 +2351,7 @@ sample_2d_array_linear_mipmap_linear(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_array_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); @@ -2410,7 +2368,7 @@ static void sample_nearest_2d_array(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -2427,7 +2385,7 @@ static void sample_linear_2d_array(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -2443,7 +2401,7 @@ static void sample_lambda_2d_array(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ @@ -2532,7 +2490,7 @@ sample_1d_array_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], - GLchan rgba[4]) + GLfloat rgba[4]) { const GLint width = img->Width2; /* without border, power of two */ const GLint height = img->Height; @@ -2546,10 +2504,10 @@ sample_1d_array_nearest(GLcontext *ctx, if (i < 0 || i >= (GLint) img->Width || array < 0 || array >= (GLint) img->Height) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_CHAN4(rgba, tObj->_BorderChan); + COPY_4V(rgba, tObj->BorderColor); } else { - img->FetchTexelc(img, i, array, 0, rgba); + img->FetchTexelf(img, i, array, 0, rgba); } } @@ -2562,7 +2520,7 @@ sample_1d_array_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], - GLchan rgba[4]) + GLfloat rgba[4]) { const GLint width = img->Width2; const GLint height = img->Height; @@ -2570,7 +2528,7 @@ sample_1d_array_linear(GLcontext *ctx, GLint array; GLbitfield useBorderColor = 0x0; GLfloat a; - GLchan t0[4], t1[4]; + GLfloat t0[4], t1[4]; linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a); array = clamp_rect_coord_nearest(tObj->WrapT, texcoord[1], height); @@ -2589,16 +2547,16 @@ sample_1d_array_linear(GLcontext *ctx, /* Fetch texels */ if (useBorderColor & (I0BIT | K0BIT)) { - COPY_CHAN4(t0, tObj->_BorderChan); + COPY_4V(t0, tObj->BorderColor); } else { - img->FetchTexelc(img, i0, array, 0, t0); + img->FetchTexelf(img, i0, array, 0, t0); } if (useBorderColor & (I1BIT | K0BIT)) { - COPY_CHAN4(t1, tObj->_BorderChan); + COPY_4V(t1, tObj->BorderColor); } else { - img->FetchTexelc(img, i1, array, 0, t1); + img->FetchTexelf(img, i1, array, 0, t1); } /* bilinear interpolation of samples */ @@ -2610,7 +2568,7 @@ static void sample_1d_array_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; for (i = 0; i < n; i++) { @@ -2625,7 +2583,7 @@ static void sample_1d_array_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -2641,7 +2599,7 @@ static void sample_1d_array_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -2652,7 +2610,7 @@ sample_1d_array_nearest_mipmap_linear(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_1d_array_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_1d_array_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); @@ -2666,7 +2624,7 @@ static void sample_1d_array_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; ASSERT(lambda != NULL); @@ -2677,7 +2635,7 @@ sample_1d_array_linear_mipmap_linear(GLcontext *ctx, texcoord[i], rgba[i]); } else { - GLchan t0[4], t1[4]; /* texels */ + GLfloat t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_1d_array_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_1d_array_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); @@ -2692,7 +2650,7 @@ static void sample_nearest_1d_array(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -2708,7 +2666,7 @@ static void sample_linear_1d_array(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; @@ -2724,7 +2682,7 @@ static void sample_lambda_1d_array(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ @@ -2802,7 +2760,7 @@ static void sample_depth_texture( GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan texel[][4] ) + GLfloat texel[][4] ) { const GLint baseLevel = tObj->BaseLevel; const struct gl_texture_image *img = tObj->Image[0][baseLevel]; @@ -2811,9 +2769,9 @@ sample_depth_texture( GLcontext *ctx, const GLint depth = img->Depth; const GLuint compare_coord = (tObj->Target == GL_TEXTURE_2D_ARRAY_EXT) ? 3 : 2; - GLchan ambient; + GLfloat ambient; GLenum function; - GLchan result; + GLfloat result; (void) lambda; @@ -2826,7 +2784,7 @@ sample_depth_texture( GLcontext *ctx, tObj->Target == GL_TEXTURE_1D_ARRAY_EXT || tObj->Target == GL_TEXTURE_2D_ARRAY_EXT); - UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->CompareFailValue); + ambient = tObj->CompareFailValue; /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */ @@ -2889,31 +2847,31 @@ sample_depth_texture( GLcontext *ctx, switch (function) { case GL_LEQUAL: - result = (texcoords[i][compare_coord] <= depthSample) ? CHAN_MAX : ambient; + result = (texcoords[i][compare_coord] <= depthSample) ? 1.0F : ambient; break; case GL_GEQUAL: - result = (texcoords[i][compare_coord] >= depthSample) ? CHAN_MAX : ambient; + result = (texcoords[i][compare_coord] >= depthSample) ? 1.0F : ambient; break; case GL_LESS: - result = (texcoords[i][compare_coord] < depthSample) ? CHAN_MAX : ambient; + result = (texcoords[i][compare_coord] < depthSample) ? 1.0F : ambient; break; case GL_GREATER: - result = (texcoords[i][compare_coord] > depthSample) ? CHAN_MAX : ambient; + result = (texcoords[i][compare_coord] > depthSample) ? 1.0F : ambient; break; case GL_EQUAL: - result = (texcoords[i][compare_coord] == depthSample) ? CHAN_MAX : ambient; + result = (texcoords[i][compare_coord] == depthSample) ? 1.0F : ambient; break; case GL_NOTEQUAL: - result = (texcoords[i][compare_coord] != depthSample) ? CHAN_MAX : ambient; + result = (texcoords[i][compare_coord] != depthSample) ? 1.0F : ambient; break; case GL_ALWAYS: - result = CHAN_MAX; + result = 1.0F; break; case GL_NEVER: result = ambient; break; case GL_NONE: - CLAMPED_FLOAT_TO_CHAN(result, depthSample); + result = depthSample; break; default: _mesa_problem(ctx, "Bad compare func in sample_depth_texture"); @@ -2922,22 +2880,13 @@ sample_depth_texture( GLcontext *ctx, switch (tObj->DepthMode) { case GL_LUMINANCE: - texel[i][RCOMP] = result; - texel[i][GCOMP] = result; - texel[i][BCOMP] = result; - texel[i][ACOMP] = CHAN_MAX; + ASSIGN_4V(texel[i], result, result, result, 1.0F); break; case GL_INTENSITY: - texel[i][RCOMP] = result; - texel[i][GCOMP] = result; - texel[i][BCOMP] = result; - texel[i][ACOMP] = result; + ASSIGN_4V(texel[i], result, result, result, result); break; case GL_ALPHA: - texel[i][RCOMP] = 0; - texel[i][GCOMP] = 0; - texel[i][BCOMP] = 0; - texel[i][ACOMP] = result; + ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result); break; default: _mesa_problem(ctx, "Bad depth texture mode"); @@ -3074,42 +3023,42 @@ sample_depth_texture( GLcontext *ctx, if (depth01 <= texcoords[i][compare_coord]) luminance -= d; if (depth10 <= texcoords[i][compare_coord]) luminance -= d; if (depth11 <= texcoords[i][compare_coord]) luminance -= d; - result = (GLchan) luminance; + result = (GLfloat) luminance; break; case GL_GEQUAL: if (depth00 >= texcoords[i][compare_coord]) luminance -= d; if (depth01 >= texcoords[i][compare_coord]) luminance -= d; if (depth10 >= texcoords[i][compare_coord]) luminance -= d; if (depth11 >= texcoords[i][compare_coord]) luminance -= d; - result = (GLchan) luminance; + result = (GLfloat) luminance; break; case GL_LESS: if (depth00 < texcoords[i][compare_coord]) luminance -= d; if (depth01 < texcoords[i][compare_coord]) luminance -= d; if (depth10 < texcoords[i][compare_coord]) luminance -= d; if (depth11 < texcoords[i][compare_coord]) luminance -= d; - result = (GLchan) luminance; + result = (GLfloat) luminance; break; case GL_GREATER: if (depth00 > texcoords[i][compare_coord]) luminance -= d; if (depth01 > texcoords[i][compare_coord]) luminance -= d; if (depth10 > texcoords[i][compare_coord]) luminance -= d; if (depth11 > texcoords[i][compare_coord]) luminance -= d; - result = (GLchan) luminance; + result = (GLfloat) luminance; break; case GL_EQUAL: if (depth00 == texcoords[i][compare_coord]) luminance -= d; if (depth01 == texcoords[i][compare_coord]) luminance -= d; if (depth10 == texcoords[i][compare_coord]) luminance -= d; if (depth11 == texcoords[i][compare_coord]) luminance -= d; - result = (GLchan) luminance; + result = (GLfloat) luminance; break; case GL_NOTEQUAL: if (depth00 != texcoords[i][compare_coord]) luminance -= d; if (depth01 != texcoords[i][compare_coord]) luminance -= d; if (depth10 != texcoords[i][compare_coord]) luminance -= d; if (depth11 != texcoords[i][compare_coord]) luminance -= d; - result = (GLchan) luminance; + result = (GLfloat) luminance; break; case GL_ALWAYS: result = 0; @@ -3168,7 +3117,7 @@ static void null_sample_func( GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat rgba[][4]) { GLuint i; (void) ctx; @@ -3225,6 +3174,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, } else { /* check for a few optimized cases */ +#if 0 const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; ASSERT(t->MinFilter == GL_NEAREST); if (t->WrapS == GL_REPEAT && @@ -3241,6 +3191,10 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, img->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { return &opt_sample_rgba_2d; } +#else + if (0) + ; +#endif else { return &sample_nearest_2d; } diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index f99401ca6d8..1795f62c323 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -176,17 +176,12 @@ static void vp_fetch_texel(GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, GLuint unit, GLfloat color[4]) { - GLchan rgba[4]; SWcontext *swrast = SWRAST_CONTEXT(ctx); /* XXX use a float-valued TextureSample routine here!!! */ swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current, 1, (const GLfloat (*)[4]) texcoord, - &lambda, &rgba); - color[0] = CHAN_TO_FLOAT(rgba[0]); - color[1] = CHAN_TO_FLOAT(rgba[1]); - color[2] = CHAN_TO_FLOAT(rgba[2]); - color[3] = CHAN_TO_FLOAT(rgba[3]); + &lambda, (GLfloat (*)[4]) color); } -- cgit v1.2.3 From 933f3b13c34c2ed9223755c0e7c7dc22f09d23e8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 8 Mar 2009 14:38:37 -0600 Subject: swrast: general clean-up of texture combine code --- src/mesa/swrast/s_texcombine.c | 407 ++++++++++++++++------------------------- 1 file changed, 161 insertions(+), 246 deletions(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index c48a6fb1141..27c5c15cf16 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -62,19 +62,16 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, GLchan (*rgbaChan)[4] ) { const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]); + const struct gl_tex_env_combine_state *combine = textureUnit->_CurrentCombine; const GLfloat (*argRGB [MAX_COMBINER_TERMS])[4]; const GLfloat (*argA [MAX_COMBINER_TERMS])[4]; - const GLint RGBshift = textureUnit->_CurrentCombine->ScaleShiftRGB; - const GLuint Ashift = textureUnit->_CurrentCombine->ScaleShiftA; - const GLfloat RGBmult = (GLfloat) (1 << RGBshift); - const GLfloat Amult = (GLfloat) (1 << Ashift); - static const GLfloat one[4] = { 1, 1, 1, 1 }; - static const GLfloat zero[4] = { 0, 0, 0, 0 }; - const GLuint numColorArgs = textureUnit->_CurrentCombine->_NumArgsRGB; - const GLuint numAlphaArgs = textureUnit->_CurrentCombine->_NumArgsA; + const GLfloat RGBmult = (GLfloat) (1 << combine->ScaleShiftRGB); + const GLfloat Amult = (GLfloat) (1 << combine->ScaleShiftA); + const GLuint numColorArgs = combine->_NumArgsRGB; + const GLuint numAlphaArgs = combine->_NumArgsA; GLfloat ccolor[MAX_COMBINER_TERMS][MAX_WIDTH][4]; /* temp color buffers */ GLfloat rgba[MAX_WIDTH][4]; - GLuint i, j; + GLuint i, term; ASSERT(ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine); @@ -89,34 +86,35 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* printf("modeRGB 0x%x modeA 0x%x srcRGB1 0x%x srcA1 0x%x srcRGB2 0x%x srcA2 0x%x\n", - textureUnit->_CurrentCombine->ModeRGB, - textureUnit->_CurrentCombine->ModeA, - textureUnit->_CurrentCombine->SourceRGB[0], - textureUnit->_CurrentCombine->SourceA[0], - textureUnit->_CurrentCombine->SourceRGB[1], - textureUnit->_CurrentCombine->SourceA[1]); + combine->ModeRGB, + combine->ModeA, + combine->SourceRGB[0], + combine->SourceA[0], + combine->SourceRGB[1], + combine->SourceA[1]); */ /* * Do operand setup for up to 4 operands. Loop over the terms. */ - for (j = 0; j < numColorArgs; j++) { - const GLenum srcRGB = textureUnit->_CurrentCombine->SourceRGB[j]; + for (term = 0; term < numColorArgs; term++) { + const GLenum srcRGB = combine->SourceRGB[term]; + const GLenum operandRGB = combine->OperandRGB[term]; switch (srcRGB) { case GL_TEXTURE: - argRGB[j] = (const GLfloat (*)[4]) + argRGB[term] = (const GLfloat (*)[4]) (texelBuffer + unit * (n * 4 * sizeof(GLfloat))); break; case GL_PRIMARY_COLOR: - argRGB[j] = primary_rgba; + argRGB[term] = primary_rgba; break; case GL_PREVIOUS: - argRGB[j] = (const GLfloat (*)[4]) rgba; + argRGB[term] = (const GLfloat (*)[4]) rgba; break; case GL_CONSTANT: { - GLfloat (*c)[4] = ccolor[j]; + GLfloat (*c)[4] = ccolor[term]; GLfloat red = textureUnit->EnvColor[0]; GLfloat green = textureUnit->EnvColor[1]; GLfloat blue = textureUnit->EnvColor[2]; @@ -124,27 +122,27 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, for (i = 0; i < n; i++) { ASSIGN_4V(c[i], red, green, blue, alpha); } - argRGB[j] = (const GLfloat (*)[4]) ccolor[j]; + argRGB[term] = (const GLfloat (*)[4]) ccolor[term]; } break; /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. */ case GL_ZERO: { - GLfloat (*c)[4] = ccolor[j]; + GLfloat (*c)[4] = ccolor[term]; for (i = 0; i < n; i++) { ASSIGN_4V(c[i], 0.0F, 0.0F, 0.0F, 0.0F); } - argRGB[j] = (const GLfloat (*)[4]) ccolor[j]; + argRGB[term] = (const GLfloat (*)[4]) ccolor[term]; } break; case GL_ONE: { - GLfloat (*c)[4] = ccolor[j]; + GLfloat (*c)[4] = ccolor[term]; for (i = 0; i < n; i++) { ASSIGN_4V(c[i], 1.0F, 1.0F, 1.0F, 1.0F); } - argRGB[j] = (const GLfloat (*)[4]) ccolor[j]; + argRGB[term] = (const GLfloat (*)[4]) ccolor[term]; } break; default: @@ -154,39 +152,42 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; - argRGB[j] = (const GLfloat (*)[4]) + argRGB[term] = (const GLfloat (*)[4]) (texelBuffer + srcUnit * (n * 4 * sizeof(GLfloat))); } } - if (textureUnit->_CurrentCombine->OperandRGB[j] != GL_SRC_COLOR) { - const GLfloat (*src)[4] = argRGB[j]; - GLfloat (*dst)[4] = ccolor[j]; + if (operandRGB != GL_SRC_COLOR) { + const GLfloat (*src)[4] = argRGB[term]; + GLfloat (*dst)[4] = ccolor[term]; - /* point to new arg[j] storage */ - argRGB[j] = (const GLfloat (*)[4]) ccolor[j]; + /* point to new arg[term] storage */ + argRGB[term] = (const GLfloat (*)[4]) ccolor[term]; - if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_ONE_MINUS_SRC_COLOR) { + switch (operandRGB) { + case GL_ONE_MINUS_SRC_COLOR: for (i = 0; i < n; i++) { dst[i][RCOMP] = 1.0F - src[i][RCOMP]; dst[i][GCOMP] = 1.0F - src[i][GCOMP]; dst[i][BCOMP] = 1.0F - src[i][BCOMP]; } - } - else if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_SRC_ALPHA) { + break; + case GL_SRC_ALPHA: for (i = 0; i < n; i++) { dst[i][RCOMP] = src[i][ACOMP]; dst[i][GCOMP] = src[i][ACOMP]; dst[i][BCOMP] = src[i][ACOMP]; } - } - else { - ASSERT(textureUnit->_CurrentCombine->OperandRGB[j] ==GL_ONE_MINUS_SRC_ALPHA); + break; + case GL_ONE_MINUS_SRC_ALPHA: for (i = 0; i < n; i++) { dst[i][RCOMP] = 1.0F - src[i][ACOMP]; dst[i][GCOMP] = 1.0F - src[i][ACOMP]; dst[i][BCOMP] = 1.0F - src[i][ACOMP]; } + break; + default: + _mesa_problem(ctx, "Bad operandRGB"); } } } @@ -194,36 +195,47 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* * Set up the argA[i] pointers */ - for (j = 0; j < numAlphaArgs; j++) { - const GLenum srcA = textureUnit->_CurrentCombine->SourceA[j]; + for (term = 0; term < numAlphaArgs; term++) { + const GLenum srcA = combine->SourceA[term]; + const GLenum operandA = combine->OperandA[term]; switch (srcA) { case GL_TEXTURE: - argA[j] = (const GLfloat (*)[4]) + argA[term] = (const GLfloat (*)[4]) (texelBuffer + unit * (n * 4 * sizeof(GLfloat))); break; case GL_PRIMARY_COLOR: - argA[j] = primary_rgba; + argA[term] = primary_rgba; break; case GL_PREVIOUS: - argA[j] = (const GLfloat (*)[4]) rgba; + argA[term] = (const GLfloat (*)[4]) rgba; break; case GL_CONSTANT: { - GLfloat alpha, (*c)[4] = ccolor[j]; - alpha = textureUnit->EnvColor[3]; + GLfloat (*c)[4] = ccolor[term]; + GLfloat alpha = textureUnit->EnvColor[3]; for (i = 0; i < n; i++) c[i][ACOMP] = alpha; - argA[j] = (const GLfloat (*)[4]) ccolor[j]; + argA[term] = (const GLfloat (*)[4]) ccolor[term]; } break; /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. */ case GL_ZERO: - argA[j] = & zero; + { + GLfloat (*c)[4] = ccolor[term]; + for (i = 0; i < n; i++) + c[i][ACOMP] = 0.0F; + argA[term] = (const GLfloat (*)[4]) ccolor[term]; + } break; case GL_ONE: - argA[j] = & one; + { + GLfloat (*c)[4] = ccolor[term]; + for (i = 0; i < n; i++) + c[i][ACOMP] = 1.0F; + argA[term] = (const GLfloat (*)[4]) ccolor[term]; + } break; default: /* ARB_texture_env_crossbar source */ @@ -232,62 +244,46 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; - argA[j] = (const GLfloat (*)[4]) + argA[term] = (const GLfloat (*)[4]) (texelBuffer + srcUnit * (n * 4 * sizeof(GLfloat))); } } - if (textureUnit->_CurrentCombine->OperandA[j] == GL_ONE_MINUS_SRC_ALPHA) { - const GLfloat (*src)[4] = argA[j]; - GLfloat (*dst)[4] = ccolor[j]; - argA[j] = (const GLfloat (*)[4]) ccolor[j]; + if (operandA == GL_ONE_MINUS_SRC_ALPHA) { + const GLfloat (*src)[4] = argA[term]; + GLfloat (*dst)[4] = ccolor[term]; + argA[term] = (const GLfloat (*)[4]) ccolor[term]; for (i = 0; i < n; i++) { dst[i][ACOMP] = 1.0F - src[i][ACOMP]; } } } - /* - * Do the texture combine. - */ - switch (textureUnit->_CurrentCombine->ModeRGB) { + /* RGB channel combine */ + { + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; + const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argRGB[3]; + + switch (combine->ModeRGB) { case GL_REPLACE: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - if (RGBshift) { - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult; - rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult; - rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult; - } - } - else { - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = arg0[i][RCOMP]; - rgba[i][GCOMP] = arg0[i][GCOMP]; - rgba[i][BCOMP] = arg0[i][BCOMP]; - } - } + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult; + rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult; + rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult; } break; case GL_MODULATE: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult; - rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult; - rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult; - } + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult; + rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult; + rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult; } break; case GL_ADD: if (textureUnit->EnvMode == GL_COMBINE4_NV) { /* (a * b) + (c * d) */ - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; - const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argRGB[3]; for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] + arg2[i][RCOMP] * arg3[i][RCOMP]) * RGBmult; @@ -299,8 +295,6 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } else { /* 2-term addition */ - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult; @@ -311,10 +305,6 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, case GL_ADD_SIGNED: if (textureUnit->EnvMode == GL_COMBINE4_NV) { /* (a * b) + (c * d) - 0.5 */ - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; - const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argRGB[3]; for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] * arg2[i][RCOMP] + arg3[i][RCOMP] - 0.5) * RGBmult; @@ -325,8 +315,6 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } } else { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult; @@ -335,106 +323,74 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } break; case GL_INTERPOLATE: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] + - arg1[i][RCOMP] * (1.0F - arg2[i][RCOMP])) * RGBmult; - rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] + - arg1[i][GCOMP] * (1.0F - arg2[i][GCOMP])) * RGBmult; - rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] + - arg1[i][BCOMP] * (1.0F - arg2[i][BCOMP])) * RGBmult; - } + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] + + arg1[i][RCOMP] * (1.0F - arg2[i][RCOMP])) * RGBmult; + rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] + + arg1[i][GCOMP] * (1.0F - arg2[i][GCOMP])) * RGBmult; + rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] + + arg1[i][BCOMP] * (1.0F - arg2[i][BCOMP])) * RGBmult; } break; case GL_SUBTRACT: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult; - rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult; - rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult; - } + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult; } break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: - { - /* Do not scale the result by 1 2 or 4 */ - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - for (i = 0; i < n; i++) { - GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + - (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + - (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) - * 4.0F; - dot = CLAMP(dot, 0.0F, 1.0F); - rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; - } + /* Do not scale the result by 1 2 or 4 */ + for (i = 0; i < n; i++) { + GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + + (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + + (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) + * 4.0F; + dot = CLAMP(dot, 0.0F, 1.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; } break; case GL_DOT3_RGB: case GL_DOT3_RGBA: - { - /* DO scale the result by 1 2 or 4 */ - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - for (i = 0; i < n; i++) { - GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + - (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + - (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) - * 4.0F * RGBmult; - dot = CLAMP(dot, 0.0, 1.0F); - rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; - } + /* DO scale the result by 1 2 or 4 */ + for (i = 0; i < n; i++) { + GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + + (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + + (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) + * 4.0F * RGBmult; + dot = CLAMP(dot, 0.0, 1.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; } break; case GL_MODULATE_ADD_ATI: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + - arg1[i][RCOMP]) * RGBmult; - rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + - arg1[i][GCOMP]) * RGBmult; - rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + - arg1[i][BCOMP]) * RGBmult; - } + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + + arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + + arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + + arg1[i][BCOMP]) * RGBmult; } break; case GL_MODULATE_SIGNED_ADD_ATI: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + - arg1[i][RCOMP] - 0.5) * RGBmult; - rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + - arg1[i][GCOMP] - 0.5) * RGBmult; - rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + - arg1[i][BCOMP] - 0.5) * RGBmult; - } + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + + arg1[i][RCOMP] - 0.5) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + + arg1[i][GCOMP] - 0.5) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + + arg1[i][BCOMP] - 0.5) * RGBmult; } break; case GL_MODULATE_SUBTRACT_ATI: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - - arg1[i][RCOMP]) * RGBmult; - rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - - arg1[i][GCOMP]) * RGBmult; - rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - - arg1[i][BCOMP]) * RGBmult; - } + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - + arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - + arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - + arg1[i][BCOMP]) * RGBmult; } break; case GL_BUMP_ENVMAP_ATI: @@ -458,41 +414,31 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, return; /* no alpha processing */ default: _mesa_problem(ctx, "invalid combine mode"); + } } - switch (textureUnit->_CurrentCombine->ModeA) { + /* Alpha channel combine */ + { + const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; + const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; + const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; + const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argA[3]; + + switch (combine->ModeA) { case GL_REPLACE: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; - if (Ashift) { - for (i = 0; i < n; i++) { - GLfloat a = arg0[i][ACOMP] * Amult; - rgba[i][ACOMP] = (GLfloat) MIN2(a, 1.0F); - } - } - else { - for (i = 0; i < n; i++) { - rgba[i][ACOMP] = arg0[i][ACOMP]; - } - } + for (i = 0; i < n; i++) { + GLfloat a = arg0[i][ACOMP] * Amult; + rgba[i][ACOMP] = (GLfloat) MIN2(a, 1.0F); } break; case GL_MODULATE: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; - for (i = 0; i < n; i++) { - rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult; - } + for (i = 0; i < n; i++) { + rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult; } break; case GL_ADD: if (textureUnit->EnvMode == GL_COMBINE4_NV) { /* (a * b) + (c * d) */ - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; - const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argA[3]; for (i = 0; i < n; i++) { rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + arg2[i][ACOMP] * arg3[i][ACOMP]) * Amult; @@ -500,8 +446,6 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } else { /* two-term add */ - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; for (i = 0; i < n; i++) { rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult; } @@ -510,10 +454,6 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, case GL_ADD_SIGNED: if (textureUnit->EnvMode == GL_COMBINE4_NV) { /* (a * b) + (c * d) - 0.5 */ - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; - const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argA[3]; for (i = 0; i < n; i++) { rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + arg2[i][ACOMP] * arg3[i][ACOMP] - @@ -522,69 +462,44 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } else { /* a + b - 0.5 */ - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; for (i = 0; i < n; i++) { rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult; } } break; case GL_INTERPOLATE: - { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; - for (i=0; i_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT || - textureUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA) { + if (combine->ModeRGB == GL_DOT3_RGBA_EXT || + combine->ModeRGB == GL_DOT3_RGBA) { for (i = 0; i < n; i++) { rgba[i][ACOMP] = rgba[i][RCOMP]; } -- cgit v1.2.3 From a35ad020f9449849f7616788aa6bd9e439d6c518 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 8 Mar 2009 14:39:09 -0600 Subject: swrast: refactor depth/shadow sampling code --- src/mesa/swrast/s_texfilter.c | 533 +++++++++++++++++++++--------------------- 1 file changed, 271 insertions(+), 262 deletions(-) diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index b76de045f82..6e4144823ad 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -455,6 +455,168 @@ linear_repeat_texel_location(GLuint size, GLfloat s, } +/** + * Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode. + */ +static INLINE GLint +clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max) +{ + switch (wrapMode) { + case GL_CLAMP: + return IFLOOR( CLAMP(coord, 0.0F, max - 1) ); + case GL_CLAMP_TO_EDGE: + return IFLOOR( CLAMP(coord, 0.5F, max - 0.5F) ); + case GL_CLAMP_TO_BORDER: + return IFLOOR( CLAMP(coord, -0.5F, max + 0.5F) ); + default: + _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_nearest"); + return 0; + } +} + + +/** + * As above, but GL_LINEAR filtering. + */ +static INLINE void +clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max, + GLint *i0out, GLint *i1out, GLfloat *weight) +{ + GLfloat fcol; + GLint i0, i1; + switch (wrapMode) { + case GL_CLAMP: + /* Not exactly what the spec says, but it matches NVIDIA output */ + fcol = CLAMP(coord - 0.5F, 0.0, max-1); + i0 = IFLOOR(fcol); + i1 = i0 + 1; + break; + case GL_CLAMP_TO_EDGE: + fcol = CLAMP(coord, 0.5F, max - 0.5F); + fcol -= 0.5F; + i0 = IFLOOR(fcol); + i1 = i0 + 1; + if (i1 > max - 1) + i1 = max - 1; + break; + case GL_CLAMP_TO_BORDER: + fcol = CLAMP(coord, -0.5F, max + 0.5F); + fcol -= 0.5F; + i0 = IFLOOR(fcol); + i1 = i0 + 1; + default: + _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_linear"); + i0 = i1 = 0; + fcol = 0.0F; + } + *i0out = i0; + *i1out = i1; + *weight = FRAC(fcol); +} + + +/** + * Compute nearest integer texcoords for given texobj and coordinate. + */ +static INLINE void +nearest_texcoord(const struct gl_texture_object *texObj, + const GLfloat texcoord[4], + GLint *i, GLint *j, GLint *k) +{ + const GLint baseLevel = texObj->BaseLevel; + const struct gl_texture_image *img = texObj->Image[0][baseLevel]; + const GLint width = img->Width; + const GLint height = img->Height; + const GLint depth = img->Depth; + + switch (texObj->Target) { + case GL_TEXTURE_RECTANGLE_ARB: + *i = clamp_rect_coord_nearest(texObj->WrapS, texcoord[0], width); + *j = clamp_rect_coord_nearest(texObj->WrapT, texcoord[1], height); + *k = 0; + break; + case GL_TEXTURE_1D: + *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]); + *j = 0; + *k = 0; + break; + case GL_TEXTURE_2D: + *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]); + *j = nearest_texel_location(texObj->WrapT, img, height, texcoord[1]); + *k = 0; + break; + case GL_TEXTURE_1D_ARRAY_EXT: + *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]); + *j = clamp_rect_coord_nearest(texObj->WrapT, texcoord[1], height); + *k = 0; + break; + case GL_TEXTURE_2D_ARRAY_EXT: + *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]); + *j = nearest_texel_location(texObj->WrapT, img, height, texcoord[1]); + *k = clamp_rect_coord_nearest(texObj->WrapR, texcoord[2], depth); + break; + default: + *i = *j = *k = 0; + } +} + + +/** + * Compute linear integer texcoords for given texobj and coordinate. + */ +static INLINE void +linear_texcoord(const struct gl_texture_object *texObj, + const GLfloat texcoord[4], + GLint *i0, GLint *i1, GLint *j0, GLint *j1, GLint *slice, + GLfloat *wi, GLfloat *wj) +{ + const GLint baseLevel = texObj->BaseLevel; + const struct gl_texture_image *img = texObj->Image[0][baseLevel]; + const GLint width = img->Width; + const GLint height = img->Height; + const GLint depth = img->Depth; + + switch (texObj->Target) { + case GL_TEXTURE_RECTANGLE_ARB: + clamp_rect_coord_linear(texObj->WrapS, texcoord[0], + width, i0, i1, wi); + clamp_rect_coord_linear(texObj->WrapT, texcoord[1], + height, j0, j1, wj); + *slice = 0; + break; + + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + linear_texel_locations(texObj->WrapS, img, width, + texcoord[0], i0, i1, wi); + linear_texel_locations(texObj->WrapT, img, height, + texcoord[1], j0, j1, wj); + *slice = 0; + break; + + case GL_TEXTURE_1D_ARRAY_EXT: + linear_texel_locations(texObj->WrapS, img, width, + texcoord[0], i0, i1, wi); + *j0 = clamp_rect_coord_nearest(texObj->WrapT, texcoord[1], height); + *j1 = *j0; + *slice = 0; + break; + + case GL_TEXTURE_2D_ARRAY_EXT: + linear_texel_locations(texObj->WrapS, img, width, + texcoord[0], i0, i1, wi); + linear_texel_locations(texObj->WrapT, img, height, + texcoord[1], j0, j1, wj); + *slice = clamp_rect_coord_nearest(texObj->WrapR, texcoord[2], depth); + break; + + default: + *slice = 0; + } +} + + + /** * For linear interpolation between mipmap levels N and N+1, this function * computes N. @@ -1970,66 +2132,6 @@ sample_lambda_cube(GLcontext *ctx, /**********************************************************************/ -/** - * Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode. - */ -static INLINE GLint -clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max) -{ - switch (wrapMode) { - case GL_CLAMP: - return IFLOOR( CLAMP(coord, 0.0F, max - 1) ); - case GL_CLAMP_TO_EDGE: - return IFLOOR( CLAMP(coord, 0.5F, max - 0.5F) ); - case GL_CLAMP_TO_BORDER: - return IFLOOR( CLAMP(coord, -0.5F, max + 0.5F) ); - default: - _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_nearest"); - return 0; - } -} - - -/** - * As above, but GL_LINEAR filtering. - */ -static INLINE void -clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max, - GLint *i0out, GLint *i1out, GLfloat *weight) -{ - GLfloat fcol; - GLint i0, i1; - switch (wrapMode) { - case GL_CLAMP: - /* Not exactly what the spec says, but it matches NVIDIA output */ - fcol = CLAMP(coord - 0.5F, 0.0, max-1); - i0 = IFLOOR(fcol); - i1 = i0 + 1; - break; - case GL_CLAMP_TO_EDGE: - fcol = CLAMP(coord, 0.5F, max - 0.5F); - fcol -= 0.5F; - i0 = IFLOOR(fcol); - i1 = i0 + 1; - if (i1 > max - 1) - i1 = max - 1; - break; - case GL_CLAMP_TO_BORDER: - fcol = CLAMP(coord, -0.5F, max + 0.5F); - fcol -= 0.5F; - i0 = IFLOOR(fcol); - i1 = i0 + 1; - default: - _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_linear"); - i0 = i1 = 0; - fcol = 0.0F; - } - *i0out = i0; - *i1out = i1; - *weight = FRAC(fcol); -} - - static void sample_nearest_rect(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, @@ -2753,6 +2855,102 @@ sample_lambda_1d_array(GLcontext *ctx, } +/** + * Compare texcoord against depth sample. Return 1.0 or the ambient value. + */ +static INLINE GLfloat +shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample, + GLfloat ambient) +{ + switch (function) { + case GL_LEQUAL: + return (coord <= depthSample) ? 1.0F : ambient; + case GL_GEQUAL: + return (coord >= depthSample) ? 1.0F : ambient; + case GL_LESS: + return (coord < depthSample) ? 1.0F : ambient; + case GL_GREATER: + return (coord > depthSample) ? 1.0F : ambient; + case GL_EQUAL: + return (coord == depthSample) ? 1.0F : ambient; + case GL_NOTEQUAL: + return (coord != depthSample) ? 1.0F : ambient; + case GL_ALWAYS: + return 1.0F; + case GL_NEVER: + return ambient; + case GL_NONE: + return depthSample; + default: + _mesa_problem(NULL, "Bad compare func in shadow_compare"); + return ambient; + } +} + + +/** + * Compare texcoord against four depth samples. + */ +static INLINE GLfloat +shadow_compare4(GLenum function, GLfloat coord, + GLfloat depth00, GLfloat depth01, + GLfloat depth10, GLfloat depth11, + GLfloat ambient, GLfloat wi, GLfloat wj) +{ + const GLfloat d = (1.0F - (GLfloat) ambient) * 0.25F; + GLfloat luminance = 1.0F; + + switch (function) { + case GL_LEQUAL: + if (depth00 <= coord) luminance -= d; + if (depth01 <= coord) luminance -= d; + if (depth10 <= coord) luminance -= d; + if (depth11 <= coord) luminance -= d; + return luminance; + case GL_GEQUAL: + if (depth00 >= coord) luminance -= d; + if (depth01 >= coord) luminance -= d; + if (depth10 >= coord) luminance -= d; + if (depth11 >= coord) luminance -= d; + return luminance; + case GL_LESS: + if (depth00 < coord) luminance -= d; + if (depth01 < coord) luminance -= d; + if (depth10 < coord) luminance -= d; + if (depth11 < coord) luminance -= d; + return luminance; + case GL_GREATER: + if (depth00 > coord) luminance -= d; + if (depth01 > coord) luminance -= d; + if (depth10 > coord) luminance -= d; + if (depth11 > coord) luminance -= d; + return luminance; + case GL_EQUAL: + if (depth00 == coord) luminance -= d; + if (depth01 == coord) luminance -= d; + if (depth10 == coord) luminance -= d; + if (depth11 == coord) luminance -= d; + return luminance; + case GL_NOTEQUAL: + if (depth00 != coord) luminance -= d; + if (depth01 != coord) luminance -= d; + if (depth10 != coord) luminance -= d; + if (depth11 != coord) luminance -= d; + return luminance; + case GL_ALWAYS: + return 0.0; + case GL_NEVER: + return ambient; + case GL_NONE: + /* ordinary bilinear filtering */ + return lerp_2d(wi, wj, depth00, depth10, depth01, depth11); + default: + _mesa_problem(NULL, "Bad compare func in sample_depth_texture"); + return 0.0F; + } +} + + /** * Sample a shadow/depth texture. */ @@ -2797,45 +2995,7 @@ sample_depth_texture( GLcontext *ctx, GLfloat depthSample; GLint col, row, slice; - switch (tObj->Target) { - case GL_TEXTURE_RECTANGLE_ARB: - col = clamp_rect_coord_nearest(tObj->WrapS, texcoords[i][0], width); - row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height); - slice = 0; - break; - - case GL_TEXTURE_1D: - col = nearest_texel_location(tObj->WrapS, img, width, - texcoords[i][0]); - row = 0; - slice = 0; - break; - - case GL_TEXTURE_2D: - col = nearest_texel_location(tObj->WrapS, img, width, - texcoords[i][0]); - row = nearest_texel_location(tObj->WrapT, img, height, - texcoords[i][1]); - slice = 0; - break; - - case GL_TEXTURE_1D_ARRAY_EXT: - col = nearest_texel_location(tObj->WrapS, img, width, - texcoords[i][0]); - row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height); - slice = 0; - break; - - case GL_TEXTURE_2D_ARRAY_EXT: - col = nearest_texel_location(tObj->WrapS, img, width, - texcoords[i][0]); - row = nearest_texel_location(tObj->WrapT, img, height, - texcoords[i][1]); - slice = clamp_rect_coord_nearest(tObj->WrapR, texcoords[i][2], depth); - break; - default: - col = row = slice = 0; - } + nearest_texcoord(tObj, texcoords[i], &col, &row, &slice); if (col >= 0 && row >= 0 && col < width && row < height && slice >= 0 && slice < depth) { @@ -2845,38 +3005,8 @@ sample_depth_texture( GLcontext *ctx, depthSample = tObj->BorderColor[0]; } - switch (function) { - case GL_LEQUAL: - result = (texcoords[i][compare_coord] <= depthSample) ? 1.0F : ambient; - break; - case GL_GEQUAL: - result = (texcoords[i][compare_coord] >= depthSample) ? 1.0F : ambient; - break; - case GL_LESS: - result = (texcoords[i][compare_coord] < depthSample) ? 1.0F : ambient; - break; - case GL_GREATER: - result = (texcoords[i][compare_coord] > depthSample) ? 1.0F : ambient; - break; - case GL_EQUAL: - result = (texcoords[i][compare_coord] == depthSample) ? 1.0F : ambient; - break; - case GL_NOTEQUAL: - result = (texcoords[i][compare_coord] != depthSample) ? 1.0F : ambient; - break; - case GL_ALWAYS: - result = 1.0F; - break; - case GL_NEVER: - result = ambient; - break; - case GL_NONE: - result = depthSample; - break; - default: - _mesa_problem(ctx, "Bad compare func in sample_depth_texture"); - return; - } + result = shadow_compare(function, texcoords[i][compare_coord], + depthSample, ambient); switch (tObj->DepthMode) { case GL_LUMINANCE: @@ -2900,45 +3030,11 @@ sample_depth_texture( GLcontext *ctx, GLfloat depth00, depth01, depth10, depth11; GLint i0, i1, j0, j1; GLint slice; - GLfloat a, b; + GLfloat wi, wj; GLuint useBorderTexel; - switch (tObj->Target) { - case GL_TEXTURE_RECTANGLE_ARB: - clamp_rect_coord_linear(tObj->WrapS, texcoords[i][0], - width, &i0, &i1, &a); - clamp_rect_coord_linear(tObj->WrapT, texcoords[i][1], - height, &j0, &j1, &b); - slice = 0; - break; - - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - linear_texel_locations(tObj->WrapS, img, width, - texcoords[i][0], &i0, &i1, &a); - linear_texel_locations(tObj->WrapT, img, height, - texcoords[i][1], &j0, &j1, &b); - slice = 0; - break; - - case GL_TEXTURE_1D_ARRAY_EXT: - linear_texel_locations(tObj->WrapS, img, width, - texcoords[i][0], &i0, &i1, &a); - j0 = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height); - j1 = j0; - slice = 0; - break; - - case GL_TEXTURE_2D_ARRAY_EXT: - linear_texel_locations(tObj->WrapS, img, width, - texcoords[i][0], &i0, &i1, &a); - linear_texel_locations(tObj->WrapT, img, height, - texcoords[i][1], &j0, &j1, &b); - slice = clamp_rect_coord_nearest(tObj->WrapR, texcoords[i][2], depth); - break; - default: - slice = 0; - } + linear_texcoord(tObj, texcoords[i], &i0, &i1, &j0, &j1, &slice, + &wi, &wj); useBorderTexel = 0; if (img->Border) { @@ -2997,111 +3093,24 @@ sample_depth_texture( GLcontext *ctx, } } - if (0) { - /* compute a single weighted depth sample and do one comparison */ - const GLfloat depthSample - = lerp_2d(a, b, depth00, depth10, depth01, depth11); - if ((depthSample <= texcoords[i][compare_coord] && function == GL_LEQUAL) || - (depthSample >= texcoords[i][compare_coord] && function == GL_GEQUAL)) { - result = ambient; - } - else { - result = CHAN_MAX; - } - } - else { - /* Do four depth/R comparisons and compute a weighted result. - * If this touches on somebody's I.P., I'll remove this code - * upon request. - */ - const GLfloat d = (CHAN_MAXF - (GLfloat) ambient) * 0.25F; - GLfloat luminance = CHAN_MAXF; - - switch (function) { - case GL_LEQUAL: - if (depth00 <= texcoords[i][compare_coord]) luminance -= d; - if (depth01 <= texcoords[i][compare_coord]) luminance -= d; - if (depth10 <= texcoords[i][compare_coord]) luminance -= d; - if (depth11 <= texcoords[i][compare_coord]) luminance -= d; - result = (GLfloat) luminance; - break; - case GL_GEQUAL: - if (depth00 >= texcoords[i][compare_coord]) luminance -= d; - if (depth01 >= texcoords[i][compare_coord]) luminance -= d; - if (depth10 >= texcoords[i][compare_coord]) luminance -= d; - if (depth11 >= texcoords[i][compare_coord]) luminance -= d; - result = (GLfloat) luminance; - break; - case GL_LESS: - if (depth00 < texcoords[i][compare_coord]) luminance -= d; - if (depth01 < texcoords[i][compare_coord]) luminance -= d; - if (depth10 < texcoords[i][compare_coord]) luminance -= d; - if (depth11 < texcoords[i][compare_coord]) luminance -= d; - result = (GLfloat) luminance; - break; - case GL_GREATER: - if (depth00 > texcoords[i][compare_coord]) luminance -= d; - if (depth01 > texcoords[i][compare_coord]) luminance -= d; - if (depth10 > texcoords[i][compare_coord]) luminance -= d; - if (depth11 > texcoords[i][compare_coord]) luminance -= d; - result = (GLfloat) luminance; - break; - case GL_EQUAL: - if (depth00 == texcoords[i][compare_coord]) luminance -= d; - if (depth01 == texcoords[i][compare_coord]) luminance -= d; - if (depth10 == texcoords[i][compare_coord]) luminance -= d; - if (depth11 == texcoords[i][compare_coord]) luminance -= d; - result = (GLfloat) luminance; - break; - case GL_NOTEQUAL: - if (depth00 != texcoords[i][compare_coord]) luminance -= d; - if (depth01 != texcoords[i][compare_coord]) luminance -= d; - if (depth10 != texcoords[i][compare_coord]) luminance -= d; - if (depth11 != texcoords[i][compare_coord]) luminance -= d; - result = (GLfloat) luminance; - break; - case GL_ALWAYS: - result = 0; - break; - case GL_NEVER: - result = CHAN_MAX; - break; - case GL_NONE: - /* ordinary bilinear filtering */ - { - const GLfloat depthSample - = lerp_2d(a, b, depth00, depth10, depth01, depth11); - CLAMPED_FLOAT_TO_CHAN(result, depthSample); - } - break; - default: - _mesa_problem(ctx, "Bad compare func in sample_depth_texture"); - return; - } - } + result = shadow_compare4(function, texcoords[i][compare_coord], + depth00, depth01, depth10, depth11, + ambient, wi, wj); switch (tObj->DepthMode) { case GL_LUMINANCE: - texel[i][RCOMP] = result; - texel[i][GCOMP] = result; - texel[i][BCOMP] = result; - texel[i][ACOMP] = CHAN_MAX; + ASSIGN_4V(texel[i], result, result, result, 1.0F); break; case GL_INTENSITY: - texel[i][RCOMP] = result; - texel[i][GCOMP] = result; - texel[i][BCOMP] = result; - texel[i][ACOMP] = result; + ASSIGN_4V(texel[i], result, result, result, result); break; case GL_ALPHA: - texel[i][RCOMP] = 0; - texel[i][GCOMP] = 0; - texel[i][BCOMP] = 0; - texel[i][ACOMP] = result; + ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result); break; default: _mesa_problem(ctx, "Bad depth texture mode"); } + } /* for */ } /* if filter */ } -- cgit v1.2.3 From bd9b2be8284fda3f8aac235908ded118b5648a38 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 8 Mar 2009 17:58:54 -0600 Subject: mesa: texture combine clean-ups Use MAX_COMBINER_TERMS instead of 4. Rename some vars. Update comments. --- src/mesa/main/mtypes.h | 15 +++-- src/mesa/main/texenv.c | 50 +++++++-------- src/mesa/main/texenvprogram.c | 13 ++-- src/mesa/swrast/s_fragprog.c | 2 - src/mesa/swrast/s_texcombine.c | 140 ++++++++++++++++++++--------------------- 5 files changed, 108 insertions(+), 112 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index e77dd1d226a..c1f06885ec4 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1338,18 +1338,23 @@ struct gl_texture_object }; +/** Up to four combiner sources are possible with GL_NV_texture_env_combine4 */ +#define MAX_COMBINER_TERMS 4 + + /** * Texture combine environment state. - * Up to four combiner sources are possible with GL_NV_texture_env_combine4. */ struct gl_tex_env_combine_state { GLenum ModeRGB; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ GLenum ModeA; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ - GLenum SourceRGB[4]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ - GLenum SourceA[4]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ - GLenum OperandRGB[4]; /**< SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */ - GLenum OperandA[4]; /**< SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */ + /** Source terms: GL_PRIMARY_COLOR, GL_TEXTURE, etc */ + GLenum SourceRGB[MAX_COMBINER_TERMS]; + GLenum SourceA[MAX_COMBINER_TERMS]; + /** Source operands: GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, etc */ + GLenum OperandRGB[MAX_COMBINER_TERMS]; + GLenum OperandA[MAX_COMBINER_TERMS]; GLuint ScaleShiftRGB; /**< 0, 1 or 2 */ GLuint ScaleShiftA; /**< 0, 1 or 2 */ GLuint _NumArgsRGB; /**< Number of inputs used for the RGB combiner */ diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index c2960fc8208..4d511f2f7ed 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -184,7 +184,7 @@ set_combiner_source(GLcontext *ctx, struct gl_texture_unit *texUnit, GLenum pname, GLenum param) { - GLuint src; + GLuint term; GLboolean alpha, legal; if (!ctx->Extensions.EXT_texture_env_combine && @@ -194,24 +194,24 @@ set_combiner_source(GLcontext *ctx, } /* - * Translate pname to (src, alpha). + * Translate pname to (term, alpha). */ switch (pname) { case GL_SOURCE0_RGB: - src = 0; + term = 0; alpha = GL_FALSE; break; case GL_SOURCE1_RGB: - src = 1; + term = 1; alpha = GL_FALSE; break; case GL_SOURCE2_RGB: - src = 2; + term = 2; alpha = GL_FALSE; break; case GL_SOURCE3_RGB_NV: if (ctx->Extensions.NV_texture_env_combine4) { - src = 3; + term = 3; alpha = GL_FALSE; } else { @@ -220,20 +220,20 @@ set_combiner_source(GLcontext *ctx, } break; case GL_SOURCE0_ALPHA: - src = 0; + term = 0; alpha = GL_TRUE; break; case GL_SOURCE1_ALPHA: - src = 1; + term = 1; alpha = GL_TRUE; break; case GL_SOURCE2_ALPHA: - src = 2; + term = 2; alpha = GL_TRUE; break; case GL_SOURCE3_ALPHA_NV: if (ctx->Extensions.NV_texture_env_combine4) { - src = 3; + term = 3; alpha = GL_TRUE; } else { @@ -246,7 +246,7 @@ set_combiner_source(GLcontext *ctx, return; } - assert(src < 4); + assert(term < MAX_COMBINER_TERMS); /* * Error-check param (the source term) @@ -288,9 +288,9 @@ set_combiner_source(GLcontext *ctx, FLUSH_VERTICES(ctx, _NEW_TEXTURE); if (alpha) - texUnit->Combine.SourceA[src] = param; + texUnit->Combine.SourceA[term] = param; else - texUnit->Combine.SourceRGB[src] = param; + texUnit->Combine.SourceRGB[term] = param; } @@ -300,7 +300,7 @@ set_combiner_operand(GLcontext *ctx, struct gl_texture_unit *texUnit, GLenum pname, GLenum param) { - GLuint op; + GLuint term; GLboolean alpha, legal; if (!ctx->Extensions.EXT_texture_env_combine && @@ -311,16 +311,16 @@ set_combiner_operand(GLcontext *ctx, switch (pname) { case GL_OPERAND0_RGB: - op = 0; + term = 0; alpha = GL_FALSE; break; case GL_OPERAND1_RGB: - op = 1; + term = 1; alpha = GL_FALSE; break; case GL_OPERAND2_RGB: if (ctx->Extensions.ARB_texture_env_combine) { - op = 2; + term = 2; alpha = GL_FALSE; } else { @@ -330,7 +330,7 @@ set_combiner_operand(GLcontext *ctx, break; case GL_OPERAND3_RGB_NV: if (ctx->Extensions.NV_texture_env_combine4) { - op = 3; + term = 3; alpha = GL_FALSE; } else { @@ -339,16 +339,16 @@ set_combiner_operand(GLcontext *ctx, } break; case GL_OPERAND0_ALPHA: - op = 0; + term = 0; alpha = GL_TRUE; break; case GL_OPERAND1_ALPHA: - op = 1; + term = 1; alpha = GL_TRUE; break; case GL_OPERAND2_ALPHA: if (ctx->Extensions.ARB_texture_env_combine) { - op = 2; + term = 2; alpha = GL_TRUE; } else { @@ -358,7 +358,7 @@ set_combiner_operand(GLcontext *ctx, break; case GL_OPERAND3_ALPHA_NV: if (ctx->Extensions.NV_texture_env_combine4) { - op = 3; + term = 3; alpha = GL_TRUE; } else { @@ -371,7 +371,7 @@ set_combiner_operand(GLcontext *ctx, return; } - assert(op < 4); + assert(term < MAX_COMBINER_TERMS); /* * Error-check param (the source operand) @@ -397,9 +397,9 @@ set_combiner_operand(GLcontext *ctx, FLUSH_VERTICES(ctx, _NEW_TEXTURE); if (alpha) - texUnit->Combine.OperandA[op] = param; + texUnit->Combine.OperandA[term] = param; else - texUnit->Combine.OperandRGB[op] = param; + texUnit->Combine.OperandRGB[term] = param; } diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 3fbd119b347..4a124bf27e2 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -39,9 +39,6 @@ #include "texenvprogram.h" -#define MAX_TERMS 4 - - /* * Note on texture units: * @@ -95,11 +92,11 @@ struct state_key { GLuint NumArgsRGB:3; GLuint ModeRGB:5; - struct mode_opt OptRGB[MAX_TERMS]; + struct mode_opt OptRGB[MAX_COMBINER_TERMS]; GLuint NumArgsA:3; GLuint ModeA:5; - struct mode_opt OptA[MAX_TERMS]; + struct mode_opt OptA[MAX_COMBINER_TERMS]; } unit[8]; }; @@ -389,7 +386,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) key->unit[i].ScaleShiftRGB = texUnit->_CurrentCombine->ScaleShiftRGB; key->unit[i].ScaleShiftA = texUnit->_CurrentCombine->ScaleShiftA; - for (j = 0; j < MAX_TERMS; j++) { + for (j = 0; j < MAX_COMBINER_TERMS; j++) { key->unit[i].OptRGB[j].Operand = translate_operand(texUnit->_CurrentCombine->OperandRGB[j]); key->unit[i].OptA[j].Operand = @@ -972,11 +969,11 @@ static struct ureg emit_combine( struct texenv_fragment_program *p, GLuint mode, const struct mode_opt *opt) { - struct ureg src[MAX_TERMS]; + struct ureg src[MAX_COMBINER_TERMS]; struct ureg tmp, half; GLuint i; - assert(nr <= MAX_TERMS); + assert(nr <= MAX_COMBINER_TERMS); tmp = undef; /* silence warning (bug 5318) */ diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 5f032bbd69d..b71fb9eae97 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -74,7 +74,6 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); - /* XXX use a float-valued TextureSample routine here!!! */ swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); @@ -116,7 +115,6 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); - /* XXX use a float-valued TextureSample routine here!!! */ swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 27c5c15cf16..76b95e8ae7a 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -37,23 +37,23 @@ #include "s_texcombine.h" -#define MAX_COMBINER_TERMS 4 - - /** - * Do texture application for GL_ARB/EXT_texture_env_combine. - * This function also supports GL_{EXT,ARB}_texture_env_dot3 and - * GL_ATI_texture_env_combine3. Since "classic" texture environments are - * implemented using GL_ARB_texture_env_combine-like state, this same function - * is used for classic texture environment application as well. + * Do texture application for: + * GL_EXT_texture_env_combine + * GL_ARB_texture_env_combine + * GL_EXT_texture_env_dot3 + * GL_ARB_texture_env_dot3 + * GL_ATI_texture_env_combine3 + * GL_NV_texture_env_combine4 + * conventional GL texture env modes * * \param ctx rendering context - * \param textureUnit the texture unit to apply + * \param unit the texture combiner unit * \param n number of fragments to process (span width) * \param primary_rgba incoming fragment color array * \param texelBuffer pointer to texel colors for all texture units * - * \param rgba incoming colors, which get modified here + * \param rgba incoming/result fragment colors */ static void texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, @@ -65,16 +65,14 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, const struct gl_tex_env_combine_state *combine = textureUnit->_CurrentCombine; const GLfloat (*argRGB [MAX_COMBINER_TERMS])[4]; const GLfloat (*argA [MAX_COMBINER_TERMS])[4]; - const GLfloat RGBmult = (GLfloat) (1 << combine->ScaleShiftRGB); - const GLfloat Amult = (GLfloat) (1 << combine->ScaleShiftA); - const GLuint numColorArgs = combine->_NumArgsRGB; - const GLuint numAlphaArgs = combine->_NumArgsA; + const GLfloat scaleRGB = (GLfloat) (1 << combine->ScaleShiftRGB); + const GLfloat scaleA = (GLfloat) (1 << combine->ScaleShiftA); + const GLuint numArgsRGB = combine->_NumArgsRGB; + const GLuint numArgsA = combine->_NumArgsA; GLfloat ccolor[MAX_COMBINER_TERMS][MAX_WIDTH][4]; /* temp color buffers */ GLfloat rgba[MAX_WIDTH][4]; GLuint i, term; - ASSERT(ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine); ASSERT(CONST_SWRAST_CONTEXT(ctx)->_AnyTextureCombine); for (i = 0; i < n; i++) { @@ -97,7 +95,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* * Do operand setup for up to 4 operands. Loop over the terms. */ - for (term = 0; term < numColorArgs; term++) { + for (term = 0; term < numArgsRGB; term++) { const GLenum srcRGB = combine->SourceRGB[term]; const GLenum operandRGB = combine->OperandRGB[term]; @@ -193,9 +191,9 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } /* - * Set up the argA[i] pointers + * Set up the argA[term] pointers */ - for (term = 0; term < numAlphaArgs; term++) { + for (term = 0; term < numArgsA; term++) { const GLenum srcA = combine->SourceA[term]; const GLenum operandA = combine->OperandA[term]; @@ -269,16 +267,16 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (combine->ModeRGB) { case GL_REPLACE: for (i = 0; i < n; i++) { - rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult; - rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult; - rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult; + rgba[i][RCOMP] = arg0[i][RCOMP] * scaleRGB; + rgba[i][GCOMP] = arg0[i][GCOMP] * scaleRGB; + rgba[i][BCOMP] = arg0[i][BCOMP] * scaleRGB; } break; case GL_MODULATE: for (i = 0; i < n; i++) { - rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult; - rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult; - rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult; + rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * scaleRGB; + rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * scaleRGB; + rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * scaleRGB; } break; case GL_ADD: @@ -286,19 +284,19 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* (a * b) + (c * d) */ for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] + - arg2[i][RCOMP] * arg3[i][RCOMP]) * RGBmult; + arg2[i][RCOMP] * arg3[i][RCOMP]) * scaleRGB; rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] + - arg2[i][GCOMP] * arg3[i][GCOMP]) * RGBmult; + arg2[i][GCOMP] * arg3[i][GCOMP]) * scaleRGB; rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] + - arg2[i][BCOMP] * arg3[i][BCOMP]) * RGBmult; + arg2[i][BCOMP] * arg3[i][BCOMP]) * scaleRGB; } } else { /* 2-term addition */ for (i = 0; i < n; i++) { - rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult; - rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult; - rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * RGBmult; + rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * scaleRGB; + rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * scaleRGB; + rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * scaleRGB; } } break; @@ -307,45 +305,45 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* (a * b) + (c * d) - 0.5 */ for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] * - arg2[i][RCOMP] + arg3[i][RCOMP] - 0.5) * RGBmult; + arg2[i][RCOMP] + arg3[i][RCOMP] - 0.5) * scaleRGB; rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] * - arg2[i][GCOMP] + arg3[i][GCOMP] - 0.5) * RGBmult; + arg2[i][GCOMP] + arg3[i][GCOMP] - 0.5) * scaleRGB; rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] * - arg2[i][BCOMP] + arg3[i][BCOMP] - 0.5) * RGBmult; + arg2[i][BCOMP] + arg3[i][BCOMP] - 0.5) * scaleRGB; } } else { for (i = 0; i < n; i++) { - rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult; - rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult; - rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * RGBmult; + rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * scaleRGB; + rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * scaleRGB; + rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * scaleRGB; } } break; case GL_INTERPOLATE: for (i = 0; i < n; i++) { rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] + - arg1[i][RCOMP] * (1.0F - arg2[i][RCOMP])) * RGBmult; + arg1[i][RCOMP] * (1.0F - arg2[i][RCOMP])) * scaleRGB; rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] + - arg1[i][GCOMP] * (1.0F - arg2[i][GCOMP])) * RGBmult; + arg1[i][GCOMP] * (1.0F - arg2[i][GCOMP])) * scaleRGB; rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] + - arg1[i][BCOMP] * (1.0F - arg2[i][BCOMP])) * RGBmult; + arg1[i][BCOMP] * (1.0F - arg2[i][BCOMP])) * scaleRGB; } break; case GL_SUBTRACT: for (i = 0; i < n; i++) { - rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult; - rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult; - rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult; + rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * scaleRGB; + rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * scaleRGB; + rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * scaleRGB; } break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: /* Do not scale the result by 1 2 or 4 */ for (i = 0; i < n; i++) { - GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + - (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + - (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) + GLfloat dot = ((arg0[i][RCOMP] - 0.5F) * (arg1[i][RCOMP] - 0.5F) + + (arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) + + (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F)) * 4.0F; dot = CLAMP(dot, 0.0F, 1.0F); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; @@ -355,10 +353,10 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, case GL_DOT3_RGBA: /* DO scale the result by 1 2 or 4 */ for (i = 0; i < n; i++) { - GLfloat dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + - (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + - (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) - * 4.0F * RGBmult; + GLfloat dot = ((arg0[i][RCOMP] - 0.5F) * (arg1[i][RCOMP] - 0.5F) + + (arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) + + (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F)) + * 4.0F * scaleRGB; dot = CLAMP(dot, 0.0, 1.0F); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; } @@ -366,31 +364,31 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, case GL_MODULATE_ADD_ATI: for (i = 0; i < n; i++) { rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + - arg1[i][RCOMP]) * RGBmult; + arg1[i][RCOMP]) * scaleRGB; rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + - arg1[i][GCOMP]) * RGBmult; + arg1[i][GCOMP]) * scaleRGB; rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + - arg1[i][BCOMP]) * RGBmult; + arg1[i][BCOMP]) * scaleRGB; } break; case GL_MODULATE_SIGNED_ADD_ATI: for (i = 0; i < n; i++) { rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + - arg1[i][RCOMP] - 0.5) * RGBmult; + arg1[i][RCOMP] - 0.5) * scaleRGB; rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + - arg1[i][GCOMP] - 0.5) * RGBmult; + arg1[i][GCOMP] - 0.5) * scaleRGB; rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + - arg1[i][BCOMP] - 0.5) * RGBmult; + arg1[i][BCOMP] - 0.5) * scaleRGB; } break; case GL_MODULATE_SUBTRACT_ATI: for (i = 0; i < n; i++) { rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - - arg1[i][RCOMP]) * RGBmult; + arg1[i][RCOMP]) * scaleRGB; rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - - arg1[i][GCOMP]) * RGBmult; + arg1[i][GCOMP]) * scaleRGB; rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - - arg1[i][BCOMP]) * RGBmult; + arg1[i][BCOMP]) * scaleRGB; } break; case GL_BUMP_ENVMAP_ATI: @@ -427,13 +425,13 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (combine->ModeA) { case GL_REPLACE: for (i = 0; i < n; i++) { - GLfloat a = arg0[i][ACOMP] * Amult; + GLfloat a = arg0[i][ACOMP] * scaleA; rgba[i][ACOMP] = (GLfloat) MIN2(a, 1.0F); } break; case GL_MODULATE: for (i = 0; i < n; i++) { - rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult; + rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * scaleA; } break; case GL_ADD: @@ -441,13 +439,13 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* (a * b) + (c * d) */ for (i = 0; i < n; i++) { rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + - arg2[i][ACOMP] * arg3[i][ACOMP]) * Amult; + arg2[i][ACOMP] * arg3[i][ACOMP]) * scaleA; } } else { /* two-term add */ for (i = 0; i < n; i++) { - rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult; + rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * scaleA; } } break; @@ -457,13 +455,13 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, for (i = 0; i < n; i++) { rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + arg2[i][ACOMP] * arg3[i][ACOMP] - - 0.5) * Amult; + 0.5) * scaleA; } } else { /* a + b - 0.5 */ for (i = 0; i < n; i++) { - rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult; + rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * scaleA; } } break; @@ -471,30 +469,30 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, for (i=0; i Date: Sun, 8 Mar 2009 19:08:43 -0600 Subject: swrast: use float4_array typedef to simplify the code a bit --- src/mesa/swrast/s_texcombine.c | 125 +++++++++++++++++++++++------------------ 1 file changed, 71 insertions(+), 54 deletions(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 76b95e8ae7a..f783f56add6 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -37,6 +37,25 @@ #include "s_texcombine.h" +/** + * Pointer to array of float[4] + * This type makes the code below more concise and avoids a lot of casting. + */ +typedef float (*float4_array)[4]; + + +/** + * Return array of texels for given unit. + */ +static INLINE float4_array +get_texel_array(const GLfloat *texelBuffer, GLuint unit, GLuint numTexels) +{ + return (float4_array) + (texelBuffer + unit * numTexels * 4 * sizeof(GLfloat)); +} + + + /** * Do texture application for: * GL_EXT_texture_env_combine @@ -57,14 +76,14 @@ */ static void texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, - CONST GLfloat (*primary_rgba)[4], - CONST GLfloat *texelBuffer, + const float4_array primary_rgba, + const GLfloat *texelBuffer, GLchan (*rgbaChan)[4] ) { const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]); const struct gl_tex_env_combine_state *combine = textureUnit->_CurrentCombine; - const GLfloat (*argRGB [MAX_COMBINER_TERMS])[4]; - const GLfloat (*argA [MAX_COMBINER_TERMS])[4]; + float4_array argRGB[MAX_COMBINER_TERMS]; + float4_array argA[MAX_COMBINER_TERMS]; const GLfloat scaleRGB = (GLfloat) (1 << combine->ScaleShiftRGB); const GLfloat scaleA = (GLfloat) (1 << combine->ScaleShiftA); const GLuint numArgsRGB = combine->_NumArgsRGB; @@ -101,18 +120,17 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (srcRGB) { case GL_TEXTURE: - argRGB[term] = (const GLfloat (*)[4]) - (texelBuffer + unit * (n * 4 * sizeof(GLfloat))); + argRGB[term] = get_texel_array(texelBuffer, unit, n); break; case GL_PRIMARY_COLOR: argRGB[term] = primary_rgba; break; case GL_PREVIOUS: - argRGB[term] = (const GLfloat (*)[4]) rgba; + argRGB[term] = rgba; break; case GL_CONSTANT: { - GLfloat (*c)[4] = ccolor[term]; + float4_array c = ccolor[term]; GLfloat red = textureUnit->EnvColor[0]; GLfloat green = textureUnit->EnvColor[1]; GLfloat blue = textureUnit->EnvColor[2]; @@ -120,27 +138,27 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, for (i = 0; i < n; i++) { ASSIGN_4V(c[i], red, green, blue, alpha); } - argRGB[term] = (const GLfloat (*)[4]) ccolor[term]; + argRGB[term] = ccolor[term]; } break; /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. */ case GL_ZERO: { - GLfloat (*c)[4] = ccolor[term]; + float4_array c = ccolor[term]; for (i = 0; i < n; i++) { ASSIGN_4V(c[i], 0.0F, 0.0F, 0.0F, 0.0F); } - argRGB[term] = (const GLfloat (*)[4]) ccolor[term]; + argRGB[term] = ccolor[term]; } break; case GL_ONE: { - GLfloat (*c)[4] = ccolor[term]; + float4_array c = ccolor[term]; for (i = 0; i < n; i++) { ASSIGN_4V(c[i], 1.0F, 1.0F, 1.0F, 1.0F); } - argRGB[term] = (const GLfloat (*)[4]) ccolor[term]; + argRGB[term] = ccolor[term]; } break; default: @@ -150,17 +168,16 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; - argRGB[term] = (const GLfloat (*)[4]) - (texelBuffer + srcUnit * (n * 4 * sizeof(GLfloat))); + argRGB[term] = get_texel_array(texelBuffer, srcUnit, n); } } if (operandRGB != GL_SRC_COLOR) { - const GLfloat (*src)[4] = argRGB[term]; - GLfloat (*dst)[4] = ccolor[term]; + float4_array src = argRGB[term]; + float4_array dst = ccolor[term]; /* point to new arg[term] storage */ - argRGB[term] = (const GLfloat (*)[4]) ccolor[term]; + argRGB[term] = ccolor[term]; switch (operandRGB) { case GL_ONE_MINUS_SRC_COLOR: @@ -199,40 +216,39 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (srcA) { case GL_TEXTURE: - argA[term] = (const GLfloat (*)[4]) - (texelBuffer + unit * (n * 4 * sizeof(GLfloat))); + argA[term] = get_texel_array(texelBuffer, unit, n); break; case GL_PRIMARY_COLOR: argA[term] = primary_rgba; break; case GL_PREVIOUS: - argA[term] = (const GLfloat (*)[4]) rgba; + argA[term] = rgba; break; case GL_CONSTANT: { - GLfloat (*c)[4] = ccolor[term]; + float4_array c = ccolor[term]; GLfloat alpha = textureUnit->EnvColor[3]; for (i = 0; i < n; i++) c[i][ACOMP] = alpha; - argA[term] = (const GLfloat (*)[4]) ccolor[term]; + argA[term] = ccolor[term]; } break; /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. */ case GL_ZERO: { - GLfloat (*c)[4] = ccolor[term]; + float4_array c = ccolor[term]; for (i = 0; i < n; i++) c[i][ACOMP] = 0.0F; - argA[term] = (const GLfloat (*)[4]) ccolor[term]; + argA[term] = ccolor[term]; } break; case GL_ONE: { - GLfloat (*c)[4] = ccolor[term]; + float4_array c = ccolor[term]; for (i = 0; i < n; i++) c[i][ACOMP] = 1.0F; - argA[term] = (const GLfloat (*)[4]) ccolor[term]; + argA[term] = ccolor[term]; } break; default: @@ -242,15 +258,14 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; - argA[term] = (const GLfloat (*)[4]) - (texelBuffer + srcUnit * (n * 4 * sizeof(GLfloat))); + argA[term] = get_texel_array(texelBuffer, srcUnit, n); } } if (operandA == GL_ONE_MINUS_SRC_ALPHA) { - const GLfloat (*src)[4] = argA[term]; - GLfloat (*dst)[4] = ccolor[term]; - argA[term] = (const GLfloat (*)[4]) ccolor[term]; + float4_array src = argA[term]; + float4_array dst = ccolor[term]; + argA[term] = ccolor[term]; for (i = 0; i < n; i++) { dst[i][ACOMP] = 1.0F - src[i][ACOMP]; } @@ -259,10 +274,10 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* RGB channel combine */ { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argRGB[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argRGB[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argRGB[2]; - const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argRGB[3]; + float4_array arg0 = argRGB[0]; + float4_array arg1 = argRGB[1]; + float4_array arg2 = argRGB[2]; + float4_array arg3 = argRGB[3]; switch (combine->ModeRGB) { case GL_REPLACE: @@ -417,10 +432,10 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, /* Alpha channel combine */ { - const GLfloat (*arg0)[4] = (const GLfloat (*)[4]) argA[0]; - const GLfloat (*arg1)[4] = (const GLfloat (*)[4]) argA[1]; - const GLfloat (*arg2)[4] = (const GLfloat (*)[4]) argA[2]; - const GLfloat (*arg3)[4] = (const GLfloat (*)[4]) argA[3]; + float4_array arg0 = argA[0]; + float4_array arg1 = argA[1]; + float4_array arg2 = argA[2]; + float4_array arg3 = argA[3]; switch (combine->ModeA) { case GL_REPLACE: @@ -527,7 +542,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, * See GL_EXT_texture_swizzle. */ static void -swizzle_texels(GLuint swizzle, GLuint count, GLfloat (*texels)[4]) +swizzle_texels(GLuint swizzle, GLuint count, float4_array texels) { const GLuint swzR = GET_SWZ(swizzle, 0); const GLuint swzG = GET_SWZ(swizzle, 1); @@ -567,7 +582,8 @@ static void texture_apply( const GLcontext *ctx, const struct gl_texture_unit *texUnit, GLuint n, - CONST GLfloat primary_rgba[][4], CONST GLfloat texel[][4], + float4_array primary_rgba, + float4_array texel, GLchan rgbaChan[][4] ) { GLint baseLevel; @@ -940,7 +956,7 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) GLfloat primary_rgba[MAX_WIDTH][4]; GLuint unit; - ASSERT(span->end < MAX_WIDTH); + ASSERT(span->end <= MAX_WIDTH); /* * Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR) @@ -970,8 +986,13 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *curObj = texUnit->_Current; GLfloat *lambda = span->array->lambda[unit]; +#if 0 GLchan (*texels)[4] = (GLchan (*)[4]) (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan))); +#else + float4_array texels = get_texel_array(swrast->TexelBuffer, unit, + span->end); +#endif GLuint i; GLfloat rotMatrix00 = ctx->Texture.Unit[unit].RotMatrix[0]; GLfloat rotMatrix01 = ctx->Texture.Unit[unit].RotMatrix[1]; @@ -1035,14 +1056,13 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled && ctx->Texture.Unit[unit]._CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) { - const GLfloat (*texcoords)[4] - = (const GLfloat (*)[4]) + const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *curObj = texUnit->_Current; GLfloat *lambda = span->array->lambda[unit]; - GLfloat (*texels)[4] = (GLfloat (*)[4]) - (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLfloat))); + float4_array texels = + get_texel_array(swrast->TexelBuffer, unit, span->end); /* adjust texture lod (lambda) */ if (span->arrayMask & SPAN_LAMBDA) { @@ -1095,19 +1115,16 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; if (texUnit->_CurrentCombine != &texUnit->_EnvMode ) { texture_combine( ctx, unit, span->end, - (CONST GLfloat (*)[4]) primary_rgba, + primary_rgba, swrast->TexelBuffer, span->array->rgba ); } else { /* conventional texture blend */ - const GLfloat (*texels)[4] = (const GLfloat (*)[4]) - (swrast->TexelBuffer + unit * - (span->end * 4 * sizeof(GLfloat))); - - + float4_array texels = + get_texel_array(swrast->TexelBuffer, unit, span->end); texture_apply( ctx, texUnit, span->end, - (CONST GLfloat (*)[4]) primary_rgba, texels, + primary_rgba, texels, span->array->rgba ); } } -- cgit v1.2.3 From cb5bd7d4d49d84f694c9851c0a5a08f158bd3e43 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 8 Mar 2009 20:53:41 -0600 Subject: mesa: switch texel fetch functions from GLchan to GLfloat --- src/mesa/main/texformat.c | 252 ++++++++++++++++++------------------ src/mesa/main/texformat_tmp.h | 294 ++++++++++++++++++++---------------------- 2 files changed, 266 insertions(+), 280 deletions(-) diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 0d60e5ebd34..3286922f6f6 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -793,12 +793,12 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { 0, /* StencilBits */ 4, /* TexelBytes */ _mesa_texstore_rgba8888, /* StoreTexImageFunc */ - fetch_texel_1d_rgba8888, /* FetchTexel1D */ - fetch_texel_2d_rgba8888, /* FetchTexel2D */ - fetch_texel_3d_rgba8888, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_rgba8888, /* FetchTexel1Df */ + fetch_texel_2d_f_rgba8888, /* FetchTexel2Df */ + fetch_texel_3d_f_rgba8888, /* FetchTexel3Df */ store_texel_rgba8888 /* StoreTexel */ }; @@ -817,12 +817,12 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = { 0, /* StencilBits */ 4, /* TexelBytes */ _mesa_texstore_rgba8888, /* StoreTexImageFunc */ - fetch_texel_1d_rgba8888_rev, /* FetchTexel1D */ - fetch_texel_2d_rgba8888_rev, /* FetchTexel2D */ - fetch_texel_3d_rgba8888_rev, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_rgba8888_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_rgba8888_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_rgba8888_rev, /* FetchTexel3Df */ store_texel_rgba8888_rev /* StoreTexel */ }; @@ -841,12 +841,12 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { 0, /* StencilBits */ 4, /* TexelBytes */ _mesa_texstore_argb8888, /* StoreTexImageFunc */ - fetch_texel_1d_argb8888, /* FetchTexel1D */ - fetch_texel_2d_argb8888, /* FetchTexel2D */ - fetch_texel_3d_argb8888, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_argb8888, /* FetchTexel1Df */ + fetch_texel_2d_f_argb8888, /* FetchTexel2Df */ + fetch_texel_3d_f_argb8888, /* FetchTexel3Df */ store_texel_argb8888 /* StoreTexel */ }; @@ -865,12 +865,12 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = { 0, /* StencilBits */ 4, /* TexelBytes */ _mesa_texstore_argb8888, /* StoreTexImageFunc */ - fetch_texel_1d_argb8888_rev, /* FetchTexel1D */ - fetch_texel_2d_argb8888_rev, /* FetchTexel2D */ - fetch_texel_3d_argb8888_rev, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_argb8888_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_argb8888_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_argb8888_rev, /* FetchTexel3Df */ store_texel_argb8888_rev /* StoreTexel */ }; @@ -889,12 +889,12 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { 0, /* StencilBits */ 3, /* TexelBytes */ _mesa_texstore_rgb888, /* StoreTexImageFunc */ - fetch_texel_1d_rgb888, /* FetchTexel1D */ - fetch_texel_2d_rgb888, /* FetchTexel2D */ - fetch_texel_3d_rgb888, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_rgb888, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb888, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb888, /* FetchTexel3Df */ store_texel_rgb888 /* StoreTexel */ }; @@ -913,12 +913,12 @@ const struct gl_texture_format _mesa_texformat_bgr888 = { 0, /* StencilBits */ 3, /* TexelBytes */ _mesa_texstore_bgr888, /* StoreTexImageFunc */ - fetch_texel_1d_bgr888, /* FetchTexel1D */ - fetch_texel_2d_bgr888, /* FetchTexel2D */ - fetch_texel_3d_bgr888, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_bgr888, /* FetchTexel1Df */ + fetch_texel_2d_f_bgr888, /* FetchTexel2Df */ + fetch_texel_3d_f_bgr888, /* FetchTexel3Df */ store_texel_bgr888 /* StoreTexel */ }; @@ -937,12 +937,12 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_rgb565, /* StoreTexImageFunc */ - fetch_texel_1d_rgb565, /* FetchTexel1D */ - fetch_texel_2d_rgb565, /* FetchTexel2D */ - fetch_texel_3d_rgb565, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_rgb565, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb565, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb565, /* FetchTexel3Df */ store_texel_rgb565 /* StoreTexel */ }; @@ -961,12 +961,12 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_rgb565, /* StoreTexImageFunc */ - fetch_texel_1d_rgb565_rev, /* FetchTexel1D */ - fetch_texel_2d_rgb565_rev, /* FetchTexel2D */ - fetch_texel_3d_rgb565_rev, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_rgb565_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb565_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb565_rev, /* FetchTexel3Df */ store_texel_rgb565_rev /* StoreTexel */ }; @@ -985,12 +985,12 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_rgba4444, /* StoreTexImageFunc */ - fetch_texel_1d_rgba4444, /* FetchTexel1D */ - fetch_texel_2d_rgba4444, /* FetchTexel2D */ - fetch_texel_3d_rgba4444, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_rgba4444, /* FetchTexel1Df */ + fetch_texel_2d_f_rgba4444, /* FetchTexel2Df */ + fetch_texel_3d_f_rgba4444, /* FetchTexel3Df */ store_texel_rgba4444 /* StoreTexel */ }; @@ -1009,12 +1009,12 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_argb4444, /* StoreTexImageFunc */ - fetch_texel_1d_argb4444, /* FetchTexel1D */ - fetch_texel_2d_argb4444, /* FetchTexel2D */ - fetch_texel_3d_argb4444, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_argb4444, /* FetchTexel1Df */ + fetch_texel_2d_f_argb4444, /* FetchTexel2Df */ + fetch_texel_3d_f_argb4444, /* FetchTexel3Df */ store_texel_argb4444 /* StoreTexel */ }; @@ -1033,12 +1033,12 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_argb4444, /* StoreTexImageFunc */ - fetch_texel_1d_argb4444_rev, /* FetchTexel1D */ - fetch_texel_2d_argb4444_rev, /* FetchTexel2D */ - fetch_texel_3d_argb4444_rev, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_argb4444_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_argb4444_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_argb4444_rev, /* FetchTexel3Df */ store_texel_argb4444_rev /* StoreTexel */ }; @@ -1057,12 +1057,12 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_rgba5551, /* StoreTexImageFunc */ - fetch_texel_1d_rgba5551, /* FetchTexel1D */ - fetch_texel_2d_rgba5551, /* FetchTexel2D */ - fetch_texel_3d_rgba5551, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_rgba5551, /* FetchTexel1Df */ + fetch_texel_2d_f_rgba5551, /* FetchTexel2Df */ + fetch_texel_3d_f_rgba5551, /* FetchTexel3Df */ store_texel_rgba5551 /* StoreTexel */ }; @@ -1081,12 +1081,12 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_argb1555, /* StoreTexImageFunc */ - fetch_texel_1d_argb1555, /* FetchTexel1D */ - fetch_texel_2d_argb1555, /* FetchTexel2D */ - fetch_texel_3d_argb1555, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_argb1555, /* FetchTexel1Df */ + fetch_texel_2d_f_argb1555, /* FetchTexel2Df */ + fetch_texel_3d_f_argb1555, /* FetchTexel3Df */ store_texel_argb1555 /* StoreTexel */ }; @@ -1105,12 +1105,12 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_argb1555, /* StoreTexImageFunc */ - fetch_texel_1d_argb1555_rev, /* FetchTexel1D */ - fetch_texel_2d_argb1555_rev, /* FetchTexel2D */ - fetch_texel_3d_argb1555_rev, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_argb1555_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_argb1555_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_argb1555_rev, /* FetchTexel3Df */ store_texel_argb1555_rev /* StoreTexel */ }; @@ -1129,12 +1129,12 @@ const struct gl_texture_format _mesa_texformat_al88 = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_al88, /* StoreTexImageFunc */ - fetch_texel_1d_al88, /* FetchTexel1D */ - fetch_texel_2d_al88, /* FetchTexel2D */ - fetch_texel_3d_al88, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_al88, /* FetchTexel1Df */ + fetch_texel_2d_f_al88, /* FetchTexel2Df */ + fetch_texel_3d_f_al88, /* FetchTexel3Df */ store_texel_al88 /* StoreTexel */ }; @@ -1153,12 +1153,12 @@ const struct gl_texture_format _mesa_texformat_al88_rev = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_al88, /* StoreTexImageFunc */ - fetch_texel_1d_al88_rev, /* FetchTexel1D */ - fetch_texel_2d_al88_rev, /* FetchTexel2D */ - fetch_texel_3d_al88_rev, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_al88_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_al88_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_al88_rev, /* FetchTexel3Df */ store_texel_al88_rev /* StoreTexel */ }; @@ -1177,12 +1177,12 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { 0, /* StencilBits */ 1, /* TexelBytes */ _mesa_texstore_rgb332, /* StoreTexImageFunc */ - fetch_texel_1d_rgb332, /* FetchTexel1D */ - fetch_texel_2d_rgb332, /* FetchTexel2D */ - fetch_texel_3d_rgb332, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_rgb332, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb332, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb332, /* FetchTexel3Df */ store_texel_rgb332 /* StoreTexel */ }; @@ -1201,12 +1201,12 @@ const struct gl_texture_format _mesa_texformat_a8 = { 0, /* StencilBits */ 1, /* TexelBytes */ _mesa_texstore_a8, /* StoreTexImageFunc */ - fetch_texel_1d_a8, /* FetchTexel1D */ - fetch_texel_2d_a8, /* FetchTexel2D */ - fetch_texel_3d_a8, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_a8, /* FetchTexel1Df */ + fetch_texel_2d_f_a8, /* FetchTexel2Df */ + fetch_texel_3d_f_a8, /* FetchTexel3Df */ store_texel_a8 /* StoreTexel */ }; @@ -1225,12 +1225,12 @@ const struct gl_texture_format _mesa_texformat_l8 = { 0, /* StencilBits */ 1, /* TexelBytes */ _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ - fetch_texel_1d_l8, /* FetchTexel1D */ - fetch_texel_2d_l8, /* FetchTexel2D */ - fetch_texel_3d_l8, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_l8, /* FetchTexel1Df */ + fetch_texel_2d_f_l8, /* FetchTexel2Df */ + fetch_texel_3d_f_l8, /* FetchTexel3Df */ store_texel_l8 /* StoreTexel */ }; @@ -1249,12 +1249,12 @@ const struct gl_texture_format _mesa_texformat_i8 = { 0, /* StencilBits */ 1, /* TexelBytes */ _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ - fetch_texel_1d_i8, /* FetchTexel1D */ - fetch_texel_2d_i8, /* FetchTexel2D */ - fetch_texel_3d_i8, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_i8, /* FetchTexel1Df */ + fetch_texel_2d_f_i8, /* FetchTexel2Df */ + fetch_texel_3d_f_i8, /* FetchTexel3Df */ store_texel_i8 /* StoreTexel */ }; @@ -1273,12 +1273,12 @@ const struct gl_texture_format _mesa_texformat_ci8 = { 0, /* StencilBits */ 1, /* TexelBytes */ _mesa_texstore_ci8, /* StoreTexImageFunc */ - fetch_texel_1d_ci8, /* FetchTexel1D */ - fetch_texel_2d_ci8, /* FetchTexel2D */ - fetch_texel_3d_ci8, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_ci8, /* FetchTexel1Df */ + fetch_texel_2d_f_ci8, /* FetchTexel2Df */ + fetch_texel_3d_f_ci8, /* FetchTexel3Df */ store_texel_ci8 /* StoreTexel */ }; diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index ae57baf9222..b9e34f71e89 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -606,17 +606,19 @@ static void store_texel_intensity_f16(struct gl_texture_image *texImage, /* MESA_FORMAT_RGBA8888 ******************************************************/ -/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLchans */ -static void FETCH(rgba8888)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */ +static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - texel[RCOMP] = UBYTE_TO_CHAN( (s >> 24) ); - texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); - texel[BCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); - texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); + texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) ); + texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); } + + #if DIM == 3 static void store_texel_rgba8888(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) @@ -631,14 +633,14 @@ static void store_texel_rgba8888(struct gl_texture_image *texImage, /* MESA_FORMAT_RGBA888_REV ***************************************************/ /* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */ -static void FETCH(rgba8888_rev)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - texel[RCOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); - texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); - texel[BCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); - texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) ); + texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); + texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); } #if DIM == 3 @@ -655,14 +657,14 @@ static void store_texel_rgba8888_rev(struct gl_texture_image *texImage, /* MESA_FORMAT_ARGB8888 ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */ -static void FETCH(argb8888)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_argb8888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - texel[RCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); - texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); - texel[BCOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); - texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) ); + texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + texel[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); + texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); } #if DIM == 3 @@ -678,15 +680,15 @@ static void store_texel_argb8888(struct gl_texture_image *texImage, /* MESA_FORMAT_ARGB8888_REV **************************************************/ -/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLchans */ -static void FETCH(argb8888_rev)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */ +static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - texel[RCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); - texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); - texel[BCOMP] = UBYTE_TO_CHAN( (s >> 24) ); - texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); + texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) ); + texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); } #if DIM == 3 @@ -703,14 +705,14 @@ static void store_texel_argb8888_rev(struct gl_texture_image *texImage, /* MESA_FORMAT_RGB888 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ -static void FETCH(rgb888)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_rgb888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); - texel[RCOMP] = UBYTE_TO_CHAN( src[2] ); - texel[GCOMP] = UBYTE_TO_CHAN( src[1] ); - texel[BCOMP] = UBYTE_TO_CHAN( src[0] ); - texel[ACOMP] = CHAN_MAX; + texel[RCOMP] = UBYTE_TO_FLOAT( src[2] ); + texel[GCOMP] = UBYTE_TO_FLOAT( src[1] ); + texel[BCOMP] = UBYTE_TO_FLOAT( src[0] ); + texel[ACOMP] = 1.0F; } #if DIM == 3 @@ -729,14 +731,14 @@ static void store_texel_rgb888(struct gl_texture_image *texImage, /* MESA_FORMAT_BGR888 ********************************************************/ /* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */ -static void FETCH(bgr888)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_bgr888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); - texel[RCOMP] = UBYTE_TO_CHAN( src[0] ); - texel[GCOMP] = UBYTE_TO_CHAN( src[1] ); - texel[BCOMP] = UBYTE_TO_CHAN( src[2] ); - texel[ACOMP] = CHAN_MAX; + texel[RCOMP] = UBYTE_TO_FLOAT( src[0] ); + texel[GCOMP] = UBYTE_TO_FLOAT( src[1] ); + texel[BCOMP] = UBYTE_TO_FLOAT( src[2] ); + texel[ACOMP] = 1.0F; } #if DIM == 3 @@ -758,15 +760,15 @@ static void store_texel_bgr888(struct gl_texture_image *texImage, /* MESA_FORMAT_RGB565 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */ -static void FETCH(rgb565)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_rgb565)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = *src; - texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) ); - texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) ); - texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); - texel[ACOMP] = CHAN_MAX; + texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F); + texel[GCOMP] = ((s >> 5 ) & 0x3f) * (1.0F / 63.0F); + texel[BCOMP] = ((s ) & 0x1f) * (1.0F / 31.0F); + texel[ACOMP] = 1.0F; } #if DIM == 3 @@ -783,15 +785,15 @@ static void store_texel_rgb565(struct gl_texture_image *texImage, /* MESA_FORMAT_RGB565_REV ****************************************************/ /* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */ -static void FETCH(rgb565_rev)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */ - texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) ); - texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) ); - texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); - texel[ACOMP] = CHAN_MAX; + texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) ); + texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) ); + texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); + texel[ACOMP] = 1.0F; } #if DIM == 3 @@ -807,15 +809,15 @@ static void store_texel_rgb565_rev(struct gl_texture_image *texImage, /* MESA_FORMAT_RGBA4444 ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */ -static void FETCH(rgba4444)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_rgba4444)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = *src; - texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) ); - texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) | ((s >> 4) & 0xf0) ); - texel[BCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) | ((s ) & 0xf0) ); - texel[ACOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) | ((s << 4) & 0xf0) ); + texel[RCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F); + texel[GCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F); + texel[BCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F); + texel[ACOMP] = ((s ) & 0xf) * (1.0F / 15.0F); } #if DIM == 3 @@ -832,15 +834,15 @@ static void store_texel_rgba4444(struct gl_texture_image *texImage, /* MESA_FORMAT_ARGB4444 ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */ -static void FETCH(argb4444)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_argb4444)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = *src; - texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) | ((s >> 4) & 0xf0) ); - texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) | ((s ) & 0xf0) ); - texel[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) | ((s << 4) & 0xf0) ); - texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) ); + texel[RCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F); + texel[GCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F); + texel[BCOMP] = ((s ) & 0xf) * (1.0F / 15.0F); + texel[ACOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F); } #if DIM == 3 @@ -857,14 +859,14 @@ static void store_texel_argb4444(struct gl_texture_image *texImage, /* MESA_FORMAT_ARGB4444_REV **************************************************/ /* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */ -static void FETCH(argb4444_rev)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - texel[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) | ((s << 4) & 0xf0) ); - texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) ); - texel[BCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) | ((s >> 4) & 0xf0) ); - texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) | ((s ) & 0xf0) ); + texel[RCOMP] = ((s ) & 0xf) * (1.0F / 15.0F); + texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F); + texel[BCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F); + texel[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F); } #if DIM == 3 @@ -880,15 +882,15 @@ static void store_texel_argb4444_rev(struct gl_texture_image *texImage, /* MESA_FORMAT_RGBA5551 ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ -static void FETCH(rgba5551)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = *src; - texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) ); - texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xf8) | ((s >> 8) & 0x7) ); - texel[BCOMP] = UBYTE_TO_CHAN( ((s << 2) & 0xf8) | ((s >> 3) & 0x7) ); - texel[ACOMP] = UBYTE_TO_CHAN( ((s) & 0x01) ? 255 : 0); + texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F); + texel[GCOMP] = ((s >> 6) & 0x1f) * (1.0F / 31.0F); + texel[BCOMP] = ((s >> 1) & 0x1f) * (1.0F / 31.0F); + texel[ACOMP] = ((s ) & 0x01) * 1.0F; } #if DIM == 3 @@ -904,15 +906,15 @@ static void store_texel_rgba5551(struct gl_texture_image *texImage, /* MESA_FORMAT_ARGB1555 ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ -static void FETCH(argb1555)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_argb1555)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = *src; - texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) ); - texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) ); - texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); - texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 ); + texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F); + texel[GCOMP] = ((s >> 5) & 0x1f) * (1.0F / 31.0F); + texel[BCOMP] = ((s >> 0) & 0x1f) * (1.0F / 31.0F); + texel[ACOMP] = ((s >> 15) & 0x01) * 1.0F; } #if DIM == 3 @@ -929,15 +931,15 @@ static void store_texel_argb1555(struct gl_texture_image *texImage, /* MESA_FORMAT_ARGB1555_REV **************************************************/ /* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */ -static void FETCH(argb1555_rev)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */ - texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) ); - texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) ); - texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); - texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 ); + texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) ); + texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) ); + texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); + texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 ); } #if DIM == 3 @@ -954,14 +956,14 @@ static void store_texel_argb1555_rev(struct gl_texture_image *texImage, /* MESA_FORMAT_AL88 **********************************************************/ /* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */ -static void FETCH(al88)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_al88)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[RCOMP] = texel[GCOMP] = - texel[BCOMP] = UBYTE_TO_CHAN( s & 0xff ); - texel[ACOMP] = UBYTE_TO_CHAN( s >> 8 ); + texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff ); + texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 ); } #if DIM == 3 @@ -978,14 +980,14 @@ static void store_texel_al88(struct gl_texture_image *texImage, /* MESA_FORMAT_AL88_REV ******************************************************/ /* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */ -static void FETCH(al88_rev)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[RCOMP] = texel[GCOMP] = - texel[BCOMP] = UBYTE_TO_CHAN( s >> 8 ); - texel[ACOMP] = UBYTE_TO_CHAN( s & 0xff ); + texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 ); + texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff ); } #if DIM == 3 @@ -1002,17 +1004,15 @@ static void store_texel_al88_rev(struct gl_texture_image *texImage, /* MESA_FORMAT_RGB332 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */ -static void FETCH(rgb332)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_rgb332)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { - static const GLubyte lut2to8[4] = {0, 85, 170, 255}; - static const GLubyte lut3to8[8] = {0, 36, 73, 109, 146, 182, 219, 255}; const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); const GLubyte s = *src; - texel[RCOMP] = UBYTE_TO_CHAN( lut3to8[(s >> 5) & 0x7] ); - texel[GCOMP] = UBYTE_TO_CHAN( lut3to8[(s >> 2) & 0x7] ); - texel[BCOMP] = UBYTE_TO_CHAN( lut2to8[(s ) & 0x3] ); - texel[ACOMP] = CHAN_MAX; + texel[RCOMP] = ((s >> 5) & 0x7) * (1.0F / 7.0F); + texel[GCOMP] = ((s >> 2) & 0x7) * (1.0F / 7.0F); + texel[BCOMP] = ((s ) & 0x3) * (1.0F / 3.0F); + texel[ACOMP] = 1.0F; } #if DIM == 3 @@ -1029,14 +1029,14 @@ static void store_texel_rgb332(struct gl_texture_image *texImage, /* MESA_FORMAT_A8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ -static void FETCH(a8)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_a8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); texel[RCOMP] = texel[GCOMP] = - texel[BCOMP] = 0; - texel[ACOMP] = UBYTE_TO_CHAN( src[0] ); + texel[BCOMP] = 0.0F; + texel[ACOMP] = UBYTE_TO_FLOAT( src[0] ); } #if DIM == 3 @@ -1053,14 +1053,14 @@ static void store_texel_a8(struct gl_texture_image *texImage, /* MESA_FORMAT_L8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */ -static void FETCH(l8)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_l8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); texel[RCOMP] = texel[GCOMP] = - texel[BCOMP] = UBYTE_TO_CHAN( src[0] ); - texel[ACOMP] = CHAN_MAX; + texel[BCOMP] = UBYTE_TO_FLOAT( src[0] ); + texel[ACOMP] = 1.0F; } #if DIM == 3 @@ -1077,14 +1077,14 @@ static void store_texel_l8(struct gl_texture_image *texImage, /* MESA_FORMAT_I8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */ -static void FETCH(i8)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_i8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = - texel[ACOMP] = UBYTE_TO_CHAN( src[0] ); + texel[ACOMP] = UBYTE_TO_FLOAT( src[0] ); } #if DIM == 3 @@ -1103,12 +1103,11 @@ static void store_texel_i8(struct gl_texture_image *texImage, /* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a * color table, and return 4 GLchans. */ -static void FETCH(ci8)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_ci8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); const struct gl_color_table *palette; - GLubyte texelUB[4]; GLuint index; GET_CURRENT_CONTEXT(ctx); @@ -1125,61 +1124,48 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage, index = (*src) & (palette->Size - 1); { - const GLubyte *table = palette->TableUB; + const GLfloat *table = palette->TableF; switch (palette->_BaseFormat) { case GL_ALPHA: - texelUB[RCOMP] = - texelUB[GCOMP] = - texelUB[BCOMP] = 0; - texelUB[ACOMP] = table[index]; + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0.0F; + texel[ACOMP] = table[index]; break;; case GL_LUMINANCE: - texelUB[RCOMP] = - texelUB[GCOMP] = - texelUB[BCOMP] = table[index]; - texelUB[ACOMP] = 255; + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = table[index]; + texel[ACOMP] = 1.0F; break; case GL_INTENSITY: - texelUB[RCOMP] = - texelUB[GCOMP] = - texelUB[BCOMP] = - texelUB[ACOMP] = table[index]; + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = table[index]; break;; case GL_LUMINANCE_ALPHA: - texelUB[RCOMP] = - texelUB[GCOMP] = - texelUB[BCOMP] = table[index * 2 + 0]; - texelUB[ACOMP] = table[index * 2 + 1]; + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = table[index * 2 + 0]; + texel[ACOMP] = table[index * 2 + 1]; break;; case GL_RGB: - texelUB[RCOMP] = table[index * 3 + 0]; - texelUB[GCOMP] = table[index * 3 + 1]; - texelUB[BCOMP] = table[index * 3 + 2]; - texelUB[ACOMP] = 255; + texel[RCOMP] = table[index * 3 + 0]; + texel[GCOMP] = table[index * 3 + 1]; + texel[BCOMP] = table[index * 3 + 2]; + texel[ACOMP] = 1.0F; break;; case GL_RGBA: - texelUB[RCOMP] = table[index * 4 + 0]; - texelUB[GCOMP] = table[index * 4 + 1]; - texelUB[BCOMP] = table[index * 4 + 2]; - texelUB[ACOMP] = table[index * 4 + 3]; + texel[RCOMP] = table[index * 4 + 0]; + texel[GCOMP] = table[index * 4 + 1]; + texel[BCOMP] = table[index * 4 + 2]; + texel[ACOMP] = table[index * 4 + 3]; break;; default: _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8"); return; } -#if CHAN_TYPE == GL_UNSIGNED_BYTE - COPY_4UBV(texel, texelUB); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - texel[0] = UBYTE_TO_USHORT(texelUB[0]); - texel[1] = UBYTE_TO_USHORT(texelUB[1]); - texel[2] = UBYTE_TO_USHORT(texelUB[2]); - texel[3] = UBYTE_TO_USHORT(texelUB[3]); -#else - texel[0] = UBYTE_TO_FLOAT(texelUB[0]); - texel[1] = UBYTE_TO_FLOAT(texelUB[1]); - texel[2] = UBYTE_TO_FLOAT(texelUB[2]); - texel[3] = UBYTE_TO_FLOAT(texelUB[3]); -#endif } } -- cgit v1.2.3 From 611128365dad65216a4d4be973393ba2c526bd18 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Mar 2009 20:34:24 -0600 Subject: mesa: convert more texture fetch functions to return GLfloat --- src/mesa/main/texformat.c | 84 +++++++++++++++--------------- src/mesa/main/texformat_tmp.h | 117 +++++++++++++++++++----------------------- 2 files changed, 94 insertions(+), 107 deletions(-) diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 3286922f6f6..c709004784b 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -154,9 +154,9 @@ const struct gl_texture_format _mesa_texformat_rgba = { 0, /* StencilBits */ 4 * sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba, /* StoreTexImageFunc */ - fetch_texel_1d_rgba, /* FetchTexel1D */ - fetch_texel_2d_rgba, /* FetchTexel2D */ - fetch_texel_3d_rgba, /* FetchTexel3D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ fetch_texel_1d_f_rgba, /* FetchTexel1Df */ fetch_texel_2d_f_rgba, /* FetchTexel2Df */ fetch_texel_3d_f_rgba, /* FetchTexel3Df */ @@ -178,9 +178,9 @@ const struct gl_texture_format _mesa_texformat_rgb = { 0, /* StencilBits */ 3 * sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ - fetch_texel_1d_rgb, /* FetchTexel1D */ - fetch_texel_2d_rgb, /* FetchTexel2D */ - fetch_texel_3d_rgb, /* FetchTexel3D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ fetch_texel_1d_f_rgb, /* FetchTexel1Df */ fetch_texel_2d_f_rgb, /* FetchTexel2Df */ fetch_texel_3d_f_rgb, /* FetchTexel3Df */ @@ -202,12 +202,12 @@ const struct gl_texture_format _mesa_texformat_alpha = { 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ - fetch_texel_1d_alpha, /* FetchTexel1D */ - fetch_texel_2d_alpha, /* FetchTexel2D */ - fetch_texel_3d_alpha, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_alpha, /* FetchTexel1Df */ + fetch_texel_2d_f_alpha, /* FetchTexel2Df */ + fetch_texel_3d_f_alpha, /* FetchTexel3Df */ store_texel_alpha /* StoreTexel */ }; @@ -226,12 +226,12 @@ const struct gl_texture_format _mesa_texformat_luminance = { 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ - fetch_texel_1d_luminance, /* FetchTexel1D */ - fetch_texel_2d_luminance, /* FetchTexel2D */ - fetch_texel_3d_luminance, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_luminance, /* FetchTexel1Df */ + fetch_texel_2d_f_luminance, /* FetchTexel2Df */ + fetch_texel_3d_f_luminance, /* FetchTexel3Df */ store_texel_luminance /* StoreTexel */ }; @@ -250,12 +250,12 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { 0, /* StencilBits */ 2 * sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ - fetch_texel_1d_luminance_alpha, /* FetchTexel1D */ - fetch_texel_2d_luminance_alpha, /* FetchTexel2D */ - fetch_texel_3d_luminance_alpha, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_luminance_alpha, /* FetchTexel1Df */ + fetch_texel_2d_f_luminance_alpha, /* FetchTexel2Df */ + fetch_texel_3d_f_luminance_alpha, /* FetchTexel3Df */ store_texel_luminance_alpha /* StoreTexel */ }; @@ -274,12 +274,12 @@ const struct gl_texture_format _mesa_texformat_intensity = { 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ - fetch_texel_1d_intensity, /* FetchTexel1D */ - fetch_texel_2d_intensity, /* FetchTexel2D */ - fetch_texel_3d_intensity, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_intensity, /* FetchTexel1Df */ + fetch_texel_2d_f_intensity, /* FetchTexel2Df */ + fetch_texel_3d_f_intensity, /* FetchTexel3Df */ store_texel_intensity /* StoreTexel */ }; @@ -1297,12 +1297,12 @@ const struct gl_texture_format _mesa_texformat_ycbcr = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_ycbcr, /* StoreTexImageFunc */ - fetch_texel_1d_ycbcr, /* FetchTexel1D */ - fetch_texel_2d_ycbcr, /* FetchTexel2D */ - fetch_texel_3d_ycbcr, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_ycbcr, /* FetchTexel1Df */ + fetch_texel_2d_f_ycbcr, /* FetchTexel2Df */ + fetch_texel_3d_f_ycbcr, /* FetchTexel3Df */ store_texel_ycbcr /* StoreTexel */ }; @@ -1321,12 +1321,12 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { 0, /* StencilBits */ 2, /* TexelBytes */ _mesa_texstore_ycbcr, /* StoreTexImageFunc */ - fetch_texel_1d_ycbcr_rev, /* FetchTexel1D */ - fetch_texel_2d_ycbcr_rev, /* FetchTexel2D */ - fetch_texel_3d_ycbcr_rev, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_f_ycbcr_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_ycbcr_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_ycbcr_rev, /* FetchTexel3Df */ store_texel_ycbcr_rev /* StoreTexel */ }; diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index b9e34f71e89..f98e8576294 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -72,14 +72,6 @@ /* MESA_FORMAT_RGBA **********************************************************/ -/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLchans */ -static void FETCH(rgba)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 4); - COPY_CHAN4( texel, src ); -} - /* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLfloats */ static void FETCH(f_rgba)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -107,17 +99,6 @@ static void store_texel_rgba(struct gl_texture_image *texImage, /* MESA_FORMAT_RGB ***********************************************************/ -/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLchans */ -static void FETCH(rgb)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 3); - texel[RCOMP] = src[0]; - texel[GCOMP] = src[1]; - texel[BCOMP] = src[2]; - texel[ACOMP] = CHAN_MAX; -} - /* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLfloats */ static void FETCH(f_rgb)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -144,14 +125,14 @@ static void store_texel_rgb(struct gl_texture_image *texImage, /* MESA_FORMAT_ALPHA *********************************************************/ /* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */ -static void FETCH(alpha)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_alpha)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); texel[RCOMP] = texel[GCOMP] = - texel[BCOMP] = 0; - texel[ACOMP] = src[0]; + texel[BCOMP] = 0.0F; + texel[ACOMP] = CHAN_TO_FLOAT(src[0]); } #if DIM == 3 @@ -167,14 +148,14 @@ static void store_texel_alpha(struct gl_texture_image *texImage, /* MESA_FORMAT_LUMINANCE *****************************************************/ /* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */ -static void FETCH(luminance)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_luminance)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); texel[RCOMP] = texel[GCOMP] = - texel[BCOMP] = src[0]; - texel[ACOMP] = CHAN_MAX; + texel[BCOMP] = CHAN_TO_FLOAT(src[0]); + texel[ACOMP] = 1.0F; } #if DIM == 3 @@ -190,14 +171,14 @@ static void store_texel_luminance(struct gl_texture_image *texImage, /* MESA_FORMAT_LUMINANCE_ALPHA ***********************************************/ /* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */ -static void FETCH(luminance_alpha)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_luminance_alpha)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 2); - texel[RCOMP] = src[0]; - texel[GCOMP] = src[0]; - texel[BCOMP] = src[0]; - texel[ACOMP] = src[1]; + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = CHAN_TO_FLOAT(src[0]); + texel[ACOMP] = CHAN_TO_FLOAT(src[1]); } #if DIM == 3 @@ -214,14 +195,14 @@ static void store_texel_luminance_alpha(struct gl_texture_image *texImage, /* MESA_FORMAT_INTENSITY *****************************************************/ /* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */ -static void FETCH(intensity)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_intensity)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - texel[RCOMP] = src[0]; - texel[GCOMP] = src[0]; - texel[BCOMP] = src[0]; - texel[ACOMP] = src[0]; + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = CHAN_TO_FLOAT(src[0]); } #if DIM == 3 @@ -1356,8 +1337,8 @@ static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage, /* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLchans */ /* We convert YCbCr to RGB here */ /* XXX this may break if GLchan != GLubyte */ -static void FETCH(ycbcr)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */ const GLushort *src1 = src0 + 1; /* odd */ @@ -1365,23 +1346,26 @@ static void FETCH(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 */ - GLint r, g, b; + GLfloat r, g, b; if (i & 1) { /* odd pixel: use y1,cr,cb */ - r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); - g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); - b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); + r = 1.164 * (y1-16) + 1.596 * (cr-128); + g = 1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128); + b = 1.164 * (y1-16) + 2.018 * (cb-128); } else { /* even pixel: use y0,cr,cb */ - r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); - g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); - b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); + r = 1.164 * (y0-16) + 1.596 * (cr-128); + g = 1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128); + b = 1.164 * (y0-16) + 2.018 * (cb-128); } - texel[RCOMP] = CLAMP(r, 0, CHAN_MAX); - texel[GCOMP] = CLAMP(g, 0, CHAN_MAX); - texel[BCOMP] = CLAMP(b, 0, CHAN_MAX); - texel[ACOMP] = CHAN_MAX; + r *= (1.0 / 255.0F); + g *= (1.0 / 255.0F); + b *= (1.0 / 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); + texel[ACOMP] = 1.0F; } #if DIM == 3 @@ -1403,8 +1387,8 @@ static void store_texel_ycbcr(struct gl_texture_image *texImage, /* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLchans */ /* We convert YCbCr to RGB here */ /* XXX this may break if GLchan != GLubyte */ -static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */ const GLushort *src1 = src0 + 1; /* odd */ @@ -1412,23 +1396,26 @@ static void FETCH(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 */ - GLint r, g, b; + GLfloat r, g, b; if (i & 1) { /* odd pixel: use y1,cr,cb */ - r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); - g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); - b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); + r = 1.164 * (y1-16) + 1.596 * (cr-128); + g = 1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128); + b = 1.164 * (y1-16) + 2.018 * (cb-128); } else { /* even pixel: use y0,cr,cb */ - r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); - g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); - b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); + r = 1.164 * (y0-16) + 1.596 * (cr-128); + g = 1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128); + b = 1.164 * (y0-16) + 2.018 * (cb-128); } - texel[RCOMP] = CLAMP(r, 0, CHAN_MAX); - texel[GCOMP] = CLAMP(g, 0, CHAN_MAX); - texel[BCOMP] = CLAMP(b, 0, CHAN_MAX); - texel[ACOMP] = CHAN_MAX; + r *= (1.0 / 255.0F); + g *= (1.0 / 255.0F); + b *= (1.0 / 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); + texel[ACOMP] = 1.0F; } #if DIM == 3 -- cgit v1.2.3 From efe3d10aea305c89e66decfb5a9012feb7a4695c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Mar 2009 20:51:21 -0600 Subject: mesa: simplify ycbcr->rgb conversion code --- src/mesa/main/texformat_tmp.h | 46 +++++++++++++------------------------------ 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index f98e8576294..d0d38046082 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1334,9 +1334,9 @@ static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage, /* MESA_FORMAT_YCBCR *********************************************************/ -/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLchans */ -/* We convert YCbCr to RGB here */ -/* XXX this may break if GLchan != GLubyte */ +/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats. + * We convert YCbCr to RGB here. + */ static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { @@ -1346,19 +1346,10 @@ 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 */ - GLfloat r, g, b; - if (i & 1) { - /* odd pixel: use y1,cr,cb */ - r = 1.164 * (y1-16) + 1.596 * (cr-128); - g = 1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128); - b = 1.164 * (y1-16) + 2.018 * (cb-128); - } - else { - /* even pixel: use y0,cr,cb */ - r = 1.164 * (y0-16) + 1.596 * (cr-128); - g = 1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128); - b = 1.164 * (y0-16) + 2.018 * (cb-128); - } + 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); @@ -1384,9 +1375,9 @@ static void store_texel_ycbcr(struct gl_texture_image *texImage, /* MESA_FORMAT_YCBCR_REV *****************************************************/ -/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLchans */ -/* We convert YCbCr to RGB here */ -/* XXX this may break if GLchan != GLubyte */ +/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats. + * We convert YCbCr to RGB here. + */ static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { @@ -1396,19 +1387,10 @@ 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 */ - GLfloat r, g, b; - if (i & 1) { - /* odd pixel: use y1,cr,cb */ - r = 1.164 * (y1-16) + 1.596 * (cr-128); - g = 1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128); - b = 1.164 * (y1-16) + 2.018 * (cb-128); - } - else { - /* even pixel: use y0,cr,cb */ - r = 1.164 * (y0-16) + 1.596 * (cr-128); - g = 1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128); - b = 1.164 * (y0-16) + 2.018 * (cb-128); - } + 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); -- cgit v1.2.3 From aef2e1c1dcda77b6dc5fcfd2de7c9d720effa4e7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Mar 2009 21:20:25 -0600 Subject: swrast: minor improvements, clean-ups in texcombine code --- src/mesa/swrast/s_texcombine.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index f783f56add6..550c99b7d23 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -189,15 +189,15 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, break; case GL_SRC_ALPHA: for (i = 0; i < n; i++) { - dst[i][RCOMP] = src[i][ACOMP]; - dst[i][GCOMP] = src[i][ACOMP]; + dst[i][RCOMP] = + dst[i][GCOMP] = dst[i][BCOMP] = src[i][ACOMP]; } break; case GL_ONE_MINUS_SRC_ALPHA: for (i = 0; i < n; i++) { - dst[i][RCOMP] = 1.0F - src[i][ACOMP]; - dst[i][GCOMP] = 1.0F - src[i][ACOMP]; + dst[i][RCOMP] = + dst[i][GCOMP] = dst[i][BCOMP] = 1.0F - src[i][ACOMP]; } break; @@ -361,7 +361,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F)) * 4.0F; dot = CLAMP(dot, 0.0F, 1.0F); - rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = dot; } break; case GL_DOT3_RGB: @@ -373,7 +373,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F)) * 4.0F * scaleRGB; dot = CLAMP(dot, 0.0, 1.0F); - rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLfloat) dot; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = dot; } break; case GL_MODULATE_ADD_ATI: @@ -440,8 +440,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (combine->ModeA) { case GL_REPLACE: for (i = 0; i < n; i++) { - GLfloat a = arg0[i][ACOMP] * scaleA; - rgba[i][ACOMP] = (GLfloat) MIN2(a, 1.0F); + rgba[i][ACOMP] = arg0[i][ACOMP] * scaleA; } break; case GL_MODULATE: @@ -481,7 +480,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } break; case GL_INTERPOLATE: - for (i=0; i Date: Mon, 9 Mar 2009 21:24:48 -0600 Subject: swrast: remove unused parameter --- src/mesa/swrast/s_texcombine.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 550c99b7d23..3b7bbfe2583 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -572,7 +572,6 @@ swizzle_texels(GLuint swizzle, GLuint count, float4_array texels) * Input: textureUnit - pointer to texture unit to apply * format - base internal texture format * n - number of fragments - * primary_rgba - primary colors (may alias rgba for single texture) * texels - array of texel colors * InOut: rgba - incoming fragment colors modified by texel colors * according to the texture environment mode. @@ -581,7 +580,6 @@ static void texture_apply( const GLcontext *ctx, const struct gl_texture_unit *texUnit, GLuint n, - float4_array primary_rgba, float4_array texel, GLchan rgbaChan[][4] ) { @@ -591,8 +589,6 @@ texture_apply( const GLcontext *ctx, GLenum format; GLfloat rgba[MAX_WIDTH][4]; - (void) primary_rgba; - ASSERT(texUnit); ASSERT(texUnit->_Current); @@ -1123,8 +1119,7 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) float4_array texels = get_texel_array(swrast->TexelBuffer, unit, span->end); texture_apply( ctx, texUnit, span->end, - primary_rgba, texels, - span->array->rgba ); + texels, span->array->rgba ); } } } -- cgit v1.2.3 From 84b24efe8dc1bd67680f4d3c656fb4693fd405c1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 10 Mar 2009 19:29:45 -0600 Subject: swrast: fix bad optimization check --- src/mesa/swrast/s_texcombine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 3b7bbfe2583..ef2db0dc7e3 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -604,7 +604,8 @@ texture_apply( const GLcontext *ctx, format = texUnit->_Current->DepthMode; } - if (texUnit->EnvMode != GL_REPLACE) { + /* skip chan->float conversion when not needed */ + if (texUnit->EnvMode != GL_REPLACE || format != GL_RGBA) { /* convert GLchan colors to GLfloat */ for (i = 0; i < n; i++) { rgba[i][RCOMP] = CHAN_TO_FLOAT(rgbaChan[i][RCOMP]); -- cgit v1.2.3 From 7aed2b0c30c6d29d70efd2402a68a8e3de98418c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 10 Mar 2009 20:14:32 -0600 Subject: swrast: remove old texture_apply() code; always use texture combine code --- src/mesa/swrast/s_context.c | 22 ++- src/mesa/swrast/s_context.h | 2 +- src/mesa/swrast/s_texcombine.c | 401 +---------------------------------------- 3 files changed, 22 insertions(+), 403 deletions(-) diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 0257abc34ac..56bf2033ca6 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -172,19 +172,29 @@ _swrast_update_fog_hint( GLcontext *ctx ) /** - * Update the swrast->_AnyTextureCombine flag. + * Update the swrast->_TextureCombinePrimary flag. */ static void _swrast_update_texture_env( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint i; - swrast->_AnyTextureCombine = GL_FALSE; + + swrast->_TextureCombinePrimary = GL_FALSE; + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (ctx->Texture.Unit[i].EnvMode == GL_COMBINE_EXT || - ctx->Texture.Unit[i].EnvMode == GL_COMBINE4_NV) { - swrast->_AnyTextureCombine = GL_TRUE; - return; + const struct gl_tex_env_combine_state *combine = + ctx->Texture.Unit[i]._CurrentCombine; + GLuint term; + for (term = 0; term < combine->_NumArgsRGB; term++) { + if (combine->SourceRGB[term] == GL_PRIMARY_COLOR) { + swrast->_TextureCombinePrimary = GL_TRUE; + return; + } + if (combine->SourceA[term] == GL_PRIMARY_COLOR) { + swrast->_TextureCombinePrimary = GL_TRUE; + return; + } } } } diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index 4cf57c6fc67..b7a17cb28c5 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -131,7 +131,7 @@ typedef struct GLfloat _BackfaceSign; /** +1 or -1 */ GLfloat _BackfaceCullSign; /** +1, 0, or -1 */ GLboolean _PreferPixelFog; /* Compute fog blend factor per fragment? */ - GLboolean _AnyTextureCombine; + GLboolean _TextureCombinePrimary; GLboolean _FogEnabled; GLboolean _DeferredTexture; GLenum _FogMode; /* either GL_FOG_MODE or fragment program's fog mode */ diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index ef2db0dc7e3..2c694c25cba 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -29,7 +29,6 @@ #include "main/colormac.h" #include "main/image.h" #include "main/imports.h" -#include "main/macros.h" #include "main/pixel.h" #include "shader/prog_instruction.h" @@ -92,8 +91,6 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, GLfloat rgba[MAX_WIDTH][4]; GLuint i, term; - ASSERT(CONST_SWRAST_CONTEXT(ctx)->_AnyTextureCombine); - for (i = 0; i < n; i++) { rgba[i][RCOMP] = CHAN_TO_FLOAT(rgbaChan[i][RCOMP]); rgba[i][GCOMP] = CHAN_TO_FLOAT(rgbaChan[i][GCOMP]); @@ -535,7 +532,6 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } - /** * Apply X/Y/Z/W/0/1 swizzle to an array of colors/texels. * See GL_EXT_texture_swizzle. @@ -566,382 +562,6 @@ swizzle_texels(GLuint swizzle, GLuint count, float4_array texels) } -/** - * Apply a conventional OpenGL texture env mode (REPLACE, ADD, BLEND, - * MODULATE, or DECAL) to an array of fragments. - * Input: textureUnit - pointer to texture unit to apply - * format - base internal texture format - * n - number of fragments - * texels - array of texel colors - * InOut: rgba - incoming fragment colors modified by texel colors - * according to the texture environment mode. - */ -static void -texture_apply( const GLcontext *ctx, - const struct gl_texture_unit *texUnit, - GLuint n, - float4_array texel, - GLchan rgbaChan[][4] ) -{ - GLint baseLevel; - GLuint i; - GLfloat Rc, Gc, Bc, Ac; - GLenum format; - GLfloat rgba[MAX_WIDTH][4]; - - ASSERT(texUnit); - ASSERT(texUnit->_Current); - - baseLevel = texUnit->_Current->BaseLevel; - ASSERT(texUnit->_Current->Image[0][baseLevel]); - - format = texUnit->_Current->Image[0][baseLevel]->_BaseFormat; - - if (format == GL_COLOR_INDEX || format == GL_YCBCR_MESA) { - format = GL_RGBA; /* a bit of a hack */ - } - else if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) { - format = texUnit->_Current->DepthMode; - } - - /* skip chan->float conversion when not needed */ - if (texUnit->EnvMode != GL_REPLACE || format != GL_RGBA) { - /* convert GLchan colors to GLfloat */ - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = CHAN_TO_FLOAT(rgbaChan[i][RCOMP]); - rgba[i][GCOMP] = CHAN_TO_FLOAT(rgbaChan[i][GCOMP]); - rgba[i][BCOMP] = CHAN_TO_FLOAT(rgbaChan[i][BCOMP]); - rgba[i][ACOMP] = CHAN_TO_FLOAT(rgbaChan[i][ACOMP]); - } - } - - switch (texUnit->EnvMode) { - case GL_REPLACE: - switch (format) { - case GL_ALPHA: - for (i=0;iEnvColor[0]; - Gc = texUnit->EnvColor[1]; - Bc = texUnit->EnvColor[2]; - Ac = texUnit->EnvColor[3]; - switch (format) { - case GL_ALPHA: - for (i=0;i_AnyTextureCombine) { + if (swrast->_TextureCombinePrimary) { GLuint i; for (i = 0; i < span->end; i++) { primary_rgba[i][RCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][RCOMP]); @@ -1101,27 +721,16 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) } } - /* * OK, now apply the texture (aka texture combine/blend). * We modify the span->color.rgba values. */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - if (texUnit->_CurrentCombine != &texUnit->_EnvMode ) { - texture_combine( ctx, unit, span->end, - primary_rgba, - swrast->TexelBuffer, - span->array->rgba ); - } - else { - /* conventional texture blend */ - float4_array texels = - get_texel_array(swrast->TexelBuffer, unit, span->end); - texture_apply( ctx, texUnit, span->end, - texels, span->array->rgba ); - } + texture_combine( ctx, unit, span->end, + primary_rgba, + swrast->TexelBuffer, + span->array->rgba ); } } } -- cgit v1.2.3 From 79c55e55f808d77cb0dff7cda826719d5fda3c7d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Mar 2009 19:03:30 -0600 Subject: dri: use BorderColor instead of _BorderChan --- src/mesa/drivers/dri/gamma/gamma_tex.c | 13 +++++++++---- src/mesa/drivers/dri/i810/i810tex.c | 6 +++--- src/mesa/drivers/dri/i915/i830_texstate.c | 14 ++++++++++---- src/mesa/drivers/dri/i915/i915_texstate.c | 22 ++++++++++++++-------- src/mesa/drivers/dri/mach64/mach64_tex.c | 6 +++--- src/mesa/drivers/dri/mga/mgatex.c | 14 +++++++++----- src/mesa/drivers/dri/r128/r128_tex.c | 11 ++++++++--- src/mesa/drivers/dri/r200/r200_tex.c | 11 ++++++++--- src/mesa/drivers/dri/r300/r300_tex.c | 11 ++++++++--- src/mesa/drivers/dri/radeon/radeon_tex.c | 11 ++++++++--- src/mesa/drivers/dri/s3v/s3v_tex.c | 13 +++++++++---- src/mesa/drivers/dri/savage/savagetex.c | 6 +++--- src/mesa/drivers/dri/sis/sis_texstate.c | 15 ++++++++++----- 13 files changed, 102 insertions(+), 51 deletions(-) diff --git a/src/mesa/drivers/dri/gamma/gamma_tex.c b/src/mesa/drivers/dri/gamma/gamma_tex.c index ca33c1740ff..97797d47882 100644 --- a/src/mesa/drivers/dri/gamma/gamma_tex.c +++ b/src/mesa/drivers/dri/gamma/gamma_tex.c @@ -107,9 +107,14 @@ static void gammaSetTexFilter(gammaContextPtr gmesa, static void gammaSetTexBorderColor(gammaContextPtr gmesa, gammaTextureObjectPtr t, - GLubyte color[4]) + const GLfloat color[4]) { - t->TextureBorderColor = PACK_COLOR_8888(color[0], color[1], color[2], color[3]); + GLubyte c[4]; + 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]); + t->TextureBorderColor = PACK_COLOR_8888(c[0], c[1], c[2], c[3]); } @@ -143,7 +148,7 @@ static void gammaTexParameter( GLcontext *ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan ); + gammaSetTexBorderColor( gmesa, t, tObj->BorderColor ); break; case GL_TEXTURE_BASE_LEVEL: @@ -347,7 +352,7 @@ static void gammaBindTexture( GLcontext *ctx, GLenum target, gammaSetTexWrapping( t, tObj->WrapS, tObj->WrapT ); gammaSetTexFilter( gmesa, t, tObj->MinFilter, tObj->MagFilter, bias ); - gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan ); + gammaSetTexBorderColor( gmesa, t, tObj->BorderColor ); } } diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index ba4e6b5b0b1..cd6e1a8e6e8 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -162,7 +162,7 @@ static void i810SetTexFilter(i810ContextPtr imesa, static void -i810SetTexBorderColor( i810TextureObjectPtr t, GLubyte color[4] ) +i810SetTexBorderColor( i810TextureObjectPtr t, const GLfloat color[4] ) { /* Need a fallback. */ @@ -211,7 +211,7 @@ i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj ) i810SetTexWrapping( t, texObj->WrapS, texObj->WrapT ); /*i830SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/ i810SetTexFilter( imesa, t, texObj->MinFilter, texObj->MagFilter, bias ); - i810SetTexBorderColor( t, texObj->_BorderChan ); + i810SetTexBorderColor( t, texObj->BorderColor ); } return t; @@ -252,7 +252,7 @@ static void i810TexParameter( GLcontext *ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - i810SetTexBorderColor( t, tObj->_BorderChan ); + i810SetTexBorderColor( t, tObj->BorderColor ); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index df43b779a79..753c25b57ed 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -122,6 +122,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) struct gl_texture_image *firstImage; GLuint *state = i830->state.Tex[unit], format, pitch; GLint lodbias; + GLubyte border[4]; memset(state, 0, sizeof(state)); @@ -294,11 +295,16 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) (ws))); } + /* convert border color from float to ubyte */ + CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->BorderColor[0]); + CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor[1]); + CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor[2]); + CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor[3]); - state[I830_TEXREG_TM0S4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0], - tObj->_BorderChan[1], - tObj->_BorderChan[2], - tObj->_BorderChan[3]); + state[I830_TEXREG_TM0S4] = INTEL_PACKCOLOR8888(border[0], + border[1], + border[2], + border[3]); I830_ACTIVESTATE(i830, I830_UPLOAD_TEX(unit), GL_TRUE); diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 6d25f8dd8ef..43f65392b56 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -133,6 +133,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) struct gl_texture_image *firstImage; GLuint *state = i915->state.Tex[unit], format, pitch; GLint lodbias; + GLubyte border[4]; memset(state, 0, sizeof(state)); @@ -318,21 +319,26 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) state[I915_TEXREG_SS3] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT); } + /* convert border color from float to ubyte */ + CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->BorderColor[0]); + CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor[1]); + CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor[2]); + CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor[3]); if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) { /* GL specs that border color for depth textures is taken from the * R channel, while the hardware uses A. Spam R into all the channels * for safety. */ - state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0], - tObj->_BorderChan[0], - tObj->_BorderChan[0], - tObj->_BorderChan[0]); + state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0], + border[0], + border[0], + border[0]); } else { - state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0], - tObj->_BorderChan[1], - tObj->_BorderChan[2], - tObj->_BorderChan[3]); + state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0], + border[1], + border[2], + border[3]); } diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 9fe267eafd5..225d23179e1 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -99,7 +99,7 @@ static void mach64SetTexFilter( mach64TexObjPtr t, } } -static void mach64SetTexBorderColor( mach64TexObjPtr t, GLubyte c[4] ) +static void mach64SetTexBorderColor( mach64TexObjPtr t, const GLfloat c[4] ) { #if 0 GLuint border = mach64PackColor( 4, c[0], c[1], c[2], c[3] ); @@ -131,7 +131,7 @@ mach64AllocTexObj( struct gl_texture_object *texObj ) mach64SetTexWrap( t, texObj->WrapS, texObj->WrapT ); mach64SetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); - mach64SetTexBorderColor( t, texObj->_BorderChan ); + mach64SetTexBorderColor( t, texObj->BorderColor ); return t; } @@ -471,7 +471,7 @@ static void mach64DDTexParameter( GLcontext *ctx, GLenum target, case GL_TEXTURE_BORDER_COLOR: if ( t->base.bound ) FLUSH_BATCH( mmesa ); - mach64SetTexBorderColor( t, tObj->_BorderChan ); + mach64SetTexBorderColor( t, tObj->BorderColor ); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c index 2392622b902..33eb0be4496 100644 --- a/src/mesa/drivers/dri/mga/mgatex.c +++ b/src/mesa/drivers/dri/mga/mgatex.c @@ -153,10 +153,14 @@ mgaSetTexFilter( mgaTextureObjectPtr t, GLenum minf, GLenum magf ) t->setup.texfilter |= val; } -static void mgaSetTexBorderColor(mgaTextureObjectPtr t, GLubyte color[4]) +static void mgaSetTexBorderColor(mgaTextureObjectPtr t, const GLfloat color[4]) { - t->setup.texbordercol = PACK_COLOR_8888(color[3], color[0], - color[1], color[2] ); + GLubyte c[4]; + 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]); + t->setup.texbordercol = PACK_COLOR_8888(c[3], c[0], c[1], c[2] ); } @@ -329,7 +333,7 @@ mgaAllocTexObj( struct gl_texture_object *tObj ) mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT ); mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); - mgaSetTexBorderColor( t, tObj->_BorderChan ); + mgaSetTexBorderColor( t, tObj->BorderColor ); } return( t ); @@ -458,7 +462,7 @@ mgaTexParameter( GLcontext *ctx, GLenum target, case GL_TEXTURE_BORDER_COLOR: FLUSH_BATCH(mmesa); - mgaSetTexBorderColor(t, tObj->_BorderChan); + mgaSetTexBorderColor(t, tObj->BorderColor); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 3fc9c06cfa2..0920270d7b6 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -135,8 +135,13 @@ static void r128SetTexFilter( r128TexObjPtr t, GLenum minf, GLenum magf ) } } -static void r128SetTexBorderColor( r128TexObjPtr t, GLubyte c[4] ) +static void r128SetTexBorderColor( r128TexObjPtr t, const GLfloat color[4] ) { + GLubyte c[4]; + 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]); t->setup.tex_border_color = r128PackColor( 4, c[0], c[1], c[2], c[3] ); } @@ -165,7 +170,7 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj ) r128SetTexWrap( t, texObj->WrapS, texObj->WrapT ); r128SetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); - r128SetTexBorderColor( t, texObj->_BorderChan ); + r128SetTexBorderColor( t, texObj->BorderColor ); } return t; @@ -531,7 +536,7 @@ static void r128TexParameter( GLcontext *ctx, GLenum target, case GL_TEXTURE_BORDER_COLOR: if ( t->base.bound ) FLUSH_BATCH( rmesa ); - r128SetTexBorderColor( t, tObj->_BorderChan ); + r128SetTexBorderColor( t, tObj->BorderColor ); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 5a4db33f441..259f35a34c3 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -267,8 +267,13 @@ static void r200SetTexFilter( r200TexObjPtr t, GLenum minf, GLenum magf ) } } -static void r200SetTexBorderColor( r200TexObjPtr t, GLubyte c[4] ) +static void r200SetTexBorderColor( r200TexObjPtr t, const GLfloat color[4] ) { + GLubyte c[4]; + 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]); t->pp_border_color = r200PackColor( 4, c[0], c[1], c[2], c[3] ); } @@ -301,7 +306,7 @@ static r200TexObjPtr r200AllocTexObj( struct gl_texture_object *texObj ) r200SetTexWrap( t, texObj->WrapS, texObj->WrapT, texObj->WrapR ); r200SetTexMaxAnisotropy( t, texObj->MaxAnisotropy ); r200SetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); - r200SetTexBorderColor( t, texObj->_BorderChan ); + r200SetTexBorderColor( t, texObj->BorderColor ); } return t; @@ -1056,7 +1061,7 @@ static void r200TexParameter( GLcontext *ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - r200SetTexBorderColor( t, texObj->_BorderChan ); + r200SetTexBorderColor( t, texObj->BorderColor ); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 8ab382c83cc..7c699ec572c 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -171,8 +171,13 @@ static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf, GLfloat } } -static void r300SetTexBorderColor(r300TexObjPtr t, GLubyte c[4]) +static void r300SetTexBorderColor(r300TexObjPtr t, const GLfloat color[4]) { + GLubyte c[4]; + 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]); t->pp_border_color = PACK_COLOR_8888(c[3], c[0], c[1], c[2]); } @@ -203,7 +208,7 @@ static r300TexObjPtr r300AllocTexObj(struct gl_texture_object *texObj) r300UpdateTexWrap(t); r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter, texObj->MaxAnisotropy); - r300SetTexBorderColor(t, texObj->_BorderChan); + r300SetTexBorderColor(t, texObj->BorderColor); } return t; @@ -929,7 +934,7 @@ static void r300TexParameter(GLcontext * ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - r300SetTexBorderColor(t, texObj->_BorderChan); + r300SetTexBorderColor(t, texObj->BorderColor); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index b0aec216706..f2b6deb9c04 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -239,8 +239,13 @@ static void radeonSetTexFilter( radeonTexObjPtr t, GLenum minf, GLenum magf ) } } -static void radeonSetTexBorderColor( radeonTexObjPtr t, GLubyte c[4] ) +static void radeonSetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] ) { + GLubyte c[4]; + 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]); t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] ); } @@ -276,7 +281,7 @@ static radeonTexObjPtr radeonAllocTexObj( struct gl_texture_object *texObj ) radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT ); radeonSetTexMaxAnisotropy( t, texObj->MaxAnisotropy ); radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); - radeonSetTexBorderColor( t, texObj->_BorderChan ); + radeonSetTexBorderColor( t, texObj->BorderColor ); } return t; @@ -755,7 +760,7 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - radeonSetTexBorderColor( t, texObj->_BorderChan ); + radeonSetTexBorderColor( t, texObj->BorderColor ); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.c b/src/mesa/drivers/dri/s3v/s3v_tex.c index db660263638..9b92519862a 100644 --- a/src/mesa/drivers/dri/s3v/s3v_tex.c +++ b/src/mesa/drivers/dri/s3v/s3v_tex.c @@ -132,8 +132,14 @@ static void s3vSetTexFilter(s3vContextPtr vmesa, static void s3vSetTexBorderColor(s3vContextPtr vmesa, s3vTextureObjectPtr t, - GLubyte color[4]) + const GLfloat color[4]) { + GLubyte c[4]; + 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]); + #if TEX_DEBUG_ON static unsigned int times=0; DEBUG_TEX(("*** s3vSetTexBorderColor: #%i ***\n", ++times)); @@ -143,8 +149,7 @@ static void s3vSetTexBorderColor(s3vContextPtr vmesa, /* switch(t0 ... t->TextureColorMode) */ /* case TEX_COL_ARGB1555: */ - t->TextureBorderColor = - S3VIRGEPACKCOLOR555(color[0], color[1], color[2], color[3]); + t->TextureBorderColor = S3VIRGEPACKCOLOR555(c[0], c[1], c[2], c[3]); DEBUG(("TextureBorderColor = 0x%x\n", t->TextureBorderColor)); @@ -182,7 +187,7 @@ static void s3vTexParameter( GLcontext *ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - s3vSetTexBorderColor( vmesa, t, tObj->_BorderChan ); + s3vSetTexBorderColor( vmesa, t, tObj->BorderColor ); break; case GL_TEXTURE_BASE_LEVEL: diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index a3bebfa8cf7..fe239e1b05f 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -474,7 +474,7 @@ static void savageSetTexFilter(savageTexObjPtr t, GLenum minf, GLenum magf) /* Need a fallback ? */ -static void savageSetTexBorderColor(savageTexObjPtr t, GLubyte color[4]) +static void savageSetTexBorderColor(savageTexObjPtr t, const GLfloat color[4]) { /* t->Setup[SAVAGE_TEXREG_TEXBORDERCOL] = */ /*t->setup.borderColor = SAVAGEPACKCOLOR8888(color[0],color[1],color[2],color[3]); */ @@ -512,7 +512,7 @@ savageAllocTexObj( struct gl_texture_object *texObj ) savageSetTexWrapping(t,texObj->WrapS,texObj->WrapT); savageSetTexFilter(t,texObj->MinFilter,texObj->MagFilter); - savageSetTexBorderColor(t,texObj->_BorderChan); + savageSetTexBorderColor(t,texObj->BorderColor); } return t; @@ -2018,7 +2018,7 @@ static void savageTexParameter( GLcontext *ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - savageSetTexBorderColor(t,tObj->_BorderChan); + savageSetTexBorderColor(t,tObj->BorderColor); break; default: diff --git a/src/mesa/drivers/dri/sis/sis_texstate.c b/src/mesa/drivers/dri/sis/sis_texstate.c index 63f23fc0149..46417ce414c 100644 --- a/src/mesa/drivers/dri/sis/sis_texstate.c +++ b/src/mesa/drivers/dri/sis/sis_texstate.c @@ -456,11 +456,16 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj, break; } - current->texture[hw_unit].hwTextureBorderColor = - ((GLuint) texObj->_BorderChan[3] << 24) + - ((GLuint) texObj->_BorderChan[0] << 16) + - ((GLuint) texObj->_BorderChan[1] << 8) + - ((GLuint) texObj->_BorderChan[2]); + { + GLubyte c[4]; + CLAMPED_FLOAT_TO_UBYTE(c[0], texObj->BorderColor[0]); + CLAMPED_FLOAT_TO_UBYTE(c[1], texObj->BorderColor[1]); + CLAMPED_FLOAT_TO_UBYTE(c[2], texObj->BorderColor[2]); + CLAMPED_FLOAT_TO_UBYTE(c[3], texObj->BorderColor[3]); + + current->texture[hw_unit].hwTextureBorderColor = + PACK_COLOR_8888(c[3], c[0], c[1], c[2]); + } if (current->texture[hw_unit].hwTextureBorderColor != prev->texture[hw_unit].hwTextureBorderColor) -- cgit v1.2.3 From 7fbae9f41d79fc410f6c6638e26be0ff2be545bd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Mar 2009 19:09:19 -0600 Subject: mesa: get rid of gl_texture_object::_BorderChan --- src/mesa/main/mtypes.h | 1 - src/mesa/main/texparam.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c1f06885ec4..10f0d067e33 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1296,7 +1296,6 @@ struct gl_texture_object GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ GLfloat Priority; /**< in [0,1] */ GLfloat BorderColor[4]; /**< unclamped */ - GLchan _BorderChan[4]; /**< clamped, as GLchan */ GLenum WrapS; /**< S-axis texture image wrap mode */ GLenum WrapT; /**< T-axis texture image wrap mode */ GLenum WrapR; /**< R-axis texture image wrap mode */ diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 50f867e1c1c..15c4aa31216 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -483,10 +483,6 @@ set_tex_parameterf(GLcontext *ctx, texObj->BorderColor[GCOMP] = params[1]; texObj->BorderColor[BCOMP] = params[2]; texObj->BorderColor[ACOMP] = params[3]; - UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]); - UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]); - UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]); - UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]); return; default: -- cgit v1.2.3 From bd32640f77c72e79fb5dda0e5fd077e564b33b02 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Mar 2009 21:22:45 -0600 Subject: swrast: remove unused integer lerp functions --- src/mesa/swrast/s_texfilter.c | 44 +------------------------------------------ 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 6e4144823ad..d84f37e576b 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -43,18 +43,11 @@ #define FRAC(f) ((f) - IFLOOR(f)) -/** - * Constants for integer linear interpolation. - */ -#define ILERP_SCALE 65536.0F -#define ILERP_SHIFT 16 - /** - * Linear interpolation macros + * Linear interpolation macro */ #define LERP(T, A, B) ( (A) + (T) * ((B) - (A)) ) -#define ILERP(IT, A, B) ( (A) + (((IT) * ((B) - (A))) >> ILERP_SHIFT) ) /** @@ -75,21 +68,6 @@ lerp_2d(GLfloat a, GLfloat b, } -/** - * Do 2D/biliner interpolation of integer values. - * \sa lerp_2d - */ -static INLINE GLint -ilerp_2d(GLint ia, GLint ib, - GLint v00, GLint v10, GLint v01, GLint v11) -{ - /* fixed point interpolants in [0, ILERP_SCALE] */ - const GLint temp0 = ILERP(ia, v00, v10); - const GLint temp1 = ILERP(ia, v01, v11); - return ILERP(ib, temp0, temp1); -} - - /** * Do 3D/trilinear interpolation of float values. * \sa lerp_2d @@ -109,26 +87,6 @@ lerp_3d(GLfloat a, GLfloat b, GLfloat c, } -/** - * Do 3D/trilinear interpolation of integer values. - * \sa lerp_2d - */ -static INLINE GLint -ilerp_3d(GLint ia, GLint ib, GLint ic, - GLint v000, GLint v100, GLint v010, GLint v110, - GLint v001, GLint v101, GLint v011, GLint v111) -{ - /* fixed point interpolants in [0, ILERP_SCALE] */ - const GLint temp00 = ILERP(ia, v000, v100); - const GLint temp10 = ILERP(ia, v010, v110); - const GLint temp01 = ILERP(ia, v001, v101); - const GLint temp11 = ILERP(ia, v011, v111); - const GLint temp0 = ILERP(ib, temp00, temp10); - const GLint temp1 = ILERP(ib, temp01, temp11); - return ILERP(ic, temp0, temp1); -} - - /** * Do linear interpolation of colors. */ -- cgit v1.2.3 From 336a4f84e87908692a8c9424f6f5d27dca30ea95 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 2 Apr 2009 09:39:40 +0200 Subject: python/regress: Add more vertex shader test cases. --- .../python/tests/regress/vertex-shader/vert-lg2.sh | 18 ++++++++++++++++++ .../python/tests/regress/vertex-shader/vert-lit.sh | 11 +++++++++++ .../python/tests/regress/vertex-shader/vert-mad.sh | 14 ++++++++++++++ .../python/tests/regress/vertex-shader/vert-max.sh | 13 +++++++++++++ .../python/tests/regress/vertex-shader/vert-min.sh | 13 +++++++++++++ .../python/tests/regress/vertex-shader/vert-rcp.sh | 18 ++++++++++++++++++ .../python/tests/regress/vertex-shader/vert-rsq.sh | 18 ++++++++++++++++++ .../python/tests/regress/vertex-shader/vert-sge.sh | 16 ++++++++++++++++ .../python/tests/regress/vertex-shader/vert-slt.sh | 16 ++++++++++++++++ .../tests/regress/vertex-shader/vertex-shader.py | 9 +++++++++ 10 files changed, 146 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh new file mode 100644 index 00000000000..f6e08d087c1 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh @@ -0,0 +1,18 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +IMM FLT32 { 1.0, 0.0, 0.0, 0.0 } +IMM FLT32 { 0.5, 0.0, 0.0, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +LG2 TEMP[0].x, TEMP[0].xxxx +ADD OUT[0], TEMP[0], IMM[1] +MOV OUT[1], IN[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh new file mode 100644 index 00000000000..da98f30928e --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh @@ -0,0 +1,11 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +MOV OUT[0], IN[0] +LIT OUT[1], IN[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh new file mode 100644 index 00000000000..eb07a3bd565 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh @@ -0,0 +1,14 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +IMM FLT32 { 0.5, 1.0, 1.0, 1.0 } +IMM FLT32 { 0.5, 0.0, 0.0, 0.0 } + +MAD OUT[0], IN[0], IMM[0], IMM[1] +MOV OUT[1], IN[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh new file mode 100644 index 00000000000..2d8b1fe3bfb --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh @@ -0,0 +1,13 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +IMM FLT32 { 0.5, 0.5, 0.5, 0.0 } + +MOV OUT[0], IN[0] +MAX OUT[1], IN[1], IMM[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh new file mode 100644 index 00000000000..84af0e29051 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh @@ -0,0 +1,13 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +IMM FLT32 { 0.5, 0.5, 0.5, 0.0 } + +MOV OUT[0], IN[0] +MIN OUT[1], IN[1], IMM[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh new file mode 100644 index 00000000000..78af589b5c0 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh @@ -0,0 +1,18 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +IMM FLT32 { 1.0, 0.0, 0.0, 0.0 } +IMM FLT32 { 1.5, 0.0, 0.0, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +RCP TEMP[0].x, TEMP[0].xxxx +SUB OUT[0], TEMP[0], IMM[1] +MOV OUT[1], IN[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh new file mode 100644 index 00000000000..1675c7d5ff1 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh @@ -0,0 +1,18 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +IMM FLT32 { 1.0, 0.0, 0.0, 0.0 } +IMM FLT32 { 1.5, 0.0, 0.0, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +RSQ TEMP[0].x, TEMP[0].xxxx +SUB OUT[0], TEMP[0], IMM[1] +MOV OUT[1], IN[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh new file mode 100644 index 00000000000..3d92cd5aaeb --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh @@ -0,0 +1,16 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +IMM FLT32 { -0.1, -0.1, 1.0, 0.0 } + +SGE TEMP[0], IN[0], IMM[0] +MOV OUT[0], IN[0] +MUL OUT[1], IN[1], TEMP[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh new file mode 100644 index 00000000000..85c60ff4ec8 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh @@ -0,0 +1,16 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +IMM FLT32 { 0.6, 0.6, 0.0, 0.0 } + +SLT TEMP[0], IN[0], IMM[0] +MOV OUT[0], IN[0] +MUL OUT[1], IN[1], TEMP[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 97f6240dec5..196fcc2d983 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -218,9 +218,18 @@ def main(): 'dst', 'ex2', 'frc', + 'lg2', + 'lit', 'lrp', + 'mad', + 'max', + 'min', 'mov', 'mul', + 'rcp', + 'rsq', + 'sge', + 'slt', 'sub', 'xpd', ] -- cgit v1.2.3 From fbabeb9b56d2e4691ae39339a805d24e860603bb Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 2 Apr 2009 09:59:04 +0200 Subject: python/regress: Do not create zbuf for vertex shader test. --- .../python/tests/regress/vertex-shader/vertex-shader.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 196fcc2d983..362dec3b9cd 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -59,7 +59,7 @@ def test(dev, name): # depth/stencil/alpha depth_stencil_alpha = DepthStencilAlpha() - depth_stencil_alpha.depth.enabled = 1 + depth_stencil_alpha.depth.enabled = 0 depth_stencil_alpha.depth.writemask = 1 depth_stencil_alpha.depth.func = PIPE_FUNC_LESS ctx.set_depth_stencil_alpha(depth_stencil_alpha) @@ -116,20 +116,13 @@ def test(dev, name): width, height, tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, ).get_surface() - zbuf = dev.texture_create( - PIPE_FORMAT_Z32_UNORM, - width, height, - tex_usage=PIPE_TEXTURE_USAGE_DEPTH_STENCIL, - ).get_surface() fb = Framebuffer() fb.width = width fb.height = height fb.nr_cbufs = 1 fb.set_cbuf(0, cbuf) - fb.set_zsbuf(zbuf) ctx.set_framebuffer(fb) ctx.surface_clear(cbuf, 0x80808080) - ctx.surface_clear(zbuf, 0xffffffff) # vertex shader vs = Shader(file('vert-' + name + '.sh', 'rt').read()) -- cgit v1.2.3 From c952b3e907ab31cd5f95157c18ce2f81626aafe4 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 2 Apr 2009 10:30:30 +0200 Subject: dri glx: Propagate driver MakeCurrent errors. Signed-off-by: Thomas Hellstrom --- src/mesa/drivers/dri/common/dri_util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index ae790554055..a9e37ca51eb 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -200,9 +200,8 @@ static int driBindContext(__DRIcontext *pcp, } /* Call device-specific MakeCurrent */ - (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp); - return GL_TRUE; + return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp); } /*@}*/ -- cgit v1.2.3 From 8e753d04045a82062ac34d3b2622eb9dba8af374 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 2 Apr 2009 10:36:40 +0200 Subject: dri glx: Fix dri_util::driBindContext 1) Don't error-check here. It's done in glx makeCurrent. 2) Allow ctx and the dri drawables to be NULL for future use. This is currently blocked in glx makeCurrent. 3) Avoid updating dri drawables unless they are completely uninitialized. Since the updating was done outside of the lock, the driver need to verify and redo it anyway. Signed-off-by: Thomas Hellstrom --- src/mesa/drivers/dri/common/dri_util.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index a9e37ca51eb..38c2e7b00d1 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -163,21 +163,18 @@ static int driBindContext(__DRIcontext *pcp, { __DRIscreenPrivate *psp = pcp->driScreenPriv; - /* - ** Assume error checking is done properly in glXMakeCurrent before - ** calling driBindContext. - */ - - if (pcp == NULL || pdp == None || prp == None) - return GL_FALSE; - /* Bind the drawable to the context */ - pcp->driDrawablePriv = pdp; - pcp->driReadablePriv = prp; - pdp->driContextPriv = pcp; - pdp->refcount++; - if ( pdp != prp ) { - prp->refcount++; + + if (pcp) { + pcp->driDrawablePriv = pdp; + pcp->driReadablePriv = prp; + if (pdp) { + pdp->driContextPriv = pcp; + pdp->refcount++; + } + if ( prp && pdp != prp ) { + prp->refcount++; + } } /* @@ -186,17 +183,16 @@ static int driBindContext(__DRIcontext *pcp, */ if (!psp->dri2.enabled) { - if (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp) { + if (pdp && !pdp->pStamp) { DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); __driUtilUpdateDrawableInfo(pdp); DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); } - - if ((pdp != prp) && (!prp->pStamp || *prp->pStamp != prp->lastStamp)) { + if (prp && pdp != prp && !prp->pStamp) { DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); __driUtilUpdateDrawableInfo(prp); DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - } + } } /* Call device-specific MakeCurrent */ -- cgit v1.2.3 From 96fd3df59a161957876bfd7a49992e5a2130370c Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 2 Apr 2009 11:00:41 +0200 Subject: glx: MakeCurrent fixes. 1) If MakeContextCurrent is called with (NULL, None, None), Don't send the request to the X server if the current context is direct. 2) Return BadMatch in some error cases according to the glx spec. 3) If MakeContextCurrent is called for a context which is current in another thread, return BadAccess according to the glx spec. Signed-off-by: Thomas Hellstrom --- src/glx/x11/glxclient.h | 5 +++++ src/glx/x11/glxcurrent.c | 48 +++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index fa3ec26e60a..bf68d0f8910 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -426,6 +426,11 @@ struct __GLXcontextRec { int server_minor; /**< Minor version number. */ /*@}*/ + /** + * Thread ID we're currently current in. Zero if none. + */ + unsigned long thread_id; + char gl_extension_bits[ __GL_EXT_BYTES ]; }; diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c index 4d0a7c65eba..01f42332413 100644 --- a/src/glx/x11/glxcurrent.c +++ b/src/glx/x11/glxcurrent.c @@ -339,6 +339,20 @@ FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc) } #endif /* GLX_DIRECT_RENDERING */ +static void +__glXGenerateError(Display *dpy, GLXContext gc, XID resource, + BYTE errorCode, CARD16 minorCode) +{ + xError error; + + error.errorCode = errorCode; + error.resourceID = resource; + error.sequenceNumber = dpy->request; + error.type = X_Error; + error.majorCode = gc->majorOpcode; + error.minorCode = minorCode; + _XError(dpy, &error); +} /** * Make a particular context current. @@ -369,8 +383,26 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, return GL_FALSE; } + if (gc == NULL && (draw != None || read != None)) { + __glXGenerateError(dpy, gc, (draw != None) ? draw : read, + BadMatch, X_GLXMakeContextCurrent); + return False; + } + if (gc != NULL && (draw == None || read == None)) { + __glXGenerateError(dpy, gc, None, + BadMatch, X_GLXMakeContextCurrent); + return False; + } + _glapi_check_multithread(); + if (gc != NULL && gc->thread_id != 0 && + gc->thread_id != _glthread_GetID()) { + __glXGenerateError(dpy, gc, gc->xid, + BadAccess, X_GLXMakeContextCurrent); + return False; + } + #ifdef GLX_DIRECT_RENDERING /* Bind the direct rendering context to the drawable */ if (gc && gc->driContext) { @@ -378,21 +410,17 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc); if ((pdraw == NULL) || (pread == NULL)) { - xError error; - - error.errorCode = GLXBadDrawable; - error.resourceID = (pdraw == NULL) ? draw : read; - error.sequenceNumber = dpy->request; - error.type = X_Error; - error.majorCode = gc->majorOpcode; - error.minorCode = X_GLXMakeContextCurrent; - _XError(dpy, &error); + __glXGenerateError(dpy, gc, (pdraw == NULL) ? draw : read, + GLXBadDrawable, X_GLXMakeContextCurrent); return False; } bindReturnValue = (gc->driContext->bindContext) (gc->driContext, pdraw, pread); } + else if (!gc && oldGC && oldGC->driContext) { + bindReturnValue = True; + } else #endif { @@ -453,6 +481,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, oldGC->currentDrawable = None; oldGC->currentReadable = None; oldGC->currentContextTag = 0; + oldGC->thread_id = 0; if (oldGC->xid == None) { /* We are switching away from a context that was @@ -477,6 +506,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, gc->currentDpy = dpy; gc->currentDrawable = draw; gc->currentReadable = read; + gc->thread_id = _glthread_GetID(); #ifdef GLX_DIRECT_RENDERING if (!gc->driContext) { -- cgit v1.2.3 From 39c2fae657b35be043a002a87da574928e06fac1 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 2 Apr 2009 12:19:44 +0200 Subject: python/regress: Do not generate HTML summary for vertex shader test. --- .../python/tests/regress/vertex-shader/vertex-shader.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 362dec3b9cd..4a326faa88e 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -226,25 +226,10 @@ def main(): 'sub', 'xpd', ] - - html = ''' - - - - -
    -

    regression tests for vertex shader

    - -''' dev = Device() for t in tests: test(dev, t) - html += '' - html += '\n' - - html += '
    ' + t + '
    \n\n\n' - file('vertex-shader.htm', 'wt').write(html) if __name__ == '__main__': main() -- cgit v1.2.3 From 29a1ed599b0cde4b9cf4d83ffe559854ea91b304 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 2 Apr 2009 16:59:29 +0200 Subject: progs: Ignores --- progs/glsl/.gitignore | 1 + progs/tests/.gitignore | 5 +++++ progs/trivial/.gitignore | 1 + 3 files changed, 7 insertions(+) diff --git a/progs/glsl/.gitignore b/progs/glsl/.gitignore index 5fdb4ef16d4..d3e31163d8e 100644 --- a/progs/glsl/.gitignore +++ b/progs/glsl/.gitignore @@ -6,6 +6,7 @@ deriv extfuncs.h fragcoord identity +linktest mandelbrot multinoise multitex diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore index 0ed3a885c26..e6369de3ab2 100644 --- a/progs/tests/.gitignore +++ b/progs/tests/.gitignore @@ -45,7 +45,10 @@ invert jkrahntest lineclip manytex +mapbufrange +mapvbo minmag +mipgen mipmap_limits mipmap_view multipal @@ -54,10 +57,12 @@ packedpixels pbo prog_parameter projtex +quads random readrate readtex.c readtex.h +rubberband seccolor sharedtex shader_api diff --git a/progs/trivial/.gitignore b/progs/trivial/.gitignore index aec4c94527d..8dcb20a68ff 100644 --- a/progs/trivial/.gitignore +++ b/progs/trivial/.gitignore @@ -96,6 +96,7 @@ tri-lit tri-logicop-none tri-logicop-xor tri-mask-tri +tri-multitex-vbo tri-orig tri-query tri-repeat -- cgit v1.2.3 From 46d09cb53dd3de7986e3b4d221d7e3af94752c70 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 2 Apr 2009 11:15:53 -0600 Subject: glsl: fix segfault in linker when vertex or fragment shader was missing --- src/mesa/shader/slang/slang_link.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index e2daf72e7de..1fdf4db054c 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -562,6 +562,9 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) } } + if (totalLen == 0) + return NULL; + source = (GLchar *) _mesa_malloc(totalLen + 1); if (!source) return NULL; @@ -620,14 +623,16 @@ get_main_shader(GLcontext *ctx, */ shader = concat_shaders(shProg, type); - _slang_compile(ctx, shader); + if (shader) { + _slang_compile(ctx, shader); - /* Finally, check if recompiling failed */ - if (!shader->CompileStatus || - !shader->Main || - shader->UnresolvedRefs) { - link_error(shProg, "Unresolved symbols"); - return NULL; + /* Finally, check if recompiling failed */ + if (!shader->CompileStatus || + !shader->Main || + shader->UnresolvedRefs) { + link_error(shProg, "Unresolved symbols"); + return NULL; + } } return shader; @@ -650,8 +655,8 @@ _slang_link(GLcontext *ctx, GLhandleARB programObj, struct gl_shader_program *shProg) { - const struct gl_vertex_program *vertProg; - const struct gl_fragment_program *fragProg; + const struct gl_vertex_program *vertProg = NULL; + const struct gl_fragment_program *fragProg = NULL; GLuint numSamplers = 0; GLuint i; -- cgit v1.2.3 From f6a3f1f52a969c8d990a3a41e816af4864eea45c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 2 Apr 2009 13:05:22 -0600 Subject: mesa: don't call ctx->Driver.Draw/CopyPixels() if width or height is zero --- src/mesa/main/drawpix.c | 52 ++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index e9de0c097a0..6682b5e725c 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -77,28 +77,30 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, } if (ctx->RenderMode == GL_RENDER) { - /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ - GLint x = IROUND(ctx->Current.RasterPos[0]); - GLint y = IROUND(ctx->Current.RasterPos[1]); - - if (ctx->Unpack.BufferObj->Name) { - /* unpack from PBO */ - if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawPixels(invalid PBO access)"); - return; + if (width > 0 && height > 0) { + /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ + GLint x = IROUND(ctx->Current.RasterPos[0]); + GLint y = IROUND(ctx->Current.RasterPos[1]); + + if (ctx->Unpack.BufferObj->Name) { + /* unpack from PBO */ + if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(invalid PBO access)"); + return; + } + if (ctx->Unpack.BufferObj->Pointer) { + /* buffer is mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(PBO is mapped)"); + return; + } } - if (ctx->Unpack.BufferObj->Pointer) { - /* buffer is mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawPixels(PBO is mapped)"); - return; - } - } - ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type, - &ctx->Unpack, pixels); + ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type, + &ctx->Unpack, pixels); + } } else if (ctx->RenderMode == GL_FEEDBACK) { /* Feedback the current raster pos info */ @@ -159,10 +161,12 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, if (ctx->RenderMode == GL_RENDER) { /* Round to satisfy conformance tests (matches SGI's OpenGL) */ - GLint destx = IROUND(ctx->Current.RasterPos[0]); - GLint desty = IROUND(ctx->Current.RasterPos[1]); - ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty, - type ); + if (width > 0 && height > 0) { + GLint destx = IROUND(ctx->Current.RasterPos[0]); + GLint desty = IROUND(ctx->Current.RasterPos[1]); + ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty, + type ); + } } else if (ctx->RenderMode == GL_FEEDBACK) { FLUSH_CURRENT( ctx, 0 ); -- cgit v1.2.3 From 7b9bf395433b5fa9d5a95186891a29d49e0b47c0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 2 Apr 2009 13:05:55 -0600 Subject: mesa: don't call ctx->Driver.ReadPixels() if width or height is zero --- src/mesa/main/readpix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index dfdd297b6e7..2326776ecbf 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -170,6 +170,9 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, return; } + if (width == 0 || height == 0) + return; /* nothing to do */ + if (ctx->Pack.BufferObj->Name) { if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1, format, type, pixels)) { -- cgit v1.2.3 From ebc1478e501d43e0de54e7b6c3edfbc81d7d20c6 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 2 Apr 2009 23:38:34 +0200 Subject: mesa: fix TexParameter functions premature return in TexParameterf caused mesa to never call Driver.TexParameter breaking drivers relying on this (fix bug #20966). While here, also fix using ctx->ErrorValue when deciding to call Driver.TexParameter. Errors are sticky and uncleared errors thus would cause this to no longer get called. Since we thus need return value of set_tex_parameter[if] can also optimize this to only call when value changed. --- src/mesa/main/texparam.c | 148 +++++++++++++++++++++++++++-------------------- 1 file changed, 86 insertions(+), 62 deletions(-) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 15c4aa31216..515a35cdfcf 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -179,8 +179,11 @@ flush(GLcontext *ctx, struct gl_texture_object *texObj) } -/** Set an integer-valued texture parameter */ -static void +/** + * Set an integer-valued texture parameter + * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise + */ +static GLboolean set_tex_parameteri(GLcontext *ctx, struct gl_texture_object *texObj, GLenum pname, const GLint *params) @@ -188,13 +191,13 @@ set_tex_parameteri(GLcontext *ctx, switch (pname) { case GL_TEXTURE_MIN_FILTER: if (texObj->MinFilter == params[0]) - return; + return GL_FALSE; switch (params[0]) { case GL_NEAREST: case GL_LINEAR: flush(ctx, texObj); texObj->MinFilter = params[0]; - return; + return GL_TRUE; case GL_NEAREST_MIPMAP_NEAREST: case GL_LINEAR_MIPMAP_NEAREST: case GL_NEAREST_MIPMAP_LINEAR: @@ -202,90 +205,95 @@ set_tex_parameteri(GLcontext *ctx, if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) { flush(ctx, texObj); texObj->MinFilter = params[0]; - return; + return GL_TRUE; } /* fall-through */ default: _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); } - return; + return GL_FALSE; case GL_TEXTURE_MAG_FILTER: if (texObj->MagFilter == params[0]) - return; + return GL_FALSE; switch (params[0]) { case GL_NEAREST: case GL_LINEAR: flush(ctx, texObj); texObj->MagFilter = params[0]; - return; + return GL_TRUE; default: _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); } - return; + return GL_FALSE; case GL_TEXTURE_WRAP_S: if (texObj->WrapS == params[0]) - return; + return GL_FALSE; if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) { flush(ctx, texObj); texObj->WrapS = params[0]; + return GL_TRUE; } - return; + return GL_FALSE; case GL_TEXTURE_WRAP_T: if (texObj->WrapT == params[0]) - return; + return GL_FALSE; if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) { flush(ctx, texObj); texObj->WrapT = params[0]; + return GL_TRUE; } - return; + return GL_FALSE; case GL_TEXTURE_WRAP_R: if (texObj->WrapR == params[0]) - return; + return GL_FALSE; if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) { flush(ctx, texObj); texObj->WrapR = params[0]; + return GL_TRUE; } - return; + return GL_FALSE; case GL_TEXTURE_BASE_LEVEL: if (texObj->BaseLevel == params[0]) - return; + return GL_FALSE; if (params[0] < 0 || (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)"); - return; + return GL_FALSE; } flush(ctx, texObj); texObj->BaseLevel = params[0]; - return; + return GL_TRUE; case GL_TEXTURE_MAX_LEVEL: if (texObj->MaxLevel == params[0]) - return; + return GL_FALSE; if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)"); - return; + return GL_FALSE; } flush(ctx, texObj); texObj->MaxLevel = params[0]; - return; + return GL_TRUE; case GL_GENERATE_MIPMAP_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { if (texObj->GenerateMipmap != params[0]) { flush(ctx, texObj); texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; + return GL_TRUE; } + return GL_FALSE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)"); } - return; + return GL_FALSE; case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow && @@ -294,24 +302,26 @@ set_tex_parameteri(GLcontext *ctx, if (texObj->CompareMode != params[0]) { flush(ctx, texObj); texObj->CompareMode = params[0]; + return GL_TRUE; } + return GL_FALSE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(GL_TEXTURE_COMPARE_MODE_ARB)"); } - return; + return GL_FALSE; case GL_TEXTURE_COMPARE_FUNC_ARB: if (ctx->Extensions.ARB_shadow) { if (texObj->CompareFunc == params[0]) - return; + return GL_FALSE; switch (params[0]) { case GL_LEQUAL: case GL_GEQUAL: flush(ctx, texObj); texObj->CompareFunc = params[0]; - return; + return GL_TRUE; case GL_EQUAL: case GL_NOTEQUAL: case GL_LESS: @@ -321,7 +331,7 @@ set_tex_parameteri(GLcontext *ctx, if (ctx->Extensions.EXT_shadow_funcs) { flush(ctx, texObj); texObj->CompareFunc = params[0]; - return; + return GL_TRUE; } /* fall-through */ default: @@ -332,7 +342,7 @@ set_tex_parameteri(GLcontext *ctx, else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)"); } - return; + return GL_FALSE; case GL_DEPTH_TEXTURE_MODE_ARB: if (ctx->Extensions.ARB_depth_texture && @@ -342,13 +352,14 @@ set_tex_parameteri(GLcontext *ctx, if (texObj->DepthMode != params[0]) { flush(ctx, texObj); texObj->DepthMode = params[0]; + return GL_TRUE; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(GL_DEPTH_TEXTURE_MODE_ARB)"); } - return; + return GL_FALSE; #ifdef FEATURE_OES_draw_texture case GL_TEXTURE_CROP_RECT_OES: @@ -356,7 +367,7 @@ set_tex_parameteri(GLcontext *ctx, texObj->CropRect[1] = params[1]; texObj->CropRect[2] = params[2]; texObj->CropRect[3] = params[3]; - return; + return GL_TRUE; #endif case GL_TEXTURE_SWIZZLE_R_EXT: @@ -369,18 +380,18 @@ set_tex_parameteri(GLcontext *ctx, if (swz < 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(swizzle 0x%x)", params[0]); - return; + return GL_FALSE; } ASSERT(comp < 4); if (swz >= 0) { flush(ctx, texObj); texObj->Swizzle[comp] = params[0]; set_swizzle_component(&texObj->_Swizzle, comp, swz); - return; + return GL_TRUE; } } _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname); - return; + return GL_FALSE; case GL_TEXTURE_SWIZZLE_RGBA_EXT: if (ctx->Extensions.EXT_texture_swizzle) { @@ -395,22 +406,26 @@ set_tex_parameteri(GLcontext *ctx, else { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(swizzle 0x%x)", params[comp]); - return; + return GL_FALSE; } } - return; + return GL_TRUE; } _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname); - return; + return GL_FALSE; default: _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname); } + return GL_FALSE; } -/** Set a float-valued texture parameter */ -static void +/** + * Set a float-valued texture parameter + * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise + */ +static GLboolean set_tex_parameterf(GLcontext *ctx, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params) @@ -418,54 +433,56 @@ set_tex_parameterf(GLcontext *ctx, switch (pname) { case GL_TEXTURE_MIN_LOD: if (texObj->MinLod == params[0]) - return; + return GL_FALSE; flush(ctx, texObj); texObj->MinLod = params[0]; - return; + return GL_TRUE; case GL_TEXTURE_MAX_LOD: if (texObj->MaxLod == params[0]) - return; + return GL_FALSE; flush(ctx, texObj); texObj->MaxLod = params[0]; - return; + return GL_TRUE; case GL_TEXTURE_PRIORITY: flush(ctx, texObj); texObj->Priority = CLAMP(params[0], 0.0F, 1.0F); - return; + return GL_TRUE; case GL_TEXTURE_MAX_ANISOTROPY_EXT: if (ctx->Extensions.EXT_texture_filter_anisotropic) { if (texObj->MaxAnisotropy == params[0]) - return; + return GL_FALSE; if (params[0] < 1.0) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); - return; + return GL_FALSE; } flush(ctx, texObj); /* clamp to max, that's what NVIDIA does */ texObj->MaxAnisotropy = MIN2(params[0], ctx->Const.MaxTextureMaxAnisotropy); + return GL_TRUE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)"); } - return; + return GL_FALSE; case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: if (ctx->Extensions.ARB_shadow_ambient) { if (texObj->CompareFailValue != params[0]) { flush(ctx, texObj); texObj->CompareFailValue = CLAMP(params[0], 0.0F, 1.0F); + return GL_TRUE; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)"); } - return; + return GL_FALSE; case GL_TEXTURE_LOD_BIAS: /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */ @@ -473,7 +490,9 @@ set_tex_parameterf(GLcontext *ctx, if (texObj->LodBias != params[0]) { flush(ctx, texObj); texObj->LodBias = params[0]; + return GL_TRUE; } + return GL_FALSE; } break; @@ -483,17 +502,19 @@ set_tex_parameterf(GLcontext *ctx, texObj->BorderColor[GCOMP] = params[1]; texObj->BorderColor[BCOMP] = params[2]; texObj->BorderColor[ACOMP] = params[3]; - return; + return GL_TRUE; default: _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname); } + return GL_FALSE; } void GLAPIENTRY _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) { + GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -517,15 +538,15 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) { /* convert float param to int */ GLint p = (GLint) param; - set_tex_parameteri(ctx, texObj, pname, &p); + need_update = set_tex_parameteri(ctx, texObj, pname, &p); } - return; + break; default: /* this will generate an error if pname is illegal */ - set_tex_parameterf(ctx, texObj, pname, ¶m); + need_update = set_tex_parameterf(ctx, texObj, pname, ¶m); } - if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) { + if (ctx->Driver.TexParameter && need_update) { ctx->Driver.TexParameter(ctx, target, texObj, pname, ¶m); } } @@ -534,6 +555,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) void GLAPIENTRY _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) { + GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -557,7 +579,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) { /* convert float param to int */ GLint p = (GLint) params[0]; - set_tex_parameteri(ctx, texObj, pname, &p); + need_update = set_tex_parameteri(ctx, texObj, pname, &p); } break; @@ -570,17 +592,17 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) iparams[1] = (GLint) params[1]; iparams[2] = (GLint) params[2]; iparams[3] = (GLint) params[3]; - set_tex_parameteri(ctx, target, iparams); + need_update = set_tex_parameteri(ctx, target, iparams); } break; #endif default: /* this will generate an error if pname is illegal */ - set_tex_parameterf(ctx, texObj, pname, params); + need_update = set_tex_parameterf(ctx, texObj, pname, params); } - if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) { + if (ctx->Driver.TexParameter && need_update) { ctx->Driver.TexParameter(ctx, target, texObj, pname, params); } } @@ -589,6 +611,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) void GLAPIENTRY _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) { + GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -607,15 +630,15 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) { GLfloat fparam = (GLfloat) param; /* convert int param to float */ - set_tex_parameterf(ctx, texObj, pname, &fparam); + need_update = set_tex_parameterf(ctx, texObj, pname, &fparam); } break; default: /* this will generate an error if pname is illegal */ - set_tex_parameteri(ctx, texObj, pname, ¶m); + need_update = set_tex_parameteri(ctx, texObj, pname, ¶m); } - if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) { + if (ctx->Driver.TexParameter && need_update) { GLfloat fparam = (GLfloat) param; ctx->Driver.TexParameter(ctx, target, texObj, pname, &fparam); } @@ -625,6 +648,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) void GLAPIENTRY _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) { + GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -642,7 +666,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) fparams[1] = INT_TO_FLOAT(params[1]); fparams[2] = INT_TO_FLOAT(params[2]); fparams[3] = INT_TO_FLOAT(params[3]); - set_tex_parameterf(ctx, texObj, pname, fparams); + need_update = set_tex_parameterf(ctx, texObj, pname, fparams); } break; case GL_TEXTURE_MIN_LOD: @@ -654,15 +678,15 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) { /* convert int param to float */ GLfloat fparam = (GLfloat) params[0]; - set_tex_parameterf(ctx, texObj, pname, &fparam); + need_update = set_tex_parameterf(ctx, texObj, pname, &fparam); } break; default: /* this will generate an error if pname is illegal */ - set_tex_parameteri(ctx, texObj, pname, params); + need_update = set_tex_parameteri(ctx, texObj, pname, params); } - if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) { + if (ctx->Driver.TexParameter && need_update) { GLfloat fparams[4]; fparams[0] = INT_TO_FLOAT(params[0]); if (pname == GL_TEXTURE_BORDER_COLOR || -- cgit v1.2.3 From 030533dd10b3b30ed5b132fe59f89040ce56e3a0 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Wed, 1 Apr 2009 08:37:36 +1000 Subject: nv50: fix viewport state update --- src/gallium/drivers/nv50/nv50_state_validate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index fc6157dbd09..c13d3de1cb9 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -244,7 +244,7 @@ nv50_state_validate(struct nv50_context *nv50) } scissor_uptodate: - if (nv50->dirty & NV50_NEW_VIEWPORT) { + if (nv50->dirty & (NV50_NEW_VIEWPORT | NV50_NEW_RASTERIZER)) { unsigned bypass; if (!nv50->rasterizer->pipe.bypass_vs_clip_and_viewport) @@ -281,6 +281,7 @@ scissor_uptodate: so_ref(so, &nv50->state.viewport); so_ref(NULL, &so); + nv50->state.dirty |= NV50_NEW_VIEWPORT; } viewport_uptodate: -- cgit v1.2.3 From 016052c18ff6f7ea7f4cf0e7e93c796688f772ed Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 3 Apr 2009 08:26:53 +0200 Subject: python/regress: Add vertex shader source modifier tests. --- .../tests/regress/vertex-shader/vert-srcmod-abs.sh | 15 +++++++++++++++ .../tests/regress/vertex-shader/vert-srcmod-absneg.sh | 16 ++++++++++++++++ .../tests/regress/vertex-shader/vert-srcmod-neg.sh | 12 ++++++++++++ .../tests/regress/vertex-shader/vert-srcmod-swz.sh | 12 ++++++++++++ .../python/tests/regress/vertex-shader/vertex-shader.py | 4 ++++ 5 files changed, 59 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh new file mode 100644 index 00000000000..6db417a62e5 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh @@ -0,0 +1,15 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +DCL TEMP[0] + +IMM FLT32 { 0.1, 0.1, 0.0, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +MOV OUT[0], |TEMP[0]| +MOV OUT[1], IN[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh new file mode 100644 index 00000000000..fc832380520 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh @@ -0,0 +1,16 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +DCL TEMP[0] + +IMM FLT32 { -0.2, -0.2, 0.0, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +MOV OUT[0].xy, -|TEMP[0]| +MOV OUT[0].zw, IN[0] +MOV OUT[1], IN[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh new file mode 100644 index 00000000000..ce4e90b5e10 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh @@ -0,0 +1,12 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +MOV OUT[0].xy, -IN[0] +MOV OUT[0].zw, IN[0] +MOV OUT[1], IN[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh new file mode 100644 index 00000000000..7617b6d5200 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh @@ -0,0 +1,12 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL IN[1], COLOR +DCL OUT[0], POSITION +DCL OUT[1], COLOR +DCL TEMP[0] + +MOV OUT[0], IN[0].yxzw +MOV OUT[1], IN[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 4a326faa88e..7fc5f5ec514 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -223,6 +223,10 @@ def main(): 'rsq', 'sge', 'slt', + 'srcmod-abs', + 'srcmod-absneg', + 'srcmod-neg', + 'srcmod-swz', 'sub', 'xpd', ] -- cgit v1.2.3 From f7039fde4f9e1175c3dae534e5b91e22e693124a Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 3 Apr 2009 12:49:05 +0100 Subject: mesa: ensure pbo stencil buffers are mapped before use --- src/mesa/state_tracker/st_cb_drawpixels.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index f9f139ff073..8926aa38a28 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -640,6 +640,9 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, stmap = screen->transfer_map(screen, pt); + pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels); + assert(pixels); + /* if width > MAX_WIDTH, have to process image in chunks */ skipPixels = 0; while (skipPixels < width) { @@ -705,6 +708,8 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, skipPixels += spanWidth; } + _mesa_unmap_drawpix_pbo(ctx, unpack); + /* unmap the stencil buffer */ screen->transfer_unmap(screen, pt); screen->tex_transfer_destroy(pt); -- cgit v1.2.3 From cc770e0a0cbb2c0ff4327ffb0bf20f52ccc218cc Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 3 Apr 2009 14:54:20 +0200 Subject: tgsi/text: Allow `-|src|` variant of `-(|src|)`. --- src/gallium/auxiliary/tgsi/tgsi_text.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index fdaee9b060b..bb1c7dc6ccf 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -562,6 +562,7 @@ parse_src_operand( uint ind_file; int ind_index; uint swizzle[4]; + boolean parsed_ext_negate_paren = FALSE; boolean parsed_swizzle; boolean parsed_extswizzle; @@ -574,10 +575,17 @@ parse_src_operand( src->SrcRegisterExtMod.Negate = 1; eat_opt_white( &cur ); ctx->cur = cur; + parsed_ext_negate_paren = TRUE; + } + else if (*cur == '|') { + cur++; + src->SrcRegisterExtMod.Negate = 1; + src->SrcRegisterExtMod.Absolute = 1; + eat_opt_white(&cur); + ctx->cur = cur; } } - - if (*ctx->cur == '|') { + else if (*ctx->cur == '|') { ctx->cur++; eat_opt_white( &ctx->cur ); src->SrcRegisterExtMod.Absolute = 1; @@ -715,7 +723,7 @@ parse_src_operand( ctx->cur++; } - if (src->SrcRegisterExtMod.Negate) { + if (parsed_ext_negate_paren) { eat_opt_white( &ctx->cur ); if (*ctx->cur != ')') { report_error( ctx, "Expected `)'" ); -- cgit v1.2.3 From d2ed91201e1abcc61e30b367c00c6e0f036d9214 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 3 Apr 2009 14:58:39 +0200 Subject: util/debug: Initialise local variables. --- src/gallium/auxiliary/util/u_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 1b984425b59..96a2222f9b6 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -720,8 +720,8 @@ debug_dump_surface_bmp(const char *filename, struct pipe_surface *surface) { struct pipe_transfer *transfer; - struct pipe_texture *texture; - struct pipe_screen *screen; + struct pipe_texture *texture = surface->texture; + struct pipe_screen *screen = texture->screen; transfer = screen->get_tex_transfer(screen, texture, surface->face, surface->level, surface->zslice, -- cgit v1.2.3 From 37661516ea3862ac4c94d8bcf5064bbb95f31aea Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 3 Apr 2009 16:36:20 +0200 Subject: python/regress: Add relative addressing tests. --- .../python/tests/regress/vertex-shader/vert-arl.sh | 23 ++++++++++++++++++++++ .../python/tests/regress/vertex-shader/vert-arr.sh | 23 ++++++++++++++++++++++ .../python/tests/regress/vertex-shader/vert-flr.sh | 23 ++++++++++++++++++++++ .../tests/regress/vertex-shader/vertex-shader.py | 3 +++ 4 files changed, 72 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh new file mode 100644 index 00000000000..7638e96346e --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh @@ -0,0 +1,23 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +DCL ADDR[0] + +IMM FLT32 { 3.0, 1.0, 1.0, 1.0 } +IMM FLT32 { 1.0, 0.0, 0.0, 1.0 } +IMM FLT32 { 0.0, 1.0, 0.0, 1.0 } +IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } +IMM FLT32 { 1.0, 1.0, 0.0, 1.0 } +IMM FLT32 { 0.0, 1.0, 1.0, 1.0 } + +MOV OUT[0], IN[0] +MUL TEMP[0], IN[0], IMM[0] +ARL ADDR[0].x, TEMP[0] +MOV OUT[1], IMM[ADDR[0].x + 3] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh new file mode 100644 index 00000000000..28ce6f9a0cf --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh @@ -0,0 +1,23 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +DCL ADDR[0] + +IMM FLT32 { 3.0, 1.0, 1.0, 1.0 } +IMM FLT32 { 1.0, 0.0, 0.0, 1.0 } +IMM FLT32 { 0.0, 1.0, 0.0, 1.0 } +IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } +IMM FLT32 { 1.0, 1.0, 0.0, 1.0 } +IMM FLT32 { 0.0, 1.0, 1.0, 1.0 } + +MOV OUT[0], IN[0] +MUL TEMP[0], IN[0], IMM[0] +ARR ADDR[0].x, TEMP[0] +MOV OUT[1], IMM[ADDR[0].x + 3] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh new file mode 100644 index 00000000000..44ad708119d --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh @@ -0,0 +1,23 @@ +VERT1.1 + +DCL IN[0], POSITION +DCL OUT[0], POSITION +DCL OUT[1], COLOR + +DCL TEMP[0] + +DCL ADDR[0] + +IMM FLT32 { 3.0, 1.0, 1.0, 1.0 } +IMM FLT32 { 1.0, 0.0, 0.0, 1.0 } +IMM FLT32 { 0.0, 1.0, 0.0, 1.0 } +IMM FLT32 { 0.0, 0.0, 1.0, 1.0 } +IMM FLT32 { 1.0, 1.0, 0.0, 1.0 } +IMM FLT32 { 0.0, 1.0, 1.0, 1.0 } + +MOV OUT[0], IN[0] +MUL TEMP[0], IN[0], IMM[0] +FLR ADDR[0].x, TEMP[0] +MOV OUT[1], IMM[ADDR[0].x + 3] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 7fc5f5ec514..6a927f59575 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -206,10 +206,13 @@ def main(): tests = [ 'abs', 'add', + 'arl', + 'arr', 'dp3', 'dp4', 'dst', 'ex2', + 'flr', 'frc', 'lg2', 'lit', -- cgit v1.2.3 From 3b7c9a9a1633fcd6930d7b8c7ed962add2be3dd8 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 3 Apr 2009 16:37:34 +0200 Subject: python/regress: vertex shader FRC test does not use IN[1]. --- .../state_trackers/python/tests/regress/vertex-shader/vert-frc.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh index 91c0f9c70dd..d179749de84 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh @@ -1,7 +1,6 @@ VERT1.1 DCL IN[0], POSITION -DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR -- cgit v1.2.3 From dfab375c07545a9068a9b25efee746efd275bf89 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 3 Apr 2009 17:06:36 +0200 Subject: tgsi/text: Allow optional component selection for indirect registers. --- src/gallium/auxiliary/tgsi/tgsi_text.c | 43 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index bb1c7dc6ccf..a40fcab2126 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -358,9 +358,9 @@ parse_register_dst( /* Parse source register operand. * ::= `]' | - * `]' | - * `+' `]' | - * `-' `]' + * [`.' (`x' | `y' | `z' | `w')] `]' | + * [`.' (`x' | `y' | `z' | `w')] `+' `]' | + * [`.' (`x' | `y' | `z' | `w')] `-' `]' */ static boolean parse_register_src( @@ -368,11 +368,13 @@ parse_register_src( uint *file, int *index, uint *ind_file, - int *ind_index ) + int *ind_index, + uint *ind_comp) { const char *cur; uint uindex; + *ind_comp = TGSI_SWIZZLE_X; if (!parse_register_file_bracket( ctx, file )) return FALSE; eat_opt_white( &ctx->cur ); @@ -381,6 +383,32 @@ parse_register_src( if (!parse_register_dst( ctx, ind_file, ind_index )) return FALSE; eat_opt_white( &ctx->cur ); + + if (*ctx->cur == '.') { + ctx->cur++; + eat_opt_white(&ctx->cur); + + switch (uprcase(*ctx->cur)) { + case 'X': + *ind_comp = TGSI_SWIZZLE_X; + break; + case 'Y': + *ind_comp = TGSI_SWIZZLE_Y; + break; + case 'Z': + *ind_comp = TGSI_SWIZZLE_Z; + break; + case 'W': + *ind_comp = TGSI_SWIZZLE_W; + break; + default: + report_error(ctx, "Expected indirect register swizzle component `x', `y', `z' or `w'"); + return FALSE; + } + ctx->cur++; + eat_opt_white(&ctx->cur); + } + if (*ctx->cur == '+' || *ctx->cur == '-') { boolean negate; @@ -561,6 +589,7 @@ parse_src_operand( int index; uint ind_file; int ind_index; + uint ind_comp; uint swizzle[4]; boolean parsed_ext_negate_paren = FALSE; boolean parsed_swizzle; @@ -643,7 +672,7 @@ parse_src_operand( } } - if (!parse_register_src( ctx, &file, &index, &ind_file, &ind_index )) + if (!parse_register_src(ctx, &file, &index, &ind_file, &ind_index, &ind_comp)) return FALSE; src->SrcRegister.File = file; src->SrcRegister.Index = index; @@ -651,6 +680,10 @@ parse_src_operand( src->SrcRegister.Indirect = 1; src->SrcRegisterInd.File = ind_file; src->SrcRegisterInd.Index = ind_index; + src->SrcRegisterInd.SwizzleX = ind_comp; + src->SrcRegisterInd.SwizzleY = ind_comp; + src->SrcRegisterInd.SwizzleZ = ind_comp; + src->SrcRegisterInd.SwizzleW = ind_comp; } /* Parse optional swizzle. -- cgit v1.2.3 From 9f146943ec3893c9aed1754a59eec45f37ca65cd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Mar 2009 09:56:33 -0600 Subject: i965: whitespace changes, comments --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 37 +++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 3807dff9919..ad7431a19bc 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -60,7 +60,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) /* Deal with curbe alignment: */ - reg += ((6+c->key.nr_userclip+3)/4)*2; + reg += ((6+c->key.nr_userclip + 3) / 4) * 2; } /* Vertex program parameters from curbe: @@ -77,7 +77,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) */ c->nr_inputs = 0; for (i = 0; i < VERT_ATTRIB_MAX; i++) { - if (c->prog_data.inputs_read & (1<prog_data.inputs_read & (1 << i)) { c->nr_inputs++; c->regs[PROGRAM_INPUT][i] = brw_vec8_grf(reg, 0); reg++; @@ -91,7 +91,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) c->first_output = reg; mrf = 4; for (i = 0; i < VERT_RESULT_MAX; i++) { - if (c->prog_data.outputs_written & (1<prog_data.outputs_written & (1 << i)) { c->nr_outputs++; if (i == VERT_RESULT_HPOS) { c->regs[PROGRAM_OUTPUT][i] = brw_vec8_grf(reg, 0); @@ -133,16 +133,15 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) } for (i = 0; i < 128; i++) { - if (c->output_regs[i].used_in_src) { - c->output_regs[i].reg = brw_vec8_grf(reg, 0); - reg++; - } + if (c->output_regs[i].used_in_src) { + c->output_regs[i].reg = brw_vec8_grf(reg, 0); + reg++; + } } c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg, 0); reg += 2; - - + /* Some opcodes need an internal temporary: */ c->first_tmp = reg; @@ -152,9 +151,9 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) * urb_read_length is the number of registers read from *each* * vertex urb, so is half the amount: */ - c->prog_data.urb_read_length = (c->nr_inputs+1)/2; + c->prog_data.urb_read_length = (c->nr_inputs + 1) / 2; - c->prog_data.urb_entry_size = (c->nr_outputs+2+3)/4; + c->prog_data.urb_entry_size = (c->nr_outputs + 2 + 3) / 4; c->prog_data.total_grf = reg; if (INTEL_DEBUG & DEBUG_VS) { @@ -187,6 +186,10 @@ static void release_tmps( struct brw_vs_compile *c ) } +/** + * If an instruction uses a temp reg both as a src and the dest, we + * sometimes need to allocate an intermediate temporary. + */ static void unalias1( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, @@ -206,6 +209,10 @@ static void unalias1( struct brw_vs_compile *c, } } +/** + * \sa unalias2 + * Checkes if 2-operand instruction needs an intermediate temporary. + */ static void unalias2( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, @@ -228,6 +235,10 @@ static void unalias2( struct brw_vs_compile *c, } } +/** + * \sa unalias2 + * Checkes if 3-operand instruction needs an intermediate temporary. + */ static void unalias3( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, @@ -981,7 +992,7 @@ post_vs_emit( struct brw_vs_compile *c, } -/* Emit the fragment program instructions here. +/* Emit the vertex program instructions here. */ void brw_vs_emit(struct brw_vs_compile *c ) { @@ -1038,7 +1049,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) struct prog_src_register *src = &inst->SrcReg[i]; index = src->Index; file = src->File; - if (file == PROGRAM_OUTPUT&&c->output_regs[index].used_in_src) + if (file == PROGRAM_OUTPUT && c->output_regs[index].used_in_src) args[i] = c->output_regs[index].reg; else args[i] = get_arg(c, src); -- cgit v1.2.3 From bf28b576cb6aa403b840d8254a1ff3f31d664b46 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Mar 2009 14:40:51 -0600 Subject: i965: fix indentation --- src/mesa/drivers/dri/i965/brw_wm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 03dc08fcca9..98c22121ec1 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -242,8 +242,8 @@ struct brw_wm_compile { /** Mapping from Mesa registers to hardware registers */ struct { - GLboolean inited; - struct brw_reg reg; + GLboolean inited; + struct brw_reg reg; } wm_regs[PROGRAM_PAYLOAD+1][256][4]; struct brw_reg stack; -- cgit v1.2.3 From c82851598f535f5c92885987cafbb5e79a2505db Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Mar 2009 14:43:51 -0600 Subject: i965: rename scratch_buffer -> scratch_bo to be consistant with other buffers --- src/mesa/drivers/dri/i965/brw_context.h | 2 +- src/mesa/drivers/dri/i965/brw_wm_state.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 48ed4325bef..a020b621d6c 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -588,7 +588,7 @@ struct brw_context GLuint nr_surfaces; GLuint max_threads; - dri_bo *scratch_buffer; + dri_bo *scratch_bo; GLuint sampler_count; dri_bo *sampler_bo; diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 5b14074502a..3ef451405c3 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -142,7 +142,7 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key, if (key->total_scratch != 0) { wm.thread2.scratch_space_base_pointer = - brw->wm.scratch_buffer->offset >> 10; /* reloc */ + brw->wm.scratch_bo->offset >> 10; /* reloc */ wm.thread2.per_thread_scratch_space = key->total_scratch / 1024 - 1; } else { wm.thread2.scratch_space_base_pointer = 0; @@ -220,7 +220,7 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key, 0, 0, wm.thread2.per_thread_scratch_space, offsetof(struct brw_wm_unit_state, thread2), - brw->wm.scratch_buffer); + brw->wm.scratch_bo); } /* Emit sampler state relocation */ @@ -251,20 +251,20 @@ static void upload_wm_unit( struct brw_context *brw ) if (key.total_scratch) { GLuint total = key.total_scratch * key.max_threads; - if (brw->wm.scratch_buffer && total > brw->wm.scratch_buffer->size) { - dri_bo_unreference(brw->wm.scratch_buffer); - brw->wm.scratch_buffer = NULL; + if (brw->wm.scratch_bo && total > brw->wm.scratch_bo->size) { + dri_bo_unreference(brw->wm.scratch_bo); + brw->wm.scratch_bo = NULL; } - if (brw->wm.scratch_buffer == NULL) { - brw->wm.scratch_buffer = dri_bo_alloc(intel->bufmgr, - "wm scratch", - total, - 4096); + if (brw->wm.scratch_bo == NULL) { + brw->wm.scratch_bo = dri_bo_alloc(intel->bufmgr, + "wm scratch", + total, + 4096); } } reloc_bufs[0] = brw->wm.prog_bo; - reloc_bufs[1] = brw->wm.scratch_buffer; + reloc_bufs[1] = brw->wm.scratch_bo; reloc_bufs[2] = brw->wm.sampler_bo; dri_bo_unreference(brw->wm.state_bo); -- cgit v1.2.3 From 499972102271a08ba41bc34f95e2013311ef8de5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 09:42:09 -0600 Subject: i965: comments, whitespace changes --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 4372ed3d9a1..d65b1332c61 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1024,8 +1024,8 @@ static void emit_fb_write( struct brw_wm_compile *c, } -/* Post-fragment-program processing. Send the results to the - * framebuffer. +/** + * Move a GPR to scratch memory. */ static void emit_spill( struct brw_wm_compile *c, struct brw_reg reg, @@ -1049,6 +1049,9 @@ static void emit_spill( struct brw_wm_compile *c, } +/** + * Load a GPR from scratch memory. + */ static void emit_unspill( struct brw_wm_compile *c, struct brw_reg reg, GLuint slot ) @@ -1069,13 +1072,14 @@ static void emit_unspill( struct brw_wm_compile *c, brw_dp_READ_16(p, retype(vec16(reg), BRW_REGISTER_TYPE_UW), - 1, + 1, slot); } /** - * Retrieve upto 4 GEN4 register pairs for the given wm reg: + * Retrieve up to 4 GEN4 register pairs for the given wm reg: + * Args with unspill_reg != 0 will be loaded from scratch memory. */ static void get_argument_regs( struct brw_wm_compile *c, struct brw_wm_ref *arg[], @@ -1085,13 +1089,12 @@ static void get_argument_regs( struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (arg[i]) { - - if (arg[i]->unspill_reg) - emit_unspill(c, + if (arg[i]->unspill_reg) + emit_unspill(c, brw_vec8_grf(arg[i]->unspill_reg, 0), arg[i]->value->spill_slot); - regs[i] = arg[i]->hw_reg; + regs[i] = arg[i]->hw_reg; } else { regs[i] = brw_null_reg(); @@ -1100,6 +1103,9 @@ static void get_argument_regs( struct brw_wm_compile *c, } +/** + * For values that have a spill_slot!=0, write those regs to scratch memory. + */ static void spill_values( struct brw_wm_compile *c, struct brw_wm_value *values, GLuint nr ) -- cgit v1.2.3 From 7709b26e6b615f4e5ace765110eb53ce713b0d6c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 09:44:10 -0600 Subject: i965: formatting clean-ups --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index ad7431a19bc..0d6c6ab9a8a 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -49,7 +49,8 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) /* r0 -- reserved as usual */ - c->r0 = brw_vec8_grf(reg, 0); reg++; + c->r0 = brw_vec8_grf(reg, 0); + reg++; /* User clip planes from curbe: */ @@ -60,7 +61,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) /* Deal with curbe alignment: */ - reg += ((6+c->key.nr_userclip + 3) / 4) * 2; + reg += ((6 + c->key.nr_userclip + 3) / 4) * 2; } /* Vertex program parameters from curbe: @@ -69,7 +70,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) for (i = 0; i < nr_params; i++) { c->regs[PROGRAM_STATE_VAR][i] = stride( brw_vec4_grf(reg+i/2, (i%2) * 4), 0, 4, 1); } - reg += (nr_params+1)/2; + reg += (nr_params + 1) / 2; c->prog_data.curb_read_length = reg - 1; -- cgit v1.2.3 From 5d7f3ae15c62d46e8857c159978c1c75e07cc59b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 09:54:48 -0600 Subject: i965: remove unneeded #includes --- src/mesa/drivers/dri/i965/brw_tex.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index ef99e9c1aea..71bff166dda 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -32,21 +32,12 @@ #include "main/glheader.h" #include "main/mtypes.h" -#include "main/imports.h" -#include "main/simple_list.h" -#include "main/enums.h" -#include "main/image.h" #include "main/teximage.h" -#include "main/texstore.h" -#include "main/texformat.h" - -#include "texmem.h" #include "intel_context.h" #include "intel_regions.h" #include "intel_tex.h" #include "brw_context.h" -#include "brw_defines.h" void brw_FrameBufferTexInit( struct brw_context *brw, -- cgit v1.2.3 From d5346a925c569d959eb9ebedda95fdddb9d5350c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 10:35:40 -0600 Subject: i965: comments, clean-up in prepare_wm_surfaces() --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 26 ++++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) 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 2f1f4c55f94..1fc537ca206 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -477,7 +477,8 @@ static void prepare_wm_surfaces(struct brw_context *brw ) GLuint i; int old_nr_surfaces; - if (brw->state.nr_color_regions > 1) { + /* Update surfaces for drawing buffers */ + if (brw->state.nr_color_regions > 1) { for (i = 0; i < brw->state.nr_color_regions; i++) { brw_update_region_surface(brw, brw->state.color_regions[i], i, GL_FALSE); @@ -489,25 +490,28 @@ static void prepare_wm_surfaces(struct brw_context *brw ) old_nr_surfaces = brw->wm.nr_surfaces; brw->wm.nr_surfaces = MAX_DRAW_BUFFERS; + /* Update surfaces for textures */ for (i = 0; i < BRW_MAX_TEX_UNIT; i++) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + const GLuint j = MAX_DRAW_BUFFERS + i; /* _NEW_TEXTURE, BRW_NEW_TEXDATA */ - if(texUnit->_ReallyEnabled) { + if (texUnit->_ReallyEnabled) { if (texUnit->_Current == intel->frame_buffer_texobj) { - dri_bo_unreference(brw->wm.surf_bo[i+MAX_DRAW_BUFFERS]); - brw->wm.surf_bo[i+MAX_DRAW_BUFFERS] = brw->wm.surf_bo[0]; - dri_bo_reference(brw->wm.surf_bo[i+MAX_DRAW_BUFFERS]); - brw->wm.nr_surfaces = i + MAX_DRAW_BUFFERS + 1; + /* render to texture */ + dri_bo_unreference(brw->wm.surf_bo[j]); + brw->wm.surf_bo[j] = brw->wm.surf_bo[0]; + dri_bo_reference(brw->wm.surf_bo[j]); + brw->wm.nr_surfaces = j + 1; } else { + /* regular texture */ brw_update_texture_surface(ctx, i); - brw->wm.nr_surfaces = i + MAX_DRAW_BUFFERS + 1; + brw->wm.nr_surfaces = j + 1; } } else { - dri_bo_unreference(brw->wm.surf_bo[i+MAX_DRAW_BUFFERS]); - brw->wm.surf_bo[i+MAX_DRAW_BUFFERS] = NULL; + dri_bo_unreference(brw->wm.surf_bo[j]); + brw->wm.surf_bo[j] = NULL; } - } dri_bo_unreference(brw->wm.bind_bo); -- cgit v1.2.3 From f1b9a5cff15abf89c24a0c54481451cb8d23f454 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 14:48:53 -0600 Subject: i965: fix comment typo --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index b3c15fe87f8..350760a1ef5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -2293,7 +2293,7 @@ static void emit_wpos_xy(struct brw_wm_compile *c, } /* TODO - BIAS on SIMD8 not workind yet... + BIAS on SIMD8 not working yet... */ static void emit_txb(struct brw_wm_compile *c, struct prog_instruction *inst) -- cgit v1.2.3 From 966cd4f1af54e560672e7d7614251271fbbb379b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 16:33:48 -0600 Subject: i965: remove 'nr' param from get_src/dst_reg() functions The value was always 1. --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 226 ++++++++++++++++---------------- 1 file changed, 114 insertions(+), 112 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 350760a1ef5..ffde59e1439 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -241,8 +241,9 @@ static void prealloc_reg(struct brw_wm_compile *c) * Convert Mesa dst register to brw register. */ static struct brw_reg get_dst_reg(struct brw_wm_compile *c, - struct prog_instruction *inst, int component, int nr) + struct prog_instruction *inst, int component) { + const int nr = 1; return get_reg(c, inst->DstReg.File, inst->DstReg.Index, component, nr, 0, 0); } @@ -252,8 +253,9 @@ static struct brw_reg get_dst_reg(struct brw_wm_compile *c, * Convert Mesa src register to brw register. */ static struct brw_reg get_src_reg(struct brw_wm_compile *c, - struct prog_src_register *src, int index, int nr) + struct prog_src_register *src, int index) { + const int nr = 1; int component = GET_SWZ(src->Swizzle, index); return get_reg(c, src->File, src->Index, component, nr, src->NegateBase, src->Abs); @@ -332,8 +334,8 @@ static void emit_abs( struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (inst->DstReg.WriteMask & (1<SrcReg[0], i, 1); + dst = get_dst_reg(c, inst, i); + src = get_src_reg(c, &inst->SrcReg[0], i); brw_MOV(p, dst, brw_abs(src)); } } @@ -350,8 +352,8 @@ static void emit_trunc( struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); + dst = get_dst_reg(c, inst, i); + src = get_src_reg(c, &inst->SrcReg[0], i); brw_RNDZ(p, dst, src); } } @@ -368,8 +370,8 @@ static void emit_mov( struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); + dst = get_dst_reg(c, inst, i); + src = get_src_reg(c, &inst->SrcReg[0], i); brw_MOV(p, dst, src); } } @@ -386,8 +388,8 @@ static void emit_pixel_xy(struct brw_wm_compile *c, struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; - dst0 = get_dst_reg(c, inst, 0, 1); - dst1 = get_dst_reg(c, inst, 1, 1); + dst0 = get_dst_reg(c, inst, 0); + dst1 = get_dst_reg(c, inst, 1); /* Calculate pixel centers by adding 1 or 0 to each of the * micro-tile coordinates passed in r1. */ @@ -414,10 +416,10 @@ static void emit_delta_xy(struct brw_wm_compile *c, struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; - dst0 = get_dst_reg(c, inst, 0, 1); - dst1 = get_dst_reg(c, inst, 1, 1); - src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); - src1 = get_src_reg(c, &inst->SrcReg[0], 1, 1); + dst0 = get_dst_reg(c, inst, 0); + dst1 = get_dst_reg(c, inst, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); + src1 = get_src_reg(c, &inst->SrcReg[0], 1); /* Calc delta X,Y by subtracting origin in r1 from the pixel * centers. */ @@ -482,7 +484,7 @@ static void emit_fb_write(struct brw_wm_compile *c, brw_push_insn_state(p); for (channel = 0; channel < 4; channel++) { - src0 = get_src_reg(c, &inst->SrcReg[0], channel, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], channel); /* mov (8) m2.0<1>:ud r28.0<8;8,1>:ud { Align1 } */ /* mov (8) m6.0<1>:ud r29.0<8;8,1>:ud { Align1 SecHalf } */ brw_MOV(p, brw_message_reg(nr + channel), src0); @@ -493,11 +495,11 @@ static void emit_fb_write(struct brw_wm_compile *c, if (c->key.source_depth_to_render_target) { if (c->key.computes_depth) { - src0 = get_src_reg(c, &inst->SrcReg[2], 2, 1); + src0 = get_src_reg(c, &inst->SrcReg[2], 2); brw_MOV(p, brw_message_reg(nr), src0); } else { - src0 = get_src_reg(c, &inst->SrcReg[1], 1, 1); + src0 = get_src_reg(c, &inst->SrcReg[1], 1); brw_MOV(p, brw_message_reg(nr), src0); } @@ -524,7 +526,7 @@ static void emit_fb_write(struct brw_wm_compile *c, else #endif { - struct brw_reg src = get_src_reg(c, &inst->SrcReg[1], 1, 1); + struct brw_reg src = get_src_reg(c, &inst->SrcReg[1], 1); brw_MOV(p, brw_message_reg(nr), src); } nr += 2; @@ -544,10 +546,10 @@ static void emit_pixel_w( struct brw_wm_compile *c, struct brw_reg dst, src0, delta0, delta1; struct brw_reg interp3; - dst = get_dst_reg(c, inst, 3, 1); - src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); - delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1); - delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1); + dst = get_dst_reg(c, inst, 3); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); + delta0 = get_src_reg(c, &inst->SrcReg[1], 0); + delta1 = get_src_reg(c, &inst->SrcReg[1], 1); interp3 = brw_vec1_grf(src0.nr+1, 4); /* Calc 1/w - just linterp wpos[3] optimized by putting the @@ -575,9 +577,9 @@ static void emit_linterp(struct brw_wm_compile *c, struct brw_reg src0; GLuint nr, i; - src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); - delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1); - delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); + delta0 = get_src_reg(c, &inst->SrcReg[1], 0); + delta1 = get_src_reg(c, &inst->SrcReg[1], 1); nr = src0.nr; interp[0] = brw_vec1_grf(nr, 0); @@ -587,7 +589,7 @@ static void emit_linterp(struct brw_wm_compile *c, for(i = 0; i < 4; i++ ) { if (mask & (1<SrcReg[0], 0, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); nr = src0.nr; interp[0] = brw_vec1_grf(nr, 0); @@ -614,7 +616,7 @@ static void emit_cinterp(struct brw_wm_compile *c, for(i = 0; i < 4; i++ ) { if (mask & (1<SrcReg[0], 0, 1); - delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1); - delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1); - w = get_src_reg(c, &inst->SrcReg[2], 3, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); + delta0 = get_src_reg(c, &inst->SrcReg[1], 0); + delta1 = get_src_reg(c, &inst->SrcReg[1], 1); + w = get_src_reg(c, &inst->SrcReg[2], 3); nr = src0.nr; interp[0] = brw_vec1_grf(nr, 0); @@ -644,7 +646,7 @@ static void emit_pinterp(struct brw_wm_compile *c, for(i = 0; i < 4; i++ ) { if (mask & (1<SrcReg[0], i2, 1)); - src1 = get_src_reg(c, &inst->SrcReg[1], i1, 1); + dst = get_dst_reg(c, inst, i); + src0 = negate(get_src_reg(c, &inst->SrcReg[0], i2)); + src1 = get_src_reg(c, &inst->SrcReg[1], i1); brw_MUL(p, brw_null_reg(), src0, src1); - src0 = get_src_reg(c, &inst->SrcReg[0], i1, 1); - src1 = get_src_reg(c, &inst->SrcReg[1], i2, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], i1); + src1 = get_src_reg(c, &inst->SrcReg[1], i2); brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); brw_MAC(p, dst, src0, src1); brw_set_saturate(p, 0); @@ -715,11 +717,11 @@ static void emit_dp3(struct brw_wm_compile *c, int i; struct brw_compile *p = &c->func; for (i = 0; i < 3; i++) { - src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); - src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1); + src0[i] = get_src_reg(c, &inst->SrcReg[0], i); + src1[i] = get_src_reg(c, &inst->SrcReg[1], i); } - dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1); + dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); brw_MUL(p, brw_null_reg(), src0[0], src1[0]); brw_MAC(p, brw_null_reg(), src0[1], src1[1]); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); @@ -734,10 +736,10 @@ static void emit_dp4(struct brw_wm_compile *c, int i; struct brw_compile *p = &c->func; for (i = 0; i < 4; i++) { - src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); - src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1); + src0[i] = get_src_reg(c, &inst->SrcReg[0], i); + src1[i] = get_src_reg(c, &inst->SrcReg[1], i); } - dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1); + dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); brw_MUL(p, brw_null_reg(), src0[0], src1[0]); brw_MAC(p, brw_null_reg(), src0[1], src1[1]); brw_MAC(p, brw_null_reg(), src0[2], src1[2]); @@ -753,10 +755,10 @@ static void emit_dph(struct brw_wm_compile *c, int i; struct brw_compile *p = &c->func; for (i = 0; i < 4; i++) { - src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); - src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1); + src0[i] = get_src_reg(c, &inst->SrcReg[0], i); + src1[i] = get_src_reg(c, &inst->SrcReg[1], i); } - dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1); + dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); brw_MUL(p, brw_null_reg(), src0[0], src1[0]); brw_MAC(p, brw_null_reg(), src0[1], src1[1]); brw_MAC(p, dst, src0[2], src1[2]); @@ -781,7 +783,7 @@ static void emit_math1(struct brw_wm_compile *c, tmp = alloc_tmp(c); /* Get first component of source register */ - src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); /* tmp = func(src0) */ brw_MOV(p, brw_message_reg(2), src0); @@ -799,7 +801,7 @@ static void emit_math1(struct brw_wm_compile *c, /* replicate tmp value across enabled dest channels */ for (i = 0; i < 4; i++) { if (inst->DstReg.WriteMask & (1 << i)) { - dst = get_dst_reg(c, inst, i, 1); + dst = get_dst_reg(c, inst, i); brw_MOV(p, dst, tmp); } } @@ -853,9 +855,9 @@ static void emit_add(struct brw_wm_compile *c, brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); - src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); + src1 = get_src_reg(c, &inst->SrcReg[1], i); brw_ADD(p, dst, src0, src1); } } @@ -872,9 +874,9 @@ static void emit_sub(struct brw_wm_compile *c, brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); - src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); + src1 = get_src_reg(c, &inst->SrcReg[1], i); brw_ADD(p, dst, src0, negate(src1)); } } @@ -891,9 +893,9 @@ static void emit_mul(struct brw_wm_compile *c, brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); - src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); + src1 = get_src_reg(c, &inst->SrcReg[1], i); brw_MUL(p, dst, src0, src1); } } @@ -910,8 +912,8 @@ static void emit_frc(struct brw_wm_compile *c, brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); brw_FRC(p, dst, src0); } } @@ -929,8 +931,8 @@ static void emit_flr(struct brw_wm_compile *c, brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); brw_RNDD(p, dst, src0); } } @@ -947,9 +949,9 @@ static void emit_max(struct brw_wm_compile *c, brw_push_insn_state(p); for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); - src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); + src1 = get_src_reg(c, &inst->SrcReg[1], i); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); brw_MOV(p, dst, src0); brw_set_saturate(p, 0); @@ -975,9 +977,9 @@ static void emit_min(struct brw_wm_compile *c, brw_push_insn_state(p); for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); - src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); + src1 = get_src_reg(c, &inst->SrcReg[1], i); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); brw_MOV(p, dst, src0); brw_set_saturate(p, 0); @@ -998,9 +1000,9 @@ static void emit_pow(struct brw_wm_compile *c, { struct brw_compile *p = &c->func; struct brw_reg dst, src0, src1; - dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1); - src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); - src1 = get_src_reg(c, &inst->SrcReg[1], 0, 1); + dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); + src1 = get_src_reg(c, &inst->SrcReg[1], 0); brw_MOV(p, brw_message_reg(2), src0); brw_MOV(p, brw_message_reg(3), src1); @@ -1025,10 +1027,10 @@ static void emit_lrp(struct brw_wm_compile *c, int mark = mark_tmps(c); for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); - src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], i); if (src1.nr == dst.nr) { tmp1 = alloc_tmp(c); @@ -1036,7 +1038,7 @@ static void emit_lrp(struct brw_wm_compile *c, } else tmp1 = src1; - src2 = get_src_reg(c, &inst->SrcReg[2], i, 1); + src2 = get_src_reg(c, &inst->SrcReg[2], i); if (src2.nr == dst.nr) { tmp2 = alloc_tmp(c); brw_MOV(p, tmp2, src2); @@ -1078,10 +1080,10 @@ static void emit_mad(struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); - src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); - src2 = get_src_reg(c, &inst->SrcReg[2], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); + src1 = get_src_reg(c, &inst->SrcReg[1], i); + src2 = get_src_reg(c, &inst->SrcReg[2], i); brw_MUL(p, dst, src0, src1); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); @@ -1101,9 +1103,9 @@ static void emit_sop(struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); - src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + dst = get_dst_reg(c, inst, i); + src0 = get_src_reg(c, &inst->SrcReg[0], i); + src1 = get_src_reg(c, &inst->SrcReg[1], i); brw_push_insn_state(p); brw_CMP(p, brw_null_reg(), cond, src0, src1); brw_set_predicate_control(p, BRW_PREDICATE_NONE); @@ -1160,8 +1162,8 @@ static void emit_ddx(struct brw_wm_compile *c, struct brw_reg dst; struct brw_reg src0, w; GLuint nr, i; - src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); - w = get_src_reg(c, &inst->SrcReg[1], 3, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); + w = get_src_reg(c, &inst->SrcReg[1], 3); nr = src0.nr; interp[0] = brw_vec1_grf(nr, 0); interp[1] = brw_vec1_grf(nr, 4); @@ -1170,7 +1172,7 @@ static void emit_ddx(struct brw_wm_compile *c, brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); for(i = 0; i < 4; i++ ) { if (mask & (1<SrcReg[0], 0, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); nr = src0.nr; - w = get_src_reg(c, &inst->SrcReg[1], 3, 1); + w = get_src_reg(c, &inst->SrcReg[1], 3); interp[0] = brw_vec1_grf(nr, 0); interp[1] = brw_vec1_grf(nr, 4); interp[2] = brw_vec1_grf(nr+1, 0); @@ -1198,7 +1200,7 @@ static void emit_ddy(struct brw_wm_compile *c, brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); for(i = 0; i < 4; i++ ) { if (mask & (1<SrcReg, 0, 1 ); + src = get_src_reg( c, inst->SrcReg, 0 ); param = alloc_tmp( c ); @@ -1344,7 +1346,7 @@ static void emit_noise1( struct brw_wm_compile *c, brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE ); for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg, 0, 1 ); - src1 = get_src_reg( c, inst->SrcReg, 1, 1 ); + src0 = get_src_reg( c, inst->SrcReg, 0 ); + src1 = get_src_reg( c, inst->SrcReg, 1 ); param0 = alloc_tmp( c ); param1 = alloc_tmp( c ); @@ -1517,7 +1519,7 @@ static void emit_noise2( struct brw_wm_compile *c, brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE ); for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg, 0, 1 ); - src1 = get_src_reg( c, inst->SrcReg, 1, 1 ); - src2 = get_src_reg( c, inst->SrcReg, 2, 1 ); + src0 = get_src_reg( c, inst->SrcReg, 0 ); + src1 = get_src_reg( c, inst->SrcReg, 1 ); + src2 = get_src_reg( c, inst->SrcReg, 2 ); param0 = alloc_tmp( c ); param1 = alloc_tmp( c ); @@ -1823,7 +1825,7 @@ static void emit_noise3( struct brw_wm_compile *c, brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE ); for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg, 0, 1 ); - src1 = get_src_reg( c, inst->SrcReg, 1, 1 ); - src2 = get_src_reg( c, inst->SrcReg, 2, 1 ); - src3 = get_src_reg( c, inst->SrcReg, 3, 1 ); + src0 = get_src_reg( c, inst->SrcReg, 0 ); + src1 = get_src_reg( c, inst->SrcReg, 1 ); + src2 = get_src_reg( c, inst->SrcReg, 2 ); + src3 = get_src_reg( c, inst->SrcReg, 3 ); param0 = alloc_tmp( c ); param1 = alloc_tmp( c ); @@ -2249,7 +2251,7 @@ static void emit_noise4( struct brw_wm_compile *c, brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE ); for (i = 0 ; i < 4; i++) { if (mask & (1<DstReg.WriteMask; struct brw_reg src0[2], dst[2]; - dst[0] = get_dst_reg(c, inst, 0, 1); - dst[1] = get_dst_reg(c, inst, 1, 1); + dst[0] = get_dst_reg(c, inst, 0); + dst[1] = get_dst_reg(c, inst, 1); - src0[0] = get_src_reg(c, &inst->SrcReg[0], 0, 1); - src0[1] = get_src_reg(c, &inst->SrcReg[0], 1, 1); + src0[0] = get_src_reg(c, &inst->SrcReg[0], 0); + src0[1] = get_src_reg(c, &inst->SrcReg[0], 1); /* Calculate the pixel offset from window bottom left into destination * X and Y channels. @@ -2305,9 +2307,9 @@ static void emit_txb(struct brw_wm_compile *c, GLuint i; payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); for (i = 0; i < 4; i++) - dst[i] = get_dst_reg(c, inst, i, 1); + dst[i] = get_dst_reg(c, inst, i); for (i = 0; i < 4; i++) - src[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); + src[i] = get_src_reg(c, &inst->SrcReg[0], i); switch (inst->TexSrcTarget) { case TEXTURE_1D_INDEX: @@ -2357,9 +2359,9 @@ static void emit_tex(struct brw_wm_compile *c, payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); for (i = 0; i < 4; i++) - dst[i] = get_dst_reg(c, inst, i, 1); + dst[i] = get_dst_reg(c, inst, i); for (i = 0; i < 4; i++) - src[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); + src[i] = get_src_reg(c, &inst->SrcReg[0], i); switch (inst->TexSrcTarget) { -- cgit v1.2.3 From 154cd7a72363513f2d3d8d83fe19d69518df7d2e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 17:29:40 -0600 Subject: i965: add support for float literal instruction operands Call the get_src_reg_imm() function when it's permissible to generate a literal value src register. --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 63 ++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index ffde59e1439..00f2d3af855 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -258,9 +258,32 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c, const int nr = 1; int component = GET_SWZ(src->Swizzle, index); return get_reg(c, src->File, src->Index, component, nr, - src->NegateBase, src->Abs); + src->NegateBase, src->Abs); } + +/** + * Same as \sa get_src_reg() but if the register is a literal, emit + * a brw_reg encoding the literal. + * Note that a brw instruction only allows one src operand to be a literal. + * For instructions with more than one operand, only the second can be a literal. + */ +static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, + struct prog_src_register *src, int index) +{ + if (src->File == PROGRAM_CONSTANT) { + /* a literal */ + const int component = GET_SWZ(src->Swizzle, index); + const GLfloat *param = + c->fp->program.Base.Parameters->ParameterValues[src->Index]; + return brw_imm_f(param[component]); + } + else { + return get_src_reg(c, src, index); + } +} + + /** * Subroutines are minimal support for resusable instruction sequences. * They are implemented as simply as possible to minimise overhead: there @@ -371,7 +394,7 @@ static void emit_mov( struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i); + src = get_src_reg_imm(c, &inst->SrcReg[0], i); brw_MOV(p, dst, src); } } @@ -698,10 +721,10 @@ static void emit_xpd(struct brw_wm_compile *c, struct brw_reg src0, src1, dst; dst = get_dst_reg(c, inst, i); src0 = negate(get_src_reg(c, &inst->SrcReg[0], i2)); - src1 = get_src_reg(c, &inst->SrcReg[1], i1); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], i1); brw_MUL(p, brw_null_reg(), src0, src1); src0 = get_src_reg(c, &inst->SrcReg[0], i1); - src1 = get_src_reg(c, &inst->SrcReg[1], i2); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], i2); brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); brw_MAC(p, dst, src0, src1); brw_set_saturate(p, 0); @@ -718,7 +741,7 @@ static void emit_dp3(struct brw_wm_compile *c, struct brw_compile *p = &c->func; for (i = 0; i < 3; i++) { src0[i] = get_src_reg(c, &inst->SrcReg[0], i); - src1[i] = get_src_reg(c, &inst->SrcReg[1], i); + src1[i] = get_src_reg_imm(c, &inst->SrcReg[1], i); } dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); @@ -737,7 +760,7 @@ static void emit_dp4(struct brw_wm_compile *c, struct brw_compile *p = &c->func; for (i = 0; i < 4; i++) { src0[i] = get_src_reg(c, &inst->SrcReg[0], i); - src1[i] = get_src_reg(c, &inst->SrcReg[1], i); + src1[i] = get_src_reg_imm(c, &inst->SrcReg[1], i); } dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); brw_MUL(p, brw_null_reg(), src0[0], src1[0]); @@ -756,7 +779,7 @@ static void emit_dph(struct brw_wm_compile *c, struct brw_compile *p = &c->func; for (i = 0; i < 4; i++) { src0[i] = get_src_reg(c, &inst->SrcReg[0], i); - src1[i] = get_src_reg(c, &inst->SrcReg[1], i); + src1[i] = get_src_reg_imm(c, &inst->SrcReg[1], i); } dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); brw_MUL(p, brw_null_reg(), src0[0], src1[0]); @@ -857,7 +880,7 @@ static void emit_add(struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i); - src1 = get_src_reg(c, &inst->SrcReg[1], i); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); brw_ADD(p, dst, src0, src1); } } @@ -876,7 +899,7 @@ static void emit_sub(struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i); - src1 = get_src_reg(c, &inst->SrcReg[1], i); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); brw_ADD(p, dst, src0, negate(src1)); } } @@ -895,7 +918,7 @@ static void emit_mul(struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i); - src1 = get_src_reg(c, &inst->SrcReg[1], i); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); brw_MUL(p, dst, src0, src1); } } @@ -913,7 +936,7 @@ static void emit_frc(struct brw_wm_compile *c, for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i); + src0 = get_src_reg_imm(c, &inst->SrcReg[0], i); brw_FRC(p, dst, src0); } } @@ -932,7 +955,7 @@ static void emit_flr(struct brw_wm_compile *c, for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i); + src0 = get_src_reg_imm(c, &inst->SrcReg[0], i); brw_RNDD(p, dst, src0); } } @@ -951,7 +974,7 @@ static void emit_max(struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i); - src1 = get_src_reg(c, &inst->SrcReg[1], i); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); brw_MOV(p, dst, src0); brw_set_saturate(p, 0); @@ -978,7 +1001,7 @@ static void emit_min(struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i); + src0 = get_src_reg_imm(c, &inst->SrcReg[0], i); src1 = get_src_reg(c, &inst->SrcReg[1], i); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); brw_MOV(p, dst, src0); @@ -1001,8 +1024,8 @@ static void emit_pow(struct brw_wm_compile *c, struct brw_compile *p = &c->func; struct brw_reg dst, src0, src1; dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); - src0 = get_src_reg(c, &inst->SrcReg[0], 0); - src1 = get_src_reg(c, &inst->SrcReg[1], 0); + src0 = get_src_reg_imm(c, &inst->SrcReg[0], 0); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], 0); brw_MOV(p, brw_message_reg(2), src0); brw_MOV(p, brw_message_reg(3), src1); @@ -1030,7 +1053,7 @@ static void emit_lrp(struct brw_wm_compile *c, dst = get_dst_reg(c, inst, i); src0 = get_src_reg(c, &inst->SrcReg[0], i); - src1 = get_src_reg(c, &inst->SrcReg[1], i); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); if (src1.nr == dst.nr) { tmp1 = alloc_tmp(c); @@ -1082,8 +1105,8 @@ static void emit_mad(struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i); - src1 = get_src_reg(c, &inst->SrcReg[1], i); - src2 = get_src_reg(c, &inst->SrcReg[2], i); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); + src2 = get_src_reg_imm(c, &inst->SrcReg[2], i); brw_MUL(p, dst, src0, src1); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); @@ -1105,7 +1128,7 @@ static void emit_sop(struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i); - src1 = get_src_reg(c, &inst->SrcReg[1], i); + src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); brw_push_insn_state(p); brw_CMP(p, brw_null_reg(), cond, src0, src1); brw_set_predicate_control(p, BRW_PREDICATE_NONE); -- cgit v1.2.3 From e1a1a5a6385e0bc6f2f20ec0a2e23f81726e232e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 18:05:29 -0600 Subject: i965: comments for sampling code --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 00f2d3af855..4e99611be81 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -2336,9 +2336,9 @@ static void emit_txb(struct brw_wm_compile *c, switch (inst->TexSrcTarget) { case TEXTURE_1D_INDEX: - brw_MOV(p, brw_message_reg(2), src[0]); - brw_MOV(p, brw_message_reg(3), brw_imm_f(0)); - brw_MOV(p, brw_message_reg(4), brw_imm_f(0)); + brw_MOV(p, brw_message_reg(2), src[0]); /* s coord */ + brw_MOV(p, brw_message_reg(3), brw_imm_f(0)); /* t coord */ + brw_MOV(p, brw_message_reg(4), brw_imm_f(0)); /* r coord */ break; case TEXTURE_2D_INDEX: case TEXTURE_RECT_INDEX: @@ -2352,19 +2352,19 @@ static void emit_txb(struct brw_wm_compile *c, brw_MOV(p, brw_message_reg(4), src[2]); break; } - brw_MOV(p, brw_message_reg(5), src[3]); - brw_MOV(p, brw_message_reg(6), brw_imm_f(0)); + brw_MOV(p, brw_message_reg(5), src[3]); /* bias */ + brw_MOV(p, brw_message_reg(6), brw_imm_f(0)); /* ref (unused?) */ brw_SAMPLE(p, - retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), - 1, - retype(payload_reg, BRW_REGISTER_TYPE_UW), - unit + MAX_DRAW_BUFFERS, /* surface */ - unit, /* sampler */ - inst->DstReg.WriteMask, - BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS, - 4, - 4, - 0); + retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), /* dest */ + 1, /* msg_reg_nr */ + retype(payload_reg, BRW_REGISTER_TYPE_UW), /* src0 */ + unit + MAX_DRAW_BUFFERS, /* surface */ + unit, /* sampler */ + inst->DstReg.WriteMask, /* writemask */ + BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS, /* msg_type */ + 4, /* response_length */ + 4, /* msg_length */ + 0); /* eot */ } static void emit_tex(struct brw_wm_compile *c, @@ -2386,7 +2386,6 @@ static void emit_tex(struct brw_wm_compile *c, for (i = 0; i < 4; i++) src[i] = get_src_reg(c, &inst->SrcReg[0], i); - switch (inst->TexSrcTarget) { case TEXTURE_1D_INDEX: emit = WRITEMASK_X; @@ -2404,6 +2403,7 @@ static void emit_tex(struct brw_wm_compile *c, } msg_len = 1; + /* move/load S, T, R coords */ for (i = 0; i < nr; i++) { static const GLuint swz[4] = {0,1,2,2}; if (emit & (1<DstReg.WriteMask, - BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE, - 4, - shadow ? 6 : 4, - 0); + retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), /* dest */ + 1, /* msg_reg_nr */ + retype(payload_reg, BRW_REGISTER_TYPE_UW), /* src0 */ + unit + MAX_DRAW_BUFFERS, /* surface */ + unit, /* sampler */ + inst->DstReg.WriteMask, /* writemask */ + BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE, /* msg_type */ + 4, /* response_length */ + shadow ? 6 : 4, /* msg_length */ + 0); /* eot */ if (shadow) brw_MOV(p, dst[3], brw_imm_f(1.0)); -- cgit v1.2.3 From 1146d40b9c35d80c0860c773de1eef27c76e8c01 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Mar 2009 18:05:53 -0600 Subject: i965: comments for brw_SAMPLE() --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 6dce1ca48e8..4becdf069fa 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -966,7 +966,11 @@ void brw_fb_WRITE(struct brw_compile *p, } - +/** + * Texture sample instruction. + * Note: the msg_type plus msg_length values determine exactly what kind + * of sampling operation is performed. See volume 4, page 161 of docs. + */ void brw_SAMPLE(struct brw_compile *p, struct brw_reg dest, GLuint msg_reg_nr, -- cgit v1.2.3 From f5a4d20e4aafce04773729dc2dd6175e9538d887 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 Mar 2009 18:16:35 -0600 Subject: mesa: clean up formatting and use 'return' instead of 'break' consistantly --- src/mesa/shader/prog_statevars.c | 118 ++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 51 deletions(-) diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 9c155fbe07a..b93e987f043 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -359,10 +359,10 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], switch (state[1]) { case STATE_ENV: COPY_4V(value, ctx->FragmentProgram.Parameters[idx]); - break; + return; case STATE_LOCAL: COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]); - break; + return; default: _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); return; @@ -378,10 +378,10 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], switch (state[1]) { case STATE_ENV: COPY_4V(value, ctx->VertexProgram.Parameters[idx]); - break; + return; case STATE_LOCAL: COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]); - break; + return; default: _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); return; @@ -395,11 +395,12 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], case STATE_INTERNAL: switch (state[1]) { - case STATE_CURRENT_ATTRIB: { - const GLuint idx = (GLuint) state[2]; - COPY_4V(value, ctx->Current.Attrib[idx]); + case STATE_CURRENT_ATTRIB: + { + const GLuint idx = (GLuint) state[2]; + COPY_4V(value, ctx->Current.Attrib[idx]); + } return; - } case STATE_NORMAL_SCALE: ASSIGN_4V(value, @@ -408,19 +409,25 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], ctx->_ModelViewInvScale, 1); return; + case STATE_TEXRECT_SCALE: + /* Value = { 1/texWidth, 1/texHeight, 0, 1 }. + * Used to convert unnormalized texcoords to normalized texcoords. + */ { const int unit = (int) state[2]; const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; if (texObj) { struct gl_texture_image *texImage = texObj->Image[0][0]; - ASSIGN_4V(value, (GLfloat) (1.0 / texImage->Width), - (GLfloat)(1.0 / texImage->Height), + ASSIGN_4V(value, + (GLfloat) (1.0 / texImage->Width), + (GLfloat) (1.0 / texImage->Height), 0.0f, 1.0f); } } return; + case STATE_FOG_PARAMS_OPTIMIZED: /* for simpler per-vertex/pixel fog calcs. POW (for EXP/EXP2 fog) * might be more expensive than EX2 on some hw, plus it needs @@ -437,62 +444,69 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[3] = (GLfloat)(ctx->Fog.Density * ONE_DIV_SQRT_LN2); return; - case STATE_LIGHT_SPOT_DIR_NORMALIZED: { - /* here, state[2] is the light number */ - /* pre-normalize spot dir */ - const GLuint ln = (GLuint) state[2]; - COPY_3V(value, ctx->Light.Light[ln]._NormDirection); - value[3] = ctx->Light.Light[ln]._CosCutoff; + case STATE_LIGHT_SPOT_DIR_NORMALIZED: + { + /* here, state[2] is the light number */ + /* pre-normalize spot dir */ + const GLuint ln = (GLuint) state[2]; + COPY_3V(value, ctx->Light.Light[ln]._NormDirection); + value[3] = ctx->Light.Light[ln]._CosCutoff; + } return; - } - case STATE_LIGHT_POSITION: { - const GLuint ln = (GLuint) state[2]; - COPY_4V(value, ctx->Light.Light[ln]._Position); + case STATE_LIGHT_POSITION: + { + const GLuint ln = (GLuint) state[2]; + COPY_4V(value, ctx->Light.Light[ln]._Position); + } return; - } - case STATE_LIGHT_POSITION_NORMALIZED: { - const GLuint ln = (GLuint) state[2]; - COPY_4V(value, ctx->Light.Light[ln]._Position); - NORMALIZE_3FV( value ); + case STATE_LIGHT_POSITION_NORMALIZED: + { + const GLuint ln = (GLuint) state[2]; + COPY_4V(value, ctx->Light.Light[ln]._Position); + NORMALIZE_3FV( value ); + } return; - } - case STATE_LIGHT_HALF_VECTOR: { - const GLuint ln = (GLuint) state[2]; - GLfloat p[3]; - /* Compute infinite half angle vector: - * halfVector = normalize(normalize(lightPos) + (0, 0, 1)) - * light.EyePosition.w should be 0 for infinite lights. - */ - COPY_3V(p, ctx->Light.Light[ln]._Position); - NORMALIZE_3FV(p); - ADD_3V(value, p, ctx->_EyeZDir); - NORMALIZE_3FV(value); - value[3] = 1.0; + case STATE_LIGHT_HALF_VECTOR: + { + const GLuint ln = (GLuint) state[2]; + GLfloat p[3]; + /* Compute infinite half angle vector: + * halfVector = normalize(normalize(lightPos) + (0, 0, 1)) + * light.EyePosition.w should be 0 for infinite lights. + */ + COPY_3V(p, ctx->Light.Light[ln]._Position); + NORMALIZE_3FV(p); + ADD_3V(value, p, ctx->_EyeZDir); + NORMALIZE_3FV(value); + value[3] = 1.0; + } return; - } - case STATE_PT_SCALE: value[0] = ctx->Pixel.RedScale; value[1] = ctx->Pixel.GreenScale; value[2] = ctx->Pixel.BlueScale; value[3] = ctx->Pixel.AlphaScale; - break; + return; + case STATE_PT_BIAS: value[0] = ctx->Pixel.RedBias; value[1] = ctx->Pixel.GreenBias; value[2] = ctx->Pixel.BlueBias; value[3] = ctx->Pixel.AlphaBias; - break; + return; + case STATE_PCM_SCALE: COPY_4V(value, ctx->Pixel.PostColorMatrixScale); - break; + return; + case STATE_PCM_BIAS: COPY_4V(value, ctx->Pixel.PostColorMatrixBias); - break; + return; + case STATE_SHADOW_AMBIENT: { const int unit = (int) state[2]; @@ -506,6 +520,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], } } return; + case STATE_FB_SIZE: value[0] = (GLfloat) (ctx->DrawBuffer->Width - 1); value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1); @@ -522,7 +537,8 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[2] = 0.0; value[3] = 0.0; } - break; + return; + case STATE_ROT_MATRIX_1: { const int unit = (int) state[2]; @@ -532,14 +548,14 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[2] = 0.0; value[3] = 0.0; } - break; + return; - /* XXX: make sure new tokens added here are also handled in the - * _mesa_program_state_flags() switch, below. - */ + /* XXX: make sure new tokens added here are also handled in the + * _mesa_program_state_flags() switch, below. + */ default: - /* unknown state indexes are silently ignored - * should be handled by the driver. + /* Unknown state indexes are silently ignored here. + * Drivers may do something special. */ return; } -- cgit v1.2.3 From 264058f38af00519e9f180f237a771566117cd8b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Mar 2009 14:49:01 -0600 Subject: mesa: more error message info --- src/mesa/main/matrix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index aebf48134fd..7388276c458 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -161,7 +161,8 @@ _mesa_MatrixMode( GLenum mode ) break; case GL_TEXTURE: if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(texcoord unit)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(invalid unit %d)", + ctx->Texture.CurrentUnit); return; } ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit]; -- cgit v1.2.3 From 6b18a8d3e7114a1af931a2fc20a1e23cb2d7789c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 10:49:41 -0600 Subject: i965: new and updated comments --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 46 +++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 4becdf069fa..03e4cdde33a 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -320,14 +320,15 @@ 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; - insn->bits3.dp_read.msg_control = msg_control; - insn->bits3.dp_read.msg_type = msg_type; - insn->bits3.dp_read.target_cache = target_cache; - insn->bits3.dp_read.response_length = response_length; - insn->bits3.dp_read.msg_length = msg_length; - insn->bits3.dp_read.msg_target = BRW_MESSAGE_TARGET_DATAPORT_READ; - insn->bits3.dp_read.end_of_thread = end_of_thread; + 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, @@ -770,7 +771,7 @@ void brw_CMP(struct brw_compile *p, * Helpers for the various SEND message types: */ -/* Invert 8 values +/** Extended math function, float[8]. */ void brw_math( struct brw_compile *p, struct brw_reg dest, @@ -802,7 +803,9 @@ void brw_math( struct brw_compile *p, data_type); } -/* Use 2 send instructions to invert 16 elements +/** + * Extended math function, float[16]. + * Use 2 send instructions. */ void brw_math_16( struct brw_compile *p, struct brw_reg dest, @@ -855,8 +858,11 @@ void brw_math_16( struct brw_compile *p, } - - +/** + * Write block of 16 dwords/floats to the data port Render Cache scratch buffer. + * Scratch offset should be a multiple of 64. + * Used for register spilling. + */ void brw_dp_WRITE_16( struct brw_compile *p, struct brw_reg src, GLuint msg_reg_nr, @@ -867,6 +873,7 @@ void brw_dp_WRITE_16( struct brw_compile *p, brw_set_mask_control(p, BRW_MASK_DISABLE); brw_set_compression_control(p, BRW_COMPRESSION_NONE); + /* set message header global offset field (reg 0, element 2) */ brw_MOV(p, retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D), brw_imm_d(scratch_offset)); @@ -887,7 +894,7 @@ void brw_dp_WRITE_16( struct brw_compile *p, brw_set_src0(insn, src); brw_set_dp_write_message(insn, - 255, /* bti */ + 255, /* binding table index (255=stateless) */ BRW_DATAPORT_OWORD_BLOCK_4_OWORDS, /* msg_control */ BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE, /* msg_type */ msg_length, @@ -895,10 +902,14 @@ void brw_dp_WRITE_16( struct brw_compile *p, 0, /* response_length */ 0); /* eot */ } - } +/** + * Read block of 16 dwords/floats from the data port Render Cache scratch buffer. + * Scratch offset should be a multiple of 64. + * Used for register spilling. + */ void brw_dp_READ_16( struct brw_compile *p, struct brw_reg dest, GLuint msg_reg_nr, @@ -909,6 +920,7 @@ void brw_dp_READ_16( struct brw_compile *p, 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) */ brw_MOV(p, retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D), brw_imm_d(scratch_offset)); @@ -927,10 +939,10 @@ void brw_dp_READ_16( struct brw_compile *p, brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW)); brw_set_dp_read_message(insn, - 255, /* bti */ - 3, /* msg_control */ + 255, /* binding table index (255=stateless) */ + 3, /* msg_control (3 means 4 Owords) */ BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ - 1, /* target cache */ + 1, /* target cache (render/scratch) */ 1, /* msg_length */ 2, /* response_length */ 0); /* eot */ -- cgit v1.2.3 From 8127e49b93820d1768e2d298bbe238dd55c20732 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 10:50:55 -0600 Subject: i965: added new brw_dp_READ_4() function Used to read float[4] vectors from the constant buffer/surface. --- src/mesa/drivers/dri/i965/brw_eu.h | 7 +++++ src/mesa/drivers/dri/i965/brw_eu_emit.c | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index eb99c21711e..c94889ab1c5 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -851,6 +851,13 @@ void brw_dp_READ_16( struct brw_compile *p, 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 scratch_offset, + GLuint bind_table_index ); + void brw_dp_WRITE_16( struct brw_compile *p, struct brw_reg src, GLuint msg_reg_nr, diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 03e4cdde33a..b149f0f21f7 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -950,6 +950,56 @@ void brw_dp_READ_16( struct brw_compile *p, } +/** + * Read a float[4] vector from the data port Data Cache (const buffer). + * Scratch offset should be a multiple of 16. + * Used for fetching shader constants. + * If relAddr is true, we'll do an indirect fetch using the address register. + */ +void brw_dp_READ_4( struct brw_compile *p, + struct brw_reg dest, + GLuint msg_reg_nr, + GLboolean relAddr, + GLuint scratch_offset, + GLuint bind_table_index ) +{ + { + brw_push_insn_state(p); + 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) */ + brw_MOV(p, + retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_UD), + brw_imm_d(scratch_offset)); + brw_pop_insn_state(p); + } + + { + struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); + + insn->header.predicate_control = 0; /* XXX */ + insn->header.compression_control = BRW_COMPRESSION_NONE; + insn->header.destreg__conditonalmod = msg_reg_nr; + + /* cast dest to a uword[8] vector */ + 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_dp_read_message(insn, + bind_table_index, /* binding table index (255=stateless) */ + 0, /* msg_control (0 means 1 Oword) */ + BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ + 0, /* source cache = data cache */ + 1, /* msg_length */ + 2, /* response_length */ + 0); /* eot */ + } +} + + void brw_fb_WRITE(struct brw_compile *p, struct brw_reg dest, GLuint msg_reg_nr, -- cgit v1.2.3 From 1ee0e226469514335b80ff42e4cbef0f355bd8c4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 10:53:02 -0600 Subject: i965: minor code movement, new comment --- src/mesa/drivers/dri/i965/brw_wm_state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 3ef451405c3..58fa6aaf8f9 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -125,6 +125,9 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) key->offset_factor = ctx->Polygon.OffsetFactor; } +/** + * Setup wm hardware state. See page 225 of Volume 2 + */ static dri_bo * wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key, dri_bo **reloc_bufs) @@ -151,9 +154,9 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key, wm.thread3.dispatch_grf_start_reg = key->dispatch_grf_start_reg; wm.thread3.urb_entry_read_length = key->urb_entry_read_length; + wm.thread3.urb_entry_read_offset = 0; wm.thread3.const_urb_entry_read_length = key->curb_entry_read_length; wm.thread3.const_urb_entry_read_offset = key->curbe_offset * 2; - wm.thread3.urb_entry_read_offset = 0; wm.wm4.sampler_count = (key->sampler_count + 1) / 4; if (brw->wm.sampler_bo != NULL) { -- cgit v1.2.3 From ed8f54aa65eed2cdef79ddc110dad217d3955ec7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 10:53:37 -0600 Subject: i965: code to debug/dump instruction immediates --- src/mesa/drivers/dri/i965/brw_eu_debug.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_eu_debug.c b/src/mesa/drivers/dri/i965/brw_eu_debug.c index 91dbbd5af62..29f3f6d02fa 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_debug.c +++ b/src/mesa/drivers/dri/i965/brw_eu_debug.c @@ -65,6 +65,7 @@ void brw_print_reg( struct brw_reg hwreg ) hwreg.width == BRW_WIDTH_8 && hwreg.hstride == BRW_HORIZONTAL_STRIDE_1 && hwreg.type == BRW_REGISTER_TYPE_F) { + /* vector register */ _mesa_printf("vec%d", hwreg.nr); } else if (hwreg.file == BRW_GENERAL_REGISTER_FILE && @@ -72,8 +73,12 @@ void brw_print_reg( struct brw_reg hwreg ) hwreg.width == BRW_WIDTH_1 && hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 && hwreg.type == BRW_REGISTER_TYPE_F) { + /* "scalar" register */ _mesa_printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4); } + else if (hwreg.file == BRW_IMMEDIATE_VALUE) { + _mesa_printf("imm %f", hwreg.dw1.f); + } else { _mesa_printf("%s%d.%d<%d;%d,%d>:%s", file[hwreg.file], -- cgit v1.2.3 From 5f1ce6b87e837b9f6bc2a4f3e81cf8feea4af2df Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 10:53:56 -0600 Subject: i965: comments --- src/mesa/drivers/dri/i965/brw_wm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 7909fd65a93..90d74c2885c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -105,12 +105,17 @@ brw_wm_non_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c) brw_wm_pass1(c); /* Register allocation. + * Divide by two because we operate on 16 pixels at a time and require + * two GRF entries for each logical shader register. */ c->grf_limit = BRW_WM_MAX_GRF / 2; brw_wm_pass2(c); + /* how many general-purpose registers are used */ c->prog_data.total_grf = c->max_wm_grf; + + /* Scratch space is used for register spilling */ if (c->last_scratch) { c->prog_data.total_scratch = c->last_scratch + 0x40; } -- cgit v1.2.3 From a9c62a2340794977a87cba4a352c02fc16f81505 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 14:25:32 -0600 Subject: i965: do negation and Abs in get_src_reg_imm() Fixes regression seen with progs/glsl/bump.c --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 4e99611be81..67ba59c3252 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -276,7 +276,12 @@ static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, const int component = GET_SWZ(src->Swizzle, index); const GLfloat *param = c->fp->program.Base.Parameters->ParameterValues[src->Index]; - return brw_imm_f(param[component]); + GLfloat value = param[component]; + if (src->NegateBase) + value = -value; + if (src->Abs) + value = FABSF(value); + return brw_imm_f(value); } else { return get_src_reg(c, src, index); -- cgit v1.2.3 From 8c093a1fb0843e152d2a515c5127ccd5999b0d94 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 16:56:55 -0600 Subject: i965: code to setup a constant buffer sampler This code won't actually be used and will be removed in a subsequent commit. Just committing for posterity. --- src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index 68a9296a713..e13eb28011b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -217,6 +217,45 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key, sampler->ss2.default_color_pointer = sdc_bo->offset >> 5; /* reloc */ } + +#if 0 +/** + * Setup the sampler state for the "constant buffer texture". + * The constant buffer texture is basically a 1D float[4] texture whose + * width == the number of program parameters/constants. + */ +static void +brwm_wm_setup_constant_sampler(struct brw_context *brw, + struct wm_sampler_key *key) +{ + static const GLfloat black[4] = {0.0F, 0.0F, 0.0F, 0.0F}; + const GLuint unit = BRW_MAX_TEX_UNIT - 1; + struct wm_sampler_entry *entry = &key->sampler[unit]; + + entry->tex_target = GL_TEXTURE_1D; + + entry->wrap_r = GL_CLAMP_TO_EDGE; + entry->wrap_s = GL_CLAMP_TO_EDGE; + entry->wrap_t = GL_CLAMP_TO_EDGE; + + entry->maxlod = 0.0F; + entry->minlod = 0.0F; + entry->lod_bias = 0.0F; + entry->max_aniso = 0.0F; + entry->minfilter = GL_NEAREST; + entry->magfilter = GL_NEAREST; + entry->comparemode = GL_NONE; + entry->comparefunc = GL_ALWAYS; + + dri_bo_unreference(brw->wm.sdc_bo[unit]); + + brw->wm.sdc_bo[unit] = upload_default_color(brw, black); + + key->sampler_count = unit + 1; +} +#endif + + /** Sets up the cache key for sampler state for all texture units */ static void brw_wm_sampler_populate_key(struct brw_context *brw, @@ -271,6 +310,10 @@ brw_wm_sampler_populate_key(struct brw_context *brw, key->sampler_count = unit + 1; } } + +#if 0 + brwm_wm_setup_constant_sampler(brw, key); +#endif } /* All samplers must be uploaded in a single contiguous array, which -- cgit v1.2.3 From ba8b25a46cdd52e7b9116cc7d76dc4db4d667464 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 16:57:39 -0600 Subject: i965: remove unused code for sampling a constant buffer --- src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 42 ------------------------ 1 file changed, 42 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index e13eb28011b..1fc9f013727 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -218,44 +218,6 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key, } -#if 0 -/** - * Setup the sampler state for the "constant buffer texture". - * The constant buffer texture is basically a 1D float[4] texture whose - * width == the number of program parameters/constants. - */ -static void -brwm_wm_setup_constant_sampler(struct brw_context *brw, - struct wm_sampler_key *key) -{ - static const GLfloat black[4] = {0.0F, 0.0F, 0.0F, 0.0F}; - const GLuint unit = BRW_MAX_TEX_UNIT - 1; - struct wm_sampler_entry *entry = &key->sampler[unit]; - - entry->tex_target = GL_TEXTURE_1D; - - entry->wrap_r = GL_CLAMP_TO_EDGE; - entry->wrap_s = GL_CLAMP_TO_EDGE; - entry->wrap_t = GL_CLAMP_TO_EDGE; - - entry->maxlod = 0.0F; - entry->minlod = 0.0F; - entry->lod_bias = 0.0F; - entry->max_aniso = 0.0F; - entry->minfilter = GL_NEAREST; - entry->magfilter = GL_NEAREST; - entry->comparemode = GL_NONE; - entry->comparefunc = GL_ALWAYS; - - dri_bo_unreference(brw->wm.sdc_bo[unit]); - - brw->wm.sdc_bo[unit] = upload_default_color(brw, black); - - key->sampler_count = unit + 1; -} -#endif - - /** Sets up the cache key for sampler state for all texture units */ static void brw_wm_sampler_populate_key(struct brw_context *brw, @@ -310,10 +272,6 @@ brw_wm_sampler_populate_key(struct brw_context *brw, key->sampler_count = unit + 1; } } - -#if 0 - brwm_wm_setup_constant_sampler(brw, key); -#endif } /* All samplers must be uploaded in a single contiguous array, which -- cgit v1.2.3 From 597cd5b94e4818679af1134d053541f3d2cfb80e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 17:06:22 -0600 Subject: i965: check-point commit of new constant buffer support Currently, shader constants are stored in the GRF (loaded from the CURBE prior to shader execution). This severly limits the number of constants and temps that we can support. This new code will support (practically) unlimited size constant buffers and free up registers in the GRF. We allocate a new buffer object for the constants and read them with "Read" messages/instructions. When only a small number of constants are used, we can still use the old method. The code works for fragment shaders only (and is actually disabled) for now. Need to do the same thing for vertex shaders and need to add the necessary code-gen to fetch the constants which are referenced by the shader instructions. --- src/mesa/drivers/dri/i965/brw_context.h | 17 ++- src/mesa/drivers/dri/i965/brw_curbe.c | 31 ++++++ src/mesa/drivers/dri/i965/brw_program.c | 20 ++++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 133 ++++++++++++++++++----- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 122 +++++++++++++++++++-- 5 files changed, 288 insertions(+), 35 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index a020b621d6c..01e07c967fa 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -167,6 +167,9 @@ struct brw_fragment_program { struct gl_fragment_program program; GLuint id; /**< serial no. to identify frag progs, never re-used */ GLboolean isGLSL; /**< really, any IF/LOOP/CONT/BREAK instructions */ + + /** Program constant buffer/surface */ + dri_bo *const_buffer; }; @@ -238,8 +241,16 @@ struct brw_vs_ouput_sizes { }; +/** Number of texture sampler units */ #define BRW_MAX_TEX_UNIT 16 -#define BRW_WM_MAX_SURF BRW_MAX_TEX_UNIT + MAX_DRAW_BUFFERS + +/** + * Size of our surface binding table. + * This contains pointers to the drawing surfaces and current texture + * objects and shader constant buffer (+1). + */ +#define BRW_WM_MAX_SURF (MAX_DRAW_BUFFERS + BRW_MAX_TEX_UNIT + 1) + enum brw_cache_id { BRW_CC_VP, @@ -513,8 +524,8 @@ struct brw_context /* BRW_NEW_CURBE_OFFSETS: */ struct { - GLuint wm_start; - GLuint wm_size; + GLuint wm_start; /**< pos of first wm const in CURBE buffer */ + GLuint wm_size; /**< number of float[4] consts, multiple of 16 */ GLuint clip_start; GLuint clip_size; GLuint vs_start; diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 545dedd34ba..39a8610952c 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -38,6 +38,7 @@ #include "shader/prog_parameter.h" #include "shader/prog_statevars.h" #include "intel_batchbuffer.h" +#include "intel_regions.h" #include "brw_context.h" #include "brw_defines.h" #include "brw_state.h" @@ -251,6 +252,7 @@ static void prepare_constant_buffer(struct brw_context *brw) _mesa_load_state_parameters(ctx, vp->program.Base.Parameters); + /* XXX just use a memcpy here */ for (i = 0; i < nr; i++) { const GLfloat *value = vp->program.Base.Parameters->ParameterValues[i]; buf[offset + i * 4 + 0] = value[0]; @@ -330,11 +332,40 @@ static void prepare_constant_buffer(struct brw_context *brw) } +/** + * Vertex/fragment shader constants are stored in a pseudo 1D texture. + * This function updates the constants in that buffer. + */ +static void +update_texture_constant_buffer(struct brw_context *brw) +{ + struct intel_context *intel = &brw->intel; + struct brw_fragment_program *fp = + (struct brw_fragment_program *) brw->fragment_program; + const struct gl_program_parameter_list *params = fp->program.Base.Parameters; + const int size = params->NumParameters * 4 * sizeof(GLfloat); + + assert(fp->const_buffer); + assert(fp->const_buffer->size >= size); + + /* copy constants into the buffer */ + if (size > 0) { + GLubyte *map; + dri_bo_map(fp->const_buffer, GL_TRUE); + map = fp->const_buffer->virtual; + memcpy(map, params->ParameterValues, size); + dri_bo_unmap(fp->const_buffer); + } +} + + static void emit_constant_buffer(struct brw_context *brw) { struct intel_context *intel = &brw->intel; GLuint sz = brw->curbe.total_size; + update_texture_constant_buffer(brw); + BEGIN_BATCH(2, IGNORE_CLIPRECTS); if (sz == 0) { OUT_BATCH((CMD_CONST_BUFFER << 16) | (2 - 2)); diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index d90bd820386..457bc2fc7f4 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -111,6 +111,8 @@ static void brwProgramStringNotify( GLcontext *ctx, struct gl_program *prog ) { struct brw_context *brw = brw_context(ctx); + struct intel_context *intel = &brw->intel; + if (target == GL_FRAGMENT_PROGRAM_ARB) { struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog; struct brw_fragment_program *newFP = brw_fragment_program(fprog); @@ -126,6 +128,24 @@ static void brwProgramStringNotify( GLcontext *ctx, brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM; newFP->id = brw->program_id++; newFP->isGLSL = brw_wm_is_glsl(fprog); + + /* alloc constant buffer/surface */ + { + const struct gl_program_parameter_list *params = prog->Parameters; + const int size = params->NumParameters * 4 * sizeof(GLfloat); + + /* free old const buffer if too small */ + if (newFP->const_buffer && newFP->const_buffer->size < size) { + dri_bo_unreference(newFP->const_buffer); + newFP->const_buffer = NULL; + } + + if (!newFP->const_buffer) { + newFP->const_buffer = drm_intel_bo_alloc(intel->bufmgr, + "fp_const_buffer", + size, 64); + } + } } else if (target == GL_VERTEX_PROGRAM_ARB) { struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 67ba59c3252..28ef84e4aac 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -192,28 +192,41 @@ static void prealloc_reg(struct brw_wm_compile *c) /* constants */ { const int nr_params = c->fp->program.Base.Parameters->NumParameters; - const struct gl_program_parameter_list *plist = - c->fp->program.Base.Parameters; - int index = 0; - - /* number of float constants */ - c->prog_data.nr_params = 4 * nr_params; - - /* loop over program constants (float[4]) */ - for (i = 0; i < nr_params; i++) { - /* loop over XYZW channels */ - for (j = 0; j < 4; j++, index++) { - reg = brw_vec1_grf(c->reg_index + index / 8, index % 8); - /* Save pointer to parameter/constant value. - * Constants will be copied in prepare_constant_buffer() - */ - c->prog_data.param[index] = &plist->ParameterValues[i][j]; - set_reg(c, PROGRAM_STATE_VAR, i, j, reg); - } - } - /* number of constant regs used (each reg is float[8]) */ - c->nr_creg = 2 * ((4 * nr_params + 15) / 16); - c->reg_index += c->nr_creg; + + if (1 /* XXX threshold: nr_params <= 8 */) { + const struct gl_program_parameter_list *plist = + c->fp->program.Base.Parameters; + int index = 0; + + /* number of float constants in CURBE */ + c->prog_data.nr_params = 4 * nr_params; + + /* loop over program constants (float[4]) */ + for (i = 0; i < nr_params; i++) { + /* loop over XYZW channels */ + for (j = 0; j < 4; j++, index++) { + reg = brw_vec1_grf(c->reg_index + index / 8, index % 8); + /* Save pointer to parameter/constant value. + * Constants will be copied in prepare_constant_buffer() + */ + c->prog_data.param[index] = &plist->ParameterValues[i][j]; + set_reg(c, PROGRAM_STATE_VAR, i, j, reg); + } + } + /* number of constant regs used (each reg is float[8]) */ + c->nr_creg = 2 * ((4 * nr_params + 15) / 16); + c->reg_index += c->nr_creg; + } + else { + /* number of float constants in CURBE */ + c->prog_data.nr_params = 0; + + /* When there's a lot of FP constanst we'll store them in a + * texture-like buffer instead of using the CURBE buffer. + * This means we won't use GRF registers for constants and we'll + * have to fetch constants with a dataport read. + */ + } } /* fragment shader inputs */ @@ -892,6 +905,19 @@ static void emit_add(struct brw_wm_compile *c, brw_set_saturate(p, 0); } +static void emit_arl(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg src0, addr_reg; + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + addr_reg = brw_uw8_reg(BRW_ARCHITECTURE_REGISTER_FILE, + BRW_ARF_ADDRESS, 0); + src0 = get_src_reg(c, &inst->SrcReg[0], 0); /* channel 0 */ + brw_MOV(p, addr_reg, src0); + brw_set_saturate(p, 0); +} + static void emit_sub(struct brw_wm_compile *c, struct prog_instruction *inst) { @@ -2331,9 +2357,10 @@ static void emit_txb(struct brw_wm_compile *c, struct brw_compile *p = &c->func; struct brw_reg dst[4], src[4], payload_reg; GLuint unit = c->fp->program.Base.SamplerUnits[inst->TexSrcUnit]; - GLuint i; + payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); + for (i = 0; i < 4; i++) dst[i] = get_dst_reg(c, inst, i); for (i = 0; i < 4; i++) @@ -2372,13 +2399,13 @@ static void emit_txb(struct brw_wm_compile *c, 0); /* eot */ } + static void emit_tex(struct brw_wm_compile *c, struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg dst[4], src[4], payload_reg; GLuint unit = c->fp->program.Base.SamplerUnits[inst->TexSrcUnit]; - GLuint msg_len; GLuint i, nr; GLuint emit; @@ -2419,7 +2446,7 @@ static void emit_tex(struct brw_wm_compile *c, } if (shadow) { - brw_MOV(p, brw_message_reg(5), brw_imm_f(0)); /* lod / bais */ + brw_MOV(p, brw_message_reg(5), brw_imm_f(0)); /* lod / bias */ brw_MOV(p, brw_message_reg(6), src[2]); /* ref value / R coord */ } @@ -2439,6 +2466,49 @@ static void emit_tex(struct brw_wm_compile *c, brw_MOV(p, dst[3], brw_imm_f(1.0)); } + +static void emit_get_constant(struct brw_context *brw, + struct brw_wm_compile *c, + struct prog_instruction *inst, + GLuint constIndex) +{ + struct brw_compile *p = &c->func; + struct brw_reg dst[4]; + GLuint i; + const int mark = mark_tmps( c ); + struct brw_reg writeback_reg[4]; + + /* XXX only need 1 temp reg??? */ + for (i = 0; i < 4; i++) { + writeback_reg[i] = alloc_tmp(c); + } + + for (i = 0; i < 4; i++) { + dst[i] = get_dst_reg(c, inst, i); + } + + /* Get float[4] vector from constant buffer */ + brw_dp_READ_4(p, + writeback_reg[0], /* first writeback dest */ + 1, /* msg_reg */ + GL_FALSE, /* rel addr? */ + 16 * constIndex, /* byte offset */ + BRW_WM_MAX_SURF - 1 /* surface, binding table index */ + ); + + /* Extract the four channel values, smear across dest registers */ + for (i = 0; i < 4; i++) { + /* extract 1 float from the writeback reg */ + struct brw_reg new_src = stride(writeback_reg[0], 0, 1, 0); + new_src.subnr = i * 4; + /* and smear it into the dest register */ + brw_MOV(p, dst[i], new_src); + } + + release_tmps( c, mark ); +} + + /** * Resolve subroutine calls after code emit is done. */ @@ -2504,6 +2574,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) case OPCODE_ADD: emit_add(c, inst); break; + case OPCODE_ARL: + emit_arl(c, inst); + break; case OPCODE_SUB: emit_sub(c, inst); break; @@ -2520,7 +2593,17 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_trunc(c, inst); break; case OPCODE_MOV: +#if 0 + /* test hook for new constant buffer code */ + if (inst->SrcReg[0].File == PROGRAM_UNIFORM) { + emit_get_constant(brw, c, inst, inst->SrcReg[0].Index); + } + else { + emit_mov(c, inst); + } +#else emit_mov(c, inst); +#endif break; case OPCODE_DP3: emit_dp3(c, inst); 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 1fc537ca206..e7d55d5dbd1 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -33,6 +33,7 @@ #include "main/mtypes.h" #include "main/texformat.h" #include "main/texstore.h" +#include "shader/prog_parameter.h" #include "intel_mipmap_tree.h" #include "intel_batchbuffer.h" @@ -287,6 +288,7 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit ) struct intel_texture_object *intelObj = intel_texture_object(tObj); struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel]; struct brw_wm_surface_key key; + const GLuint j = MAX_DRAW_BUFFERS + unit; memset(&key, 0, sizeof(key)); @@ -313,16 +315,111 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit ) key.cpp = intelObj->mt->cpp; key.tiling = intelObj->mt->region->tiling; - dri_bo_unreference(brw->wm.surf_bo[unit + MAX_DRAW_BUFFERS]); - brw->wm.surf_bo[unit + MAX_DRAW_BUFFERS] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, - &key, sizeof(key), - &key.bo, key.bo ? 1 : 0, - NULL); - if (brw->wm.surf_bo[unit + MAX_DRAW_BUFFERS] == NULL) { - brw->wm.surf_bo[unit + MAX_DRAW_BUFFERS] = brw_create_texture_surface(brw, &key); + dri_bo_unreference(brw->wm.surf_bo[j]); + brw->wm.surf_bo[j] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, + &key, sizeof(key), + &key.bo, key.bo ? 1 : 0, + NULL); + if (brw->wm.surf_bo[j] == NULL) { + brw->wm.surf_bo[j] = brw_create_texture_surface(brw, &key); } } + + +/** + * Create the constant buffer surface. Fragment shader constanst will be + * read from this buffer with Data Port Read instructions/messages. + */ +static dri_bo * +brw_create_constant_surface( struct brw_context *brw, + struct brw_wm_surface_key *key ) +{ + const GLint w = key->width - 1; + struct brw_surface_state surf; + dri_bo *bo; + + memset(&surf, 0, sizeof(surf)); + + surf.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW; + surf.ss0.surface_type = BRW_SURFACE_BUFFER; + surf.ss0.surface_format = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT; + + /* This is ok for all textures with channel width 8bit or less: + */ + assert(key->bo); + if (key->bo) + surf.ss1.base_addr = key->bo->offset; /* reloc */ + else + surf.ss1.base_addr = key->offset; + + surf.ss2.width = w & 0x7f; /* bits 6:0 of size or width */ + surf.ss2.height = (w >> 7) & 0x1fff; /* bits 19:7 of size or width */ + surf.ss3.depth = (w >> 20) & 0x7f; /* bits 26:20 of size or width */ + surf.ss3.pitch = (key->pitch * key->cpp) - 1; + brw_set_surface_tiling(&surf, key->tiling); + + bo = brw_upload_cache(&brw->cache, BRW_SS_SURFACE, + key, sizeof(*key), + &key->bo, key->bo ? 1 : 0, + &surf, sizeof(surf), + NULL, NULL); + + if (key->bo) { + /* Emit relocation to surface contents */ + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_SAMPLER, 0, + 0, + offsetof(struct brw_surface_state, ss1), + key->bo); + } + + return bo; +} + + +/** + * Update the constant buffer surface. + */ +static void +brw_update_constant_surface( GLcontext *ctx, + const struct brw_fragment_program *fp ) +{ + struct brw_context *brw = brw_context(ctx); + struct brw_wm_surface_key key; + const GLuint j = BRW_WM_MAX_SURF - 1; + const GLuint numParams = fp->program.Base.Parameters->NumParameters; + + memset(&key, 0, sizeof(key)); + + key.format = MESA_FORMAT_RGBA_FLOAT32; + key.internal_format = GL_RGBA; + key.bo = fp->const_buffer; + + key.depthmode = GL_NONE; + key.pitch = numParams; + key.width = numParams; + key.height = 1; + key.depth = 1; + key.cpp = 16; + + /* + printf("%s:\n", __FUNCTION__); + printf(" width %d height %d depth %d cpp %d pitch %d\n", + key.width, key.height, key.depth, key.cpp, key.pitch); + */ + + dri_bo_unreference(brw->wm.surf_bo[j]); + brw->wm.surf_bo[j] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, + &key, sizeof(key), + &key.bo, key.bo ? 1 : 0, + NULL); + if (brw->wm.surf_bo[j] == NULL) { + brw->wm.surf_bo[j] = brw_create_constant_surface(brw, &key); + } +} + + /** * Sets up a surface state structure to point at the given region. * While it is only used for the front/back buffer currently, it should be @@ -514,6 +611,17 @@ static void prepare_wm_surfaces(struct brw_context *brw ) } } + /* Update surface for fragment shader constant buffer */ + { + const GLuint j = BRW_WM_MAX_SURF - 1; + const struct brw_fragment_program *fp = + brw_fragment_program_const(brw->fragment_program); + + brw_update_constant_surface(ctx, fp); + brw->wm.nr_surfaces = j + 1; + } + + dri_bo_unreference(brw->wm.bind_bo); brw->wm.bind_bo = brw_wm_get_binding_table(brw); -- cgit v1.2.3 From 34239862430aa38b0b1b6740c47d66f7260ae3e4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 12:25:34 -0600 Subject: i965: change args to get_src_reg() to prep for new constant buffer support --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 164 +++++++++++++++++--------------- 1 file changed, 85 insertions(+), 79 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 28ef84e4aac..41db3a805b7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -254,7 +254,8 @@ static void prealloc_reg(struct brw_wm_compile *c) * Convert Mesa dst register to brw register. */ static struct brw_reg get_dst_reg(struct brw_wm_compile *c, - struct prog_instruction *inst, int component) + const struct prog_instruction *inst, + GLuint component) { const int nr = 1; return get_reg(c, inst->DstReg.File, inst->DstReg.Index, component, nr, @@ -266,10 +267,13 @@ static struct brw_reg get_dst_reg(struct brw_wm_compile *c, * Convert Mesa src register to brw register. */ static struct brw_reg get_src_reg(struct brw_wm_compile *c, - struct prog_src_register *src, int index) + const struct prog_instruction *inst, + GLuint srcRegIndex, GLuint channel) { - const int nr = 1; - int component = GET_SWZ(src->Swizzle, index); + const struct prog_src_register *src = &inst->SrcReg[srcRegIndex]; + const GLuint nr = 1; + const GLuint component = GET_SWZ(src->Swizzle, channel); + return get_reg(c, src->File, src->Index, component, nr, src->NegateBase, src->Abs); } @@ -282,11 +286,13 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c, * For instructions with more than one operand, only the second can be a literal. */ static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, - struct prog_src_register *src, int index) + const struct prog_instruction *inst, + GLuint srcRegIndex, GLuint channel) { + const struct prog_src_register *src = &inst->SrcReg[srcRegIndex]; if (src->File == PROGRAM_CONSTANT) { /* a literal */ - const int component = GET_SWZ(src->Swizzle, index); + const int component = GET_SWZ(src->Swizzle, channel); const GLfloat *param = c->fp->program.Base.Parameters->ParameterValues[src->Index]; GLfloat value = param[component]; @@ -297,7 +303,7 @@ static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, return brw_imm_f(value); } else { - return get_src_reg(c, src, index); + return get_src_reg(c, inst, srcRegIndex, channel); } } @@ -376,7 +382,7 @@ static void emit_abs( struct brw_wm_compile *c, if (inst->DstReg.WriteMask & (1<SrcReg[0], i); + src = get_src_reg(c, inst, 0, i); brw_MOV(p, dst, brw_abs(src)); } } @@ -394,7 +400,7 @@ static void emit_trunc( struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i); + src = get_src_reg(c, inst, 0, i); brw_RNDZ(p, dst, src); } } @@ -412,7 +418,7 @@ static void emit_mov( struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i); + src = get_src_reg_imm(c, inst, 0, i); brw_MOV(p, dst, src); } } @@ -459,8 +465,8 @@ static void emit_delta_xy(struct brw_wm_compile *c, dst0 = get_dst_reg(c, inst, 0); dst1 = get_dst_reg(c, inst, 1); - src0 = get_src_reg(c, &inst->SrcReg[0], 0); - src1 = get_src_reg(c, &inst->SrcReg[0], 1); + src0 = get_src_reg(c, inst, 0, 0); + src1 = get_src_reg(c, inst, 0, 1); /* Calc delta X,Y by subtracting origin in r1 from the pixel * centers. */ @@ -525,7 +531,7 @@ static void emit_fb_write(struct brw_wm_compile *c, brw_push_insn_state(p); for (channel = 0; channel < 4; channel++) { - src0 = get_src_reg(c, &inst->SrcReg[0], channel); + src0 = get_src_reg(c, inst, 0, channel); /* mov (8) m2.0<1>:ud r28.0<8;8,1>:ud { Align1 } */ /* mov (8) m6.0<1>:ud r29.0<8;8,1>:ud { Align1 SecHalf } */ brw_MOV(p, brw_message_reg(nr + channel), src0); @@ -536,11 +542,11 @@ static void emit_fb_write(struct brw_wm_compile *c, if (c->key.source_depth_to_render_target) { if (c->key.computes_depth) { - src0 = get_src_reg(c, &inst->SrcReg[2], 2); + src0 = get_src_reg(c, inst, 2, 2); brw_MOV(p, brw_message_reg(nr), src0); } else { - src0 = get_src_reg(c, &inst->SrcReg[1], 1); + src0 = get_src_reg(c, inst, 1, 1); brw_MOV(p, brw_message_reg(nr), src0); } @@ -567,7 +573,7 @@ static void emit_fb_write(struct brw_wm_compile *c, else #endif { - struct brw_reg src = get_src_reg(c, &inst->SrcReg[1], 1); + struct brw_reg src = get_src_reg(c, inst, 1, 1); brw_MOV(p, brw_message_reg(nr), src); } nr += 2; @@ -588,9 +594,9 @@ static void emit_pixel_w( struct brw_wm_compile *c, struct brw_reg interp3; dst = get_dst_reg(c, inst, 3); - src0 = get_src_reg(c, &inst->SrcReg[0], 0); - delta0 = get_src_reg(c, &inst->SrcReg[1], 0); - delta1 = get_src_reg(c, &inst->SrcReg[1], 1); + src0 = get_src_reg(c, inst, 0, 0); + delta0 = get_src_reg(c, inst, 1, 0); + delta1 = get_src_reg(c, inst, 1, 1); interp3 = brw_vec1_grf(src0.nr+1, 4); /* Calc 1/w - just linterp wpos[3] optimized by putting the @@ -618,9 +624,9 @@ static void emit_linterp(struct brw_wm_compile *c, struct brw_reg src0; GLuint nr, i; - src0 = get_src_reg(c, &inst->SrcReg[0], 0); - delta0 = get_src_reg(c, &inst->SrcReg[1], 0); - delta1 = get_src_reg(c, &inst->SrcReg[1], 1); + src0 = get_src_reg(c, inst, 0, 0); + delta0 = get_src_reg(c, inst, 1, 0); + delta1 = get_src_reg(c, inst, 1, 1); nr = src0.nr; interp[0] = brw_vec1_grf(nr, 0); @@ -647,7 +653,7 @@ static void emit_cinterp(struct brw_wm_compile *c, struct brw_reg dst, src0; GLuint nr, i; - src0 = get_src_reg(c, &inst->SrcReg[0], 0); + src0 = get_src_reg(c, inst, 0, 0); nr = src0.nr; interp[0] = brw_vec1_grf(nr, 0); @@ -674,10 +680,10 @@ static void emit_pinterp(struct brw_wm_compile *c, struct brw_reg src0, w; GLuint nr, i; - src0 = get_src_reg(c, &inst->SrcReg[0], 0); - delta0 = get_src_reg(c, &inst->SrcReg[1], 0); - delta1 = get_src_reg(c, &inst->SrcReg[1], 1); - w = get_src_reg(c, &inst->SrcReg[2], 3); + src0 = get_src_reg(c, inst, 0, 0); + delta0 = get_src_reg(c, inst, 1, 0); + delta1 = get_src_reg(c, inst, 1, 1); + w = get_src_reg(c, inst, 2, 3); nr = src0.nr; interp[0] = brw_vec1_grf(nr, 0); @@ -738,11 +744,11 @@ static void emit_xpd(struct brw_wm_compile *c, if (mask & (1<SrcReg[0], i2)); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], i1); + src0 = negate(get_src_reg(c, inst, 0, i2)); + src1 = get_src_reg_imm(c, inst, 1, i1); brw_MUL(p, brw_null_reg(), src0, src1); - src0 = get_src_reg(c, &inst->SrcReg[0], i1); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], i2); + src0 = get_src_reg(c, inst, 0, i1); + src1 = get_src_reg_imm(c, inst, 1, i2); brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); brw_MAC(p, dst, src0, src1); brw_set_saturate(p, 0); @@ -758,8 +764,8 @@ static void emit_dp3(struct brw_wm_compile *c, int i; struct brw_compile *p = &c->func; for (i = 0; i < 3; i++) { - src0[i] = get_src_reg(c, &inst->SrcReg[0], i); - src1[i] = get_src_reg_imm(c, &inst->SrcReg[1], i); + src0[i] = get_src_reg(c, inst, 0, i); + src1[i] = get_src_reg_imm(c, inst, 1, i); } dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); @@ -777,8 +783,8 @@ static void emit_dp4(struct brw_wm_compile *c, int i; struct brw_compile *p = &c->func; for (i = 0; i < 4; i++) { - src0[i] = get_src_reg(c, &inst->SrcReg[0], i); - src1[i] = get_src_reg_imm(c, &inst->SrcReg[1], i); + src0[i] = get_src_reg(c, inst, 0, i); + src1[i] = get_src_reg_imm(c, inst, 1, i); } dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); brw_MUL(p, brw_null_reg(), src0[0], src1[0]); @@ -796,8 +802,8 @@ static void emit_dph(struct brw_wm_compile *c, int i; struct brw_compile *p = &c->func; for (i = 0; i < 4; i++) { - src0[i] = get_src_reg(c, &inst->SrcReg[0], i); - src1[i] = get_src_reg_imm(c, &inst->SrcReg[1], i); + src0[i] = get_src_reg(c, inst, 0, i); + src1[i] = get_src_reg_imm(c, inst, 1, i); } dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); brw_MUL(p, brw_null_reg(), src0[0], src1[0]); @@ -824,7 +830,7 @@ static void emit_math1(struct brw_wm_compile *c, tmp = alloc_tmp(c); /* Get first component of source register */ - src0 = get_src_reg(c, &inst->SrcReg[0], 0); + src0 = get_src_reg(c, inst, 0, 0); /* tmp = func(src0) */ brw_MOV(p, brw_message_reg(2), src0); @@ -897,8 +903,8 @@ static void emit_add(struct brw_wm_compile *c, for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); + src0 = get_src_reg(c, inst, 0, i); + src1 = get_src_reg_imm(c, inst, 1, i); brw_ADD(p, dst, src0, src1); } } @@ -913,7 +919,7 @@ static void emit_arl(struct brw_wm_compile *c, brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); addr_reg = brw_uw8_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_ADDRESS, 0); - src0 = get_src_reg(c, &inst->SrcReg[0], 0); /* channel 0 */ + src0 = get_src_reg(c, inst, 0, 0); /* channel 0 */ brw_MOV(p, addr_reg, src0); brw_set_saturate(p, 0); } @@ -929,8 +935,8 @@ static void emit_sub(struct brw_wm_compile *c, for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); + src0 = get_src_reg(c, inst, 0, i); + src1 = get_src_reg_imm(c, inst, 1, i); brw_ADD(p, dst, src0, negate(src1)); } } @@ -948,8 +954,8 @@ static void emit_mul(struct brw_wm_compile *c, for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); + src0 = get_src_reg(c, inst, 0, i); + src1 = get_src_reg_imm(c, inst, 1, i); brw_MUL(p, dst, src0, src1); } } @@ -967,7 +973,7 @@ static void emit_frc(struct brw_wm_compile *c, for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i); + src0 = get_src_reg_imm(c, inst, 0, i); brw_FRC(p, dst, src0); } } @@ -986,7 +992,7 @@ static void emit_flr(struct brw_wm_compile *c, for (i = 0 ; i < 4; i++) { if (mask & (1<SrcReg[0], i); + src0 = get_src_reg_imm(c, inst, 0, i); brw_RNDD(p, dst, src0); } } @@ -1004,8 +1010,8 @@ static void emit_max(struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); + src0 = get_src_reg(c, inst, 0, i); + src1 = get_src_reg_imm(c, inst, 1, i); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); brw_MOV(p, dst, src0); brw_set_saturate(p, 0); @@ -1032,8 +1038,8 @@ static void emit_min(struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i); - src1 = get_src_reg(c, &inst->SrcReg[1], i); + src0 = get_src_reg_imm(c, inst, 0, i); + src1 = get_src_reg(c, inst, 1, i); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); brw_MOV(p, dst, src0); brw_set_saturate(p, 0); @@ -1055,8 +1061,8 @@ static void emit_pow(struct brw_wm_compile *c, struct brw_compile *p = &c->func; struct brw_reg dst, src0, src1; dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); - src0 = get_src_reg_imm(c, &inst->SrcReg[0], 0); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], 0); + src0 = get_src_reg_imm(c, inst, 0, 0); + src1 = get_src_reg_imm(c, inst, 1, 0); brw_MOV(p, brw_message_reg(2), src0); brw_MOV(p, brw_message_reg(3), src1); @@ -1082,9 +1088,9 @@ static void emit_lrp(struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i); + src0 = get_src_reg(c, inst, 0, i); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); + src1 = get_src_reg_imm(c, inst, 1, i); if (src1.nr == dst.nr) { tmp1 = alloc_tmp(c); @@ -1092,7 +1098,7 @@ static void emit_lrp(struct brw_wm_compile *c, } else tmp1 = src1; - src2 = get_src_reg(c, &inst->SrcReg[2], i); + src2 = get_src_reg(c, inst, 2, i); if (src2.nr == dst.nr) { tmp2 = alloc_tmp(c); brw_MOV(p, tmp2, src2); @@ -1135,9 +1141,9 @@ static void emit_mad(struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); - src2 = get_src_reg_imm(c, &inst->SrcReg[2], i); + src0 = get_src_reg(c, inst, 0, i); + src1 = get_src_reg_imm(c, inst, 1, i); + src2 = get_src_reg_imm(c, inst, 2, i); brw_MUL(p, dst, src0, src1); brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); @@ -1158,8 +1164,8 @@ static void emit_sop(struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i); - src1 = get_src_reg_imm(c, &inst->SrcReg[1], i); + src0 = get_src_reg(c, inst, 0, i); + src1 = get_src_reg_imm(c, inst, 1, i); brw_push_insn_state(p); brw_CMP(p, brw_null_reg(), cond, src0, src1); brw_set_predicate_control(p, BRW_PREDICATE_NONE); @@ -1216,8 +1222,8 @@ static void emit_ddx(struct brw_wm_compile *c, struct brw_reg dst; struct brw_reg src0, w; GLuint nr, i; - src0 = get_src_reg(c, &inst->SrcReg[0], 0); - w = get_src_reg(c, &inst->SrcReg[1], 3); + src0 = get_src_reg(c, inst, 0, 0); + w = get_src_reg(c, inst, 1, 3); nr = src0.nr; interp[0] = brw_vec1_grf(nr, 0); interp[1] = brw_vec1_grf(nr, 4); @@ -1244,9 +1250,9 @@ static void emit_ddy(struct brw_wm_compile *c, struct brw_reg src0, w; GLuint nr, i; - src0 = get_src_reg(c, &inst->SrcReg[0], 0); + src0 = get_src_reg(c, inst, 0, 0); nr = src0.nr; - w = get_src_reg(c, &inst->SrcReg[1], 3); + w = get_src_reg(c, inst, 1, 3); interp[0] = brw_vec1_grf(nr, 0); interp[1] = brw_vec1_grf(nr, 4); interp[2] = brw_vec1_grf(nr+1, 0); @@ -1388,7 +1394,7 @@ static void emit_noise1( struct brw_wm_compile *c, assert( mark == 0 ); - src = get_src_reg( c, inst->SrcReg, 0 ); + src = get_src_reg( c, inst, 0, 0 ); param = alloc_tmp( c ); @@ -1558,8 +1564,8 @@ static void emit_noise2( struct brw_wm_compile *c, assert( mark == 0 ); - src0 = get_src_reg( c, inst->SrcReg, 0 ); - src1 = get_src_reg( c, inst->SrcReg, 1 ); + src0 = get_src_reg( c, inst, 0, 0 ); + src1 = get_src_reg( c, inst, 0, 1 ); param0 = alloc_tmp( c ); param1 = alloc_tmp( c ); @@ -1861,9 +1867,9 @@ static void emit_noise3( struct brw_wm_compile *c, assert( mark == 0 ); - src0 = get_src_reg( c, inst->SrcReg, 0 ); - src1 = get_src_reg( c, inst->SrcReg, 1 ); - src2 = get_src_reg( c, inst->SrcReg, 2 ); + src0 = get_src_reg( c, inst, 0, 0 ); + src1 = get_src_reg( c, inst, 0, 1 ); + src2 = get_src_reg( c, inst, 0, 2 ); param0 = alloc_tmp( c ); param1 = alloc_tmp( c ); @@ -2284,10 +2290,10 @@ static void emit_noise4( struct brw_wm_compile *c, assert( mark == 0 ); - src0 = get_src_reg( c, inst->SrcReg, 0 ); - src1 = get_src_reg( c, inst->SrcReg, 1 ); - src2 = get_src_reg( c, inst->SrcReg, 2 ); - src3 = get_src_reg( c, inst->SrcReg, 3 ); + src0 = get_src_reg( c, inst, 0, 0 ); + src1 = get_src_reg( c, inst, 0, 1 ); + src2 = get_src_reg( c, inst, 0, 2 ); + src3 = get_src_reg( c, inst, 0, 3 ); param0 = alloc_tmp( c ); param1 = alloc_tmp( c ); @@ -2325,8 +2331,8 @@ static void emit_wpos_xy(struct brw_wm_compile *c, dst[0] = get_dst_reg(c, inst, 0); dst[1] = get_dst_reg(c, inst, 1); - src0[0] = get_src_reg(c, &inst->SrcReg[0], 0); - src0[1] = get_src_reg(c, &inst->SrcReg[0], 1); + src0[0] = get_src_reg(c, inst, 0, 0); + src0[1] = get_src_reg(c, inst, 0, 1); /* Calculate the pixel offset from window bottom left into destination * X and Y channels. @@ -2364,7 +2370,7 @@ static void emit_txb(struct brw_wm_compile *c, for (i = 0; i < 4; i++) dst[i] = get_dst_reg(c, inst, i); for (i = 0; i < 4; i++) - src[i] = get_src_reg(c, &inst->SrcReg[0], i); + src[i] = get_src_reg(c, inst, 0, i); switch (inst->TexSrcTarget) { case TEXTURE_1D_INDEX: @@ -2416,7 +2422,7 @@ static void emit_tex(struct brw_wm_compile *c, for (i = 0; i < 4; i++) dst[i] = get_dst_reg(c, inst, i); for (i = 0; i < 4; i++) - src[i] = get_src_reg(c, &inst->SrcReg[0], i); + src[i] = get_src_reg(c, inst, 0, i); switch (inst->TexSrcTarget) { case TEXTURE_1D_INDEX: -- cgit v1.2.3 From 30adf0518168ded9c7f519a7c772cab728852b1f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 12:57:06 -0600 Subject: i965: fix response length param in brw_dp_READ_4() We were accidentally clobbering the next register. --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index b149f0f21f7..c58c4554103 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -994,7 +994,7 @@ void brw_dp_READ_4( struct brw_compile *p, BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ 0, /* source cache = data cache */ 1, /* msg_length */ - 2, /* response_length */ + 1, /* response_length (1 Oword) */ 0); /* eot */ } } -- cgit v1.2.3 From 1e299ff828e808cbb1d92d9fedd528a3a8a3609e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 Apr 2009 13:36:48 -0600 Subject: i965: another checkpoint commit of new constant buffer support Everything is in place now for using a true constant buffer for GLSL fragment shaders. Still some bugs to find though. --- src/mesa/drivers/dri/i965/brw_wm.h | 8 ++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 172 ++++++++++++++++++++------------ 2 files changed, 115 insertions(+), 65 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 98c22121ec1..d0ab3bdc65f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -253,6 +253,14 @@ struct brw_wm_compile { GLuint tmp_index; GLuint tmp_max; GLuint subroutines[BRW_WM_MAX_SUBROUTINE]; + + /** using a real constant buffer? */ + GLboolean use_const_buffer; + /** we may need up to 3 constants per instruction (if use_const_buffer) */ + struct { + GLint index; + struct brw_reg reg; + } current_const[3]; }; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 41db3a805b7..01d1f7f0c2d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -193,7 +193,19 @@ static void prealloc_reg(struct brw_wm_compile *c) { const int nr_params = c->fp->program.Base.Parameters->NumParameters; - if (1 /* XXX threshold: nr_params <= 8 */) { + /* use a real constant buffer, or just use a section of the GRF? */ + c->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/ + /*printf("USE CONST BUFFER? %d\n", c->use_const_buffer);*/ + + if (c->use_const_buffer) { + /* We'll use a real constant buffer and fetch constants from + * it with a dataport read message. + */ + + /* number of float constants in CURBE */ + c->prog_data.nr_params = 0; + } + else { const struct gl_program_parameter_list *plist = c->fp->program.Base.Parameters; int index = 0; @@ -217,16 +229,6 @@ static void prealloc_reg(struct brw_wm_compile *c) c->nr_creg = 2 * ((4 * nr_params + 15) / 16); c->reg_index += c->nr_creg; } - else { - /* number of float constants in CURBE */ - c->prog_data.nr_params = 0; - - /* When there's a lot of FP constanst we'll store them in a - * texture-like buffer instead of using the CURBE buffer. - * This means we won't use GRF registers for constants and we'll - * have to fetch constants with a dataport read. - */ - } } /* fragment shader inputs */ @@ -247,6 +249,49 @@ static void prealloc_reg(struct brw_wm_compile *c) c->reg_index++; c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); c->reg_index += 2; + + /* An instruction may reference up to three constants. + * They'll be found in these registers. + * XXX alloc these on demand! + */ + if (c->use_const_buffer) { + c->current_const[0].reg = alloc_tmp(c); + c->current_const[1].reg = alloc_tmp(c); + c->current_const[2].reg = alloc_tmp(c); + } + /*printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index);*/ +} + + +/** + * Check if any of the instruction's src registers are constants, uniforms, + * or statevars. If so, fetch any constants that we don't already have in + * the three GRF slots. + */ +static void fetch_constants(struct brw_wm_compile *c, + const struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + GLuint i; + + /* loop over instruction src regs */ + for (i = 0; i < 3; i++) { + const struct prog_src_register *src = &inst->SrcReg[i]; + if (src->File == PROGRAM_STATE_VAR || + src->File == PROGRAM_UNIFORM) { + if (c->current_const[i].index != src->Index) { + /* 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 */ + BRW_WM_MAX_SURF - 1 /* binding table index */ + ); + c->current_const[i].index = src->Index; + } + } + } } @@ -263,6 +308,43 @@ static struct brw_reg get_dst_reg(struct brw_wm_compile *c, } +static struct brw_reg +get_src_reg_const(struct brw_wm_compile *c, + const struct prog_instruction *inst, + GLuint srcRegIndex, GLuint component) +{ + /* We should have already fetched the constant from the constant + * buffer in fetch_constants(). Now we just have to return a + * register description that extracts the needed component and + * smears it across all eight vector components. + */ + const struct prog_src_register *src = &inst->SrcReg[srcRegIndex]; + struct brw_reg const_reg; + + assert(srcRegIndex < 3); + assert(c->current_const[srcRegIndex].index != -1); + const_reg = c->current_const[srcRegIndex].reg; + + /* + printf("get const reg %d in slot %d, comp %d\n", + c->current_const[srcRegIndex].index, + srcRegIndex, + component); + */ + + /* extract desired float from the const_reg, and smear */ + const_reg = stride(const_reg, 0, 1, 0); + const_reg.subnr = component * 4; + + if (src->NegateBase) + const_reg = negate(const_reg); + if (src->Abs) + const_reg = brw_abs(const_reg); + + return const_reg; +} + + /** * Convert Mesa src register to brw register. */ @@ -274,8 +356,16 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c, const GLuint nr = 1; const GLuint component = GET_SWZ(src->Swizzle, channel); - return get_reg(c, src->File, src->Index, component, nr, - src->NegateBase, src->Abs); + if (c->use_const_buffer && + (src->File == PROGRAM_STATE_VAR || + src->File == PROGRAM_UNIFORM)) { + return get_src_reg_const(c, inst, srcRegIndex, component); + } + else { + /* other type of source register */ + return get_reg(c, src->File, src->Index, component, nr, + src->NegateBase, src->Abs); + } } @@ -2473,48 +2563,6 @@ static void emit_tex(struct brw_wm_compile *c, } -static void emit_get_constant(struct brw_context *brw, - struct brw_wm_compile *c, - struct prog_instruction *inst, - GLuint constIndex) -{ - struct brw_compile *p = &c->func; - struct brw_reg dst[4]; - GLuint i; - const int mark = mark_tmps( c ); - struct brw_reg writeback_reg[4]; - - /* XXX only need 1 temp reg??? */ - for (i = 0; i < 4; i++) { - writeback_reg[i] = alloc_tmp(c); - } - - for (i = 0; i < 4; i++) { - dst[i] = get_dst_reg(c, inst, i); - } - - /* Get float[4] vector from constant buffer */ - brw_dp_READ_4(p, - writeback_reg[0], /* first writeback dest */ - 1, /* msg_reg */ - GL_FALSE, /* rel addr? */ - 16 * constIndex, /* byte offset */ - BRW_WM_MAX_SURF - 1 /* surface, binding table index */ - ); - - /* Extract the four channel values, smear across dest registers */ - for (i = 0; i < 4; i++) { - /* extract 1 float from the writeback reg */ - struct brw_reg new_src = stride(writeback_reg[0], 0, 1, 0); - new_src.subnr = i * 4; - /* and smear it into the dest register */ - brw_MOV(p, dst[i], new_src); - } - - release_tmps( c, mark ); -} - - /** * Resolve subroutine calls after code emit is done. */ @@ -2546,6 +2594,10 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) else brw_set_conditionalmod(p, BRW_CONDITIONAL_NONE); + /* fetch any constants that this instruction needs */ + if (c->use_const_buffer) + fetch_constants(c, inst); + switch (inst->Opcode) { case WM_PIXELXY: emit_pixel_xy(c, inst); @@ -2599,17 +2651,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_trunc(c, inst); break; case OPCODE_MOV: -#if 0 - /* test hook for new constant buffer code */ - if (inst->SrcReg[0].File == PROGRAM_UNIFORM) { - emit_get_constant(brw, c, inst, inst->SrcReg[0].Index); - } - else { - emit_mov(c, inst); - } -#else emit_mov(c, inst); -#endif break; case OPCODE_DP3: emit_dp3(c, inst); -- cgit v1.2.3 From a330a6fcd0b018829194ffab260f50956bce4832 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 2 Apr 2009 11:45:17 -0600 Subject: i965: s/GL_FALSE/BRW_COMPRESSION_NONE/ --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index c58c4554103..21ce8369db4 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -1127,7 +1127,7 @@ void brw_SAMPLE(struct brw_compile *p, /* mov (8) r9.0<1>:f r9.0<8;8,1>:f { Align1 } */ brw_push_insn_state(p); - brw_set_compression_control(p, GL_FALSE); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_MOV(p, reg, reg); brw_pop_insn_state(p); } -- cgit v1.2.3 From 21982a2cd597aeb22d7ee2bd3a5067c58f97ca6f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 2 Apr 2009 14:33:45 -0600 Subject: i965: added brw_same_reg() --- src/mesa/drivers/dri/i965/brw_eu.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index c94889ab1c5..d05f2e6c410 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -730,6 +730,13 @@ static INLINE struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offset return ptr; } +/** Do two brw_regs refer to the same register? */ +static INLINE GLboolean +brw_same_reg(struct brw_reg r1, struct brw_reg r2) +{ + return r1.file == r2.file && r1.nr == r2.nr; +} + static INLINE struct brw_instruction *current_insn( struct brw_compile *p) { return &p->store[p->nr_insn]; -- cgit v1.2.3 From 0139637975ec210b28b593722eda85c68c89c70d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 08:59:38 -0600 Subject: i965: more const buffer debug code --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 134 ++++++++++++++++++++------------ 1 file changed, 84 insertions(+), 50 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 01d1f7f0c2d..575cd45d572 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -195,7 +195,6 @@ static void prealloc_reg(struct brw_wm_compile *c) /* use a real constant buffer, or just use a section of the GRF? */ c->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/ - /*printf("USE CONST BUFFER? %d\n", c->use_const_buffer);*/ if (c->use_const_buffer) { /* We'll use a real constant buffer and fetch constants from @@ -259,7 +258,10 @@ static void prealloc_reg(struct brw_wm_compile *c) c->current_const[1].reg = alloc_tmp(c); c->current_const[2].reg = alloc_tmp(c); } - /*printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index);*/ + /* + printf("USE CONST BUFFER? %d\n", c->use_const_buffer); + printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index); + */ } @@ -278,8 +280,18 @@ static void fetch_constants(struct brw_wm_compile *c, for (i = 0; i < 3; i++) { const struct prog_src_register *src = &inst->SrcReg[i]; if (src->File == PROGRAM_STATE_VAR || + src->File == PROGRAM_CONSTANT || src->File == PROGRAM_UNIFORM) { if (c->current_const[i].index != src->Index) { + + c->current_const[i].index = src->Index; + /*c->current_const[i].reg = alloc_tmp(c);*/ + + /* + printf(" fetch const[%d] for arg %d into reg %d\n", + src->Index, i, c->current_const[i].reg.nr); + */ + /* need to fetch the constant now */ brw_dp_READ_4(p, c->current_const[i].reg, /* writeback dest */ @@ -288,7 +300,26 @@ static void fetch_constants(struct brw_wm_compile *c, 16 * src->Index, /* byte offset */ BRW_WM_MAX_SURF - 1 /* binding table index */ ); - c->current_const[i].index = src->Index; + +#if 0 + /* dependency stall */ + { + int response_length = 1; + int mark = mark_tmps( c ); + struct brw_reg src = c->current_const[i].reg; + struct brw_reg tmp = alloc_tmp(c); + + /* mov (8) r9.0<1>:f r9.0<8;8,1>:f { Align1 } + */ + brw_push_insn_state(p); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_MOV(p, tmp, src); + brw_MOV(p, src, tmp); + brw_pop_insn_state(p); + + release_tmps( c, mark ); + } +#endif } } } @@ -321,17 +352,11 @@ get_src_reg_const(struct brw_wm_compile *c, const struct prog_src_register *src = &inst->SrcReg[srcRegIndex]; struct brw_reg const_reg; + assert(component < 4); assert(srcRegIndex < 3); assert(c->current_const[srcRegIndex].index != -1); const_reg = c->current_const[srcRegIndex].reg; - /* - printf("get const reg %d in slot %d, comp %d\n", - c->current_const[srcRegIndex].index, - srcRegIndex, - component); - */ - /* extract desired float from the const_reg, and smear */ const_reg = stride(const_reg, 0, 1, 0); const_reg.subnr = component * 4; @@ -341,6 +366,14 @@ get_src_reg_const(struct brw_wm_compile *c, if (src->Abs) const_reg = brw_abs(const_reg); + /* + printf(" form const[%d] for arg %d, comp %d, reg %d\n", + c->current_const[srcRegIndex].index, + srcRegIndex, + component, + const_reg.nr); + */ + return const_reg; } @@ -358,6 +391,7 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c, if (c->use_const_buffer && (src->File == PROGRAM_STATE_VAR || + src->File == PROGRAM_CONSTANT || src->File == PROGRAM_UNIFORM)) { return get_src_reg_const(c, inst, srcRegIndex, component); } @@ -373,7 +407,10 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c, * Same as \sa get_src_reg() but if the register is a literal, emit * a brw_reg encoding the literal. * Note that a brw instruction only allows one src operand to be a literal. - * For instructions with more than one operand, only the second can be a literal. + * For instructions with more than one operand, only the second can be a + * literal. This means that we treat some literals as constants/uniforms + * (which why PROGRAM_CONSTANT is checked in fetch_constants()). + * */ static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, const struct prog_instruction *inst, @@ -390,6 +427,7 @@ static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, value = -value; if (src->Abs) value = FABSF(value); + /*printf(" form imm reg %f\n", value);*/ return brw_imm_f(value); } else { @@ -1089,60 +1127,53 @@ static void emit_flr(struct brw_wm_compile *c, brw_set_saturate(p, 0); } -static void emit_max(struct brw_wm_compile *c, - struct prog_instruction *inst) -{ - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - struct brw_reg src0, src1, dst; - int i; - brw_push_insn_state(p); - for (i = 0; i < 4; i++) { - if (mask & (1<SaturateMode != SATURATE_OFF) ? 1 : 0); - brw_MOV(p, dst, src0); - brw_set_saturate(p, 0); - - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src0, src1); - brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); - brw_MOV(p, dst, src1); - brw_set_saturate(p, 0); - brw_set_predicate_control_flag_value(p, 0xff); - } - } - brw_pop_insn_state(p); -} -static void emit_min(struct brw_wm_compile *c, - struct prog_instruction *inst) +static void emit_min_max(struct brw_wm_compile *c, + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - struct brw_reg src0, src1, dst; + const GLuint mask = inst->DstReg.WriteMask; + const int mark = mark_tmps(c); int i; brw_push_insn_state(p); for (i = 0; i < 4; i++) { if (mask & (1<SaturateMode != SATURATE_OFF) ? 1 : 0); brw_MOV(p, dst, src0); brw_set_saturate(p, 0); - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src1, src0); + if (inst->Opcode == OPCODE_MIN) + brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src1, src0); + else + brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_G, src1, src0); + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); brw_MOV(p, dst, src1); brw_set_saturate(p, 0); brw_set_predicate_control_flag_value(p, 0xff); + if (use_temp) + brw_MOV(p, real_dst, dst); } } brw_pop_insn_state(p); + release_tmps(c, mark); } static void emit_pow(struct brw_wm_compile *c, @@ -2594,6 +2625,11 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) else brw_set_conditionalmod(p, BRW_CONDITIONAL_NONE); + /* + _mesa_printf("Inst %d: ", i); + _mesa_print_instruction(inst); + */ + /* fetch any constants that this instruction needs */ if (c->use_const_buffer) fetch_constants(c, inst); @@ -2683,11 +2719,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) case OPCODE_LG2: emit_lg2(c, inst); break; - case OPCODE_MAX: - emit_max(c, inst); - break; case OPCODE_MIN: - emit_min(c, inst); + case OPCODE_MAX: + emit_min_max(c, inst); break; case OPCODE_DDX: emit_ddx(c, inst); -- cgit v1.2.3 From 5c5d78e1918fedb6fd43f5fafdba2a142a09d56f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 09:00:06 -0600 Subject: mesa: replace assertion with conditional in _mesa_opcode_string() --- src/mesa/shader/prog_instruction.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index 6a21152c60b..ca7565c0911 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -291,7 +291,9 @@ _mesa_is_tex_instruction(gl_inst_opcode opcode) const char * _mesa_opcode_string(gl_inst_opcode opcode) { - ASSERT(opcode < MAX_OPCODE); - return InstInfo[opcode].Name; + if (opcode < MAX_OPCODE) + return InstInfo[opcode].Name; + else + return "OP?"; } -- cgit v1.2.3 From 29ae40f5dc8b4b880de1630ce71e3451a77c57f4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 09:06:24 -0600 Subject: glx: remove unused local var in determineTextureFormat() --- src/glx/x11/glx_pbuffer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c index 6bcf965056a..a06331fd7fa 100644 --- a/src/glx/x11/glx_pbuffer.c +++ b/src/glx/x11/glx_pbuffer.c @@ -194,7 +194,6 @@ determineTextureTarget(const int *attribs, int numAttribs) static GLenum determineTextureFormat(const int *attribs, int numAttribs) { - GLenum target = 0; int i; for (i = 0; i < numAttribs; i++) { -- cgit v1.2.3 From cbd305394a7a01e12f4a42b2551a154b4d544fe2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 09:08:00 -0600 Subject: i965: remove unused var --- src/mesa/drivers/dri/i965/brw_curbe.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 39a8610952c..a6bfb7507e7 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -339,7 +339,6 @@ static void prepare_constant_buffer(struct brw_context *brw) static void update_texture_constant_buffer(struct brw_context *brw) { - struct intel_context *intel = &brw->intel; struct brw_fragment_program *fp = (struct brw_fragment_program *) brw->fragment_program; const struct gl_program_parameter_list *params = fp->program.Base.Parameters; -- cgit v1.2.3 From e3d5e0aead06dc066f3df4bb5a0c8f30bef55248 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 3 Apr 2009 17:25:29 +0200 Subject: tgsi/exec: Actually enable switch-case for FLR. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 80b8c92445a..e8bd7cda3b1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1904,7 +1904,7 @@ exec_instruction( switch (inst->Instruction.Opcode) { case TGSI_OPCODE_ARL: - /* TGSI_OPCODE_FLOOR */ + case TGSI_OPCODE_FLOOR: /* TGSI_OPCODE_FLR */ FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); -- cgit v1.2.3 From be4c2d9a335aa38418000dd55845cea39c84261f Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 3 Apr 2009 17:55:21 +0200 Subject: python/regress: vertex shader srcmod swz test does not use TEMP[0]. --- .../state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh index 7617b6d5200..c03de4c674e 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh @@ -4,7 +4,6 @@ DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION DCL OUT[1], COLOR -DCL TEMP[0] MOV OUT[0], IN[0].yxzw MOV OUT[1], IN[1] -- cgit v1.2.3 From 650d147289014e8a98f65fbbcd1855b2a4f19d2f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 09:55:10 -0600 Subject: mesa: don't normalize spot light direction until validation time In glLight() we're only supposed to transform the direction by the modelview matrix, not normalized it too. --- src/mesa/main/light.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index a15c1f0be05..f72841b8ccb 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -209,7 +209,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) _math_matrix_analyse(ctx->ModelviewMatrixStack.Top); } TRANSFORM_DIRECTION(temp, params, ctx->ModelviewMatrixStack.Top->m); - NORMALIZE_3FV(temp); params = temp; break; case GL_SPOT_EXPONENT: @@ -1137,12 +1136,18 @@ compute_light_positions( GLcontext *ctx ) } if (light->_Flags & LIGHT_SPOT) { + /* Note: we normalize the spot direction now */ + if (ctx->_NeedEyeCoords) { COPY_3V( light->_NormDirection, light->EyeDirection ); + NORMALIZE_3FV( light->_NormDirection ); } else { + GLfloat spotDir[3]; + COPY_3V(spotDir, light->EyeDirection); + NORMALIZE_3FV(spotDir); TRANSFORM_NORMAL( light->_NormDirection, - light->EyeDirection, + spotDir, ctx->ModelviewMatrixStack.Top->m); } -- cgit v1.2.3 From 7391ba1e9d81f15465059db25d1279eefdbeb1a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 10:08:20 -0600 Subject: mesa: rename some gl_light fields to be clearer EyeDirection -> SpotDirection _NormDirection -> _NormSpotDirection --- src/mesa/drivers/dri/r200/r200_state.c | 8 ++++---- src/mesa/drivers/dri/radeon/radeon_lighting.c | 8 ++++---- src/mesa/drivers/dri/radeon/radeon_state.c | 8 ++++---- src/mesa/main/attrib.c | 2 +- src/mesa/main/light.c | 26 +++++++++++++------------- src/mesa/main/mtypes.h | 4 ++-- src/mesa/shader/prog_statevars.c | 4 ++-- src/mesa/tnl/t_rasterpos.c | 2 +- src/mesa/tnl/t_vb_lighttmp.h | 6 +++--- src/mesa/x86/gen_matypes.c | 4 ++-- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 0eaaaf69ac7..2fcc87c0f5a 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -1210,7 +1210,7 @@ void r200UpdateMaterial( GLcontext *ctx ) * _VP_inf_norm * _h_inf_norm * _Position - * _NormDirection + * _NormSpotDirection * _ModelViewInvScale * _NeedEyeCoords * _EyeZDir @@ -1267,9 +1267,9 @@ static void update_light( GLcontext *ctx ) fcmd[LIT_DIRECTION_W] = 0; } else { COPY_4V( &fcmd[LIT_POSITION_X], l->_Position ); - fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0]; - fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1]; - fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2]; + fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0]; + fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1]; + fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2]; fcmd[LIT_DIRECTION_W] = 0; } diff --git a/src/mesa/drivers/dri/radeon/radeon_lighting.c b/src/mesa/drivers/dri/radeon/radeon_lighting.c index 6d9ccfa24d6..ac3b94e4a68 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lighting.c +++ b/src/mesa/drivers/dri/radeon/radeon_lighting.c @@ -246,7 +246,7 @@ void radeonUpdateMaterial( GLcontext *ctx ) * _VP_inf_norm * _h_inf_norm * _Position - * _NormDirection + * _NormSpotDirection * _ModelViewInvScale * _NeedEyeCoords * _EyeZDir @@ -308,9 +308,9 @@ void radeonUpdateLighting( GLcontext *ctx ) fcmd[LIT_DIRECTION_W] = 0; } else { COPY_4V( &fcmd[LIT_POSITION_X], l->_Position ); - fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0]; - fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1]; - fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2]; + fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0]; + fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1]; + fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2]; fcmd[LIT_DIRECTION_W] = 0; } diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 32bcff33602..b6561001e76 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -967,7 +967,7 @@ void radeonUpdateMaterial( GLcontext *ctx ) * _VP_inf_norm * _h_inf_norm * _Position - * _NormDirection + * _NormSpotDirection * _ModelViewInvScale * _NeedEyeCoords * _EyeZDir @@ -1028,9 +1028,9 @@ static void update_light( GLcontext *ctx ) fcmd[LIT_DIRECTION_W] = 0; } else { COPY_4V( &fcmd[LIT_POSITION_X], l->_Position ); - fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0]; - fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1]; - fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2]; + fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0]; + fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1]; + fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2]; fcmd[LIT_DIRECTION_W] = 0; } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 1d2c4604884..d5d0a552dbf 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1104,7 +1104,7 @@ _mesa_PopAttrib(void) _mesa_light(ctx, i, GL_DIFFUSE, l->Diffuse); _mesa_light(ctx, i, GL_SPECULAR, l->Specular ); _mesa_light(ctx, i, GL_POSITION, l->EyePosition); - _mesa_light(ctx, i, GL_SPOT_DIRECTION, l->EyeDirection); + _mesa_light(ctx, i, GL_SPOT_DIRECTION, l->SpotDirection); _mesa_light(ctx, i, GL_SPOT_EXPONENT, &l->SpotExponent); _mesa_light(ctx, i, GL_SPOT_CUTOFF, &l->SpotCutoff); _mesa_light(ctx, i, GL_CONSTANT_ATTENUATION, diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index f72841b8ccb..ac604fd12cc 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -110,10 +110,10 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params) break; case GL_SPOT_DIRECTION: /* NOTE: Direction already transformed by inverse ModelView! */ - if (TEST_EQ_3V(light->EyeDirection, params)) + if (TEST_EQ_3V(light->SpotDirection, params)) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); - COPY_3V(light->EyeDirection, params); + COPY_3V(light->SpotDirection, params); break; case GL_SPOT_EXPONENT: ASSERT(params[0] >= 0.0); @@ -325,7 +325,7 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) COPY_4V( params, ctx->Light.Light[l].EyePosition ); break; case GL_SPOT_DIRECTION: - COPY_3V( params, ctx->Light.Light[l].EyeDirection ); + COPY_3V( params, ctx->Light.Light[l].SpotDirection ); break; case GL_SPOT_EXPONENT: params[0] = ctx->Light.Light[l].SpotExponent; @@ -387,9 +387,9 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) params[3] = (GLint) ctx->Light.Light[l].EyePosition[3]; break; case GL_SPOT_DIRECTION: - params[0] = (GLint) ctx->Light.Light[l].EyeDirection[0]; - params[1] = (GLint) ctx->Light.Light[l].EyeDirection[1]; - params[2] = (GLint) ctx->Light.Light[l].EyeDirection[2]; + params[0] = (GLint) ctx->Light.Light[l].SpotDirection[0]; + params[1] = (GLint) ctx->Light.Light[l].SpotDirection[1]; + params[2] = (GLint) ctx->Light.Light[l].SpotDirection[2]; break; case GL_SPOT_EXPONENT: params[0] = (GLint) ctx->Light.Light[l].SpotExponent; @@ -1139,23 +1139,23 @@ compute_light_positions( GLcontext *ctx ) /* Note: we normalize the spot direction now */ if (ctx->_NeedEyeCoords) { - COPY_3V( light->_NormDirection, light->EyeDirection ); - NORMALIZE_3FV( light->_NormDirection ); + COPY_3V( light->_NormSpotDirection, light->SpotDirection ); + NORMALIZE_3FV( light->_NormSpotDirection ); } else { GLfloat spotDir[3]; - COPY_3V(spotDir, light->EyeDirection); + COPY_3V(spotDir, light->SpotDirection); NORMALIZE_3FV(spotDir); - TRANSFORM_NORMAL( light->_NormDirection, + TRANSFORM_NORMAL( light->_NormSpotDirection, spotDir, ctx->ModelviewMatrixStack.Top->m); } - NORMALIZE_3FV( light->_NormDirection ); + NORMALIZE_3FV( light->_NormSpotDirection ); if (!(light->_Flags & LIGHT_POSITIONAL)) { GLfloat PV_dot_dir = - DOT3(light->_VP_inf_norm, - light->_NormDirection); + light->_NormSpotDirection); if (PV_dot_dir > light->_CosCutoff) { double x = PV_dot_dir * (EXP_TABLE_SIZE-1); @@ -1279,7 +1279,7 @@ init_light( struct gl_light *l, GLuint n ) ASSIGN_4V( l->Specular, 0.0, 0.0, 0.0, 1.0 ); } ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 ); - ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 ); + ASSIGN_3V( l->SpotDirection, 0.0, 0.0, -1.0 ); l->SpotExponent = 0.0; _mesa_invalidate_spot_exp_table( l ); l->SpotCutoff = 180.0; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 10f0d067e33..3f315900000 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -460,7 +460,7 @@ struct gl_light GLfloat Diffuse[4]; /**< diffuse color */ GLfloat Specular[4]; /**< specular color */ GLfloat EyePosition[4]; /**< position in eye coordinates */ - GLfloat EyeDirection[4]; /**< spotlight dir in eye coordinates */ + GLfloat SpotDirection[4]; /**< spotlight direction in eye coordinates */ GLfloat SpotExponent; GLfloat SpotCutoff; /**< in degrees */ GLfloat _CosCutoffNeg; /**< = cos(SpotCutoff) */ @@ -479,7 +479,7 @@ struct gl_light GLfloat _Position[4]; /**< position in eye/obj coordinates */ GLfloat _VP_inf_norm[3]; /**< Norm direction to infinite light */ GLfloat _h_inf_norm[3]; /**< Norm( _VP_inf_norm + <0,0,1> ) */ - GLfloat _NormDirection[4]; /**< normalized spotlight direction */ + GLfloat _NormSpotDirection[4]; /**< normalized spotlight direction */ GLfloat _VP_inf_spot_attenuation; GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /**< to replace a pow() call */ diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index b93e987f043..37a3f1fc8ca 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -112,7 +112,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[3] = ctx->Light.Light[ln].SpotExponent; return; case STATE_SPOT_DIRECTION: - COPY_3V(value, ctx->Light.Light[ln].EyeDirection); + COPY_3V(value, ctx->Light.Light[ln].SpotDirection); value[3] = ctx->Light.Light[ln]._CosCutoff; return; case STATE_SPOT_CUTOFF: @@ -449,7 +449,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], /* here, state[2] is the light number */ /* pre-normalize spot dir */ const GLuint ln = (GLuint) state[2]; - COPY_3V(value, ctx->Light.Light[ln]._NormDirection); + COPY_3V(value, ctx->Light.Light[ln]._NormSpotDirection); value[3] = ctx->Light.Light[ln]._CosCutoff; } return; diff --git a/src/mesa/tnl/t_rasterpos.c b/src/mesa/tnl/t_rasterpos.c index 04fb1d8f8c2..f1fdddf0f5a 100644 --- a/src/mesa/tnl/t_rasterpos.c +++ b/src/mesa/tnl/t_rasterpos.c @@ -167,7 +167,7 @@ shade_rastpos(GLcontext *ctx, light->QuadraticAttenuation)); if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection); if (PV_dot_dir_CosCutoff) { continue; diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h index a78f27761f5..124ca3c74fe 100644 --- a/src/mesa/tnl/t_vb_lighttmp.h +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -141,7 +141,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection); if (PV_dot_dir_CosCutoff) { continue; /* this light makes no contribution */ @@ -325,7 +325,7 @@ static void TAG(light_rgba)( GLcontext *ctx, /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection); if (PV_dot_dir_CosCutoff) { continue; /* this light makes no contribution */ @@ -721,7 +721,7 @@ static void TAG(light_ci)( GLcontext *ctx, /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection); if (PV_dot_dir < light->_CosCutoff) { continue; /* this light makes no contribution */ } diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index 8c690b4f882..d56b701aa8c 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -197,7 +197,7 @@ int main( int argc, char **argv ) OFFSET( "LIGHT_DIFFUSE ", struct gl_light, Diffuse ); OFFSET( "LIGHT_SPECULAR ", struct gl_light, Specular ); OFFSET( "LIGHT_EYE_POSITION ", struct gl_light, EyePosition ); - OFFSET( "LIGHT_EYE_DIRECTION ", struct gl_light, EyeDirection ); + OFFSET( "LIGHT_SPOT_DIRECTION ", struct gl_light, SpotDirection ); OFFSET( "LIGHT_SPOT_EXPONENT ", struct gl_light, SpotExponent ); OFFSET( "LIGHT_SPOT_CUTOFF ", struct gl_light, SpotCutoff ); OFFSET( "LIGHT_COS_CUTOFF ", struct gl_light, _CosCutoff ); @@ -211,7 +211,7 @@ int main( int argc, char **argv ) OFFSET( "LIGHT_POSITION ", struct gl_light, _Position ); OFFSET( "LIGHT_VP_INF_NORM ", struct gl_light, _VP_inf_norm ); OFFSET( "LIGHT_H_INF_NORM ", struct gl_light, _h_inf_norm ); - OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormDirection ); + OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormSpotDirection ); OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation ); printf( "\n" ); OFFSET( "LIGHT_SPOT_EXP_TABLE ", struct gl_light, _SpotExpTable ); -- cgit v1.2.3 From a7b6a28b0c2bac9cbafb193923e3bc84855369d3 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 3 Apr 2009 18:53:16 +0200 Subject: python/regress: Use A8R8G8B8 rendertarget format. --- .../state_trackers/python/tests/regress/vertex-shader/vertex-shader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 6a927f59575..99fe7877389 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -112,7 +112,7 @@ def test(dev, name): # framebuffer cbuf = dev.texture_create( - PIPE_FORMAT_X8R8G8B8_UNORM, + PIPE_FORMAT_A8R8G8B8_UNORM, width, height, tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, ).get_surface() -- cgit v1.2.3 From b8a200ac9d11c09646de9b7d3f3f64a742c6abe3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 10:29:11 -0600 Subject: mesa: for OPCODE_LIT, use _mesa_pow() instead of exp() and log() Also, s/pow/_mesa_pow/ --- src/mesa/shader/prog_execute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 0bc8d5f6a79..bdac1d4f8a6 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -836,7 +836,7 @@ _mesa_execute_program(GLcontext * ctx, * result.z = result.x * APPX(result.y) * We do what the ARB extension says. */ - q[2] = (GLfloat) pow(2.0, t[0]); + q[2] = (GLfloat) _mesa_pow(2.0, t[0]); } q[1] = t[0] - floor_t0; q[3] = 1.0F; @@ -949,7 +949,7 @@ _mesa_execute_program(GLcontext * ctx, if (a[1] == 0.0 && a[3] == 0.0) result[2] = 1.0; else - result[2] = EXPF(a[3] * LOGF(a[1])); + result[2] = (GLfloat) _mesa_pow(a[1], a[3]); } else { result[2] = 0.0; -- cgit v1.2.3 From ce461ffc5aa2ea6941d6722e8ed473cda8c17833 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 12:49:03 -0600 Subject: mesa: only clear matrix MAT_DIRTY_INVERSE flag when we actually compute the inverse If _math_matrix_analyse() got called before we allocated the inverse matrix array we could lose the flag indicating that we needed to compute the inverse. This could happen with certain vertex shader cases. --- src/mesa/math/m_matrix.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index 58cae88b08b..da6956efed5 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -1379,11 +1379,10 @@ _math_matrix_analyse( GLmatrix *mat ) if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) { matrix_invert( mat ); + mat->flags &= ~MAT_DIRTY_INVERSE; } - mat->flags &= ~(MAT_DIRTY_FLAGS| - MAT_DIRTY_TYPE| - MAT_DIRTY_INVERSE); + mat->flags &= ~(MAT_DIRTY_FLAGS | MAT_DIRTY_TYPE); } /*@}*/ -- cgit v1.2.3 From a4173956ebcc224b5a0d76bace07b87bdf8bed03 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 13:48:43 -0600 Subject: mesa: replace >= with > when testing if we've exceeded max local params Now a program that uses 256 locals works as it should. --- src/mesa/shader/arbprogparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index a4d0fc3efc8..6ef09fd91b0 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1929,10 +1929,10 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, /* Make sure we haven't blown past our parameter limits */ if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && - (Program->Base.NumParameters >= + (Program->Base.NumParameters > ctx->Const.VertexProgram.MaxLocalParams)) || ((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) - && (Program->Base.NumParameters >= + && (Program->Base.NumParameters > ctx->Const.FragmentProgram.MaxLocalParams))) { program_error(ctx, Program->Position, "Too many parameter variables"); return 1; -- cgit v1.2.3 From 866bdd0509f665446b0fa8c29aa61c25e4be4732 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 15:41:10 -0600 Subject: mesa: fix parameter counting in ARB vertex/fragment program parsing Duplicated unnamed constants were getting counted more than once. --- src/mesa/shader/arbprogparse.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 6ef09fd91b0..35253daa2e6 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1840,7 +1840,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; param_var->param_binding_length++; - Program->Base.NumParameters++; } } else { @@ -1849,7 +1848,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; param_var->param_binding_length++; - Program->Base.NumParameters++; } break; @@ -1860,7 +1858,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; param_var->param_binding_length++; - Program->Base.NumParameters++; /* Check if there is more: 0 -> we're done, else its an integer */ if (**inst) { @@ -1896,7 +1893,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, idx = _mesa_add_state_reference(Program->Base.Parameters, state_tokens); param_var->param_binding_length++; - Program->Base.NumParameters++; } } else { @@ -1918,7 +1914,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, * instruction register type appropriately. */ param_var->param_binding_length++; - Program->Base.NumParameters++; break; default: @@ -1927,6 +1922,8 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, return 1; } + Program->Base.NumParameters = Program->Base.Parameters->NumParameters; + /* Make sure we haven't blown past our parameter limits */ if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && (Program->Base.NumParameters > -- cgit v1.2.3 From 80197a0c1bec48e3731bca975ec451d96f35f62a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 15:42:14 -0600 Subject: mesa: in mesa_add_named_constant(), avoid adding duplicate constants --- src/mesa/shader/prog_parameter.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 66edae9001d..e9ed3985ee2 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -178,15 +178,20 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList, const char *name, const GLfloat values[4], GLuint size) { -#if 0 /* disable this for now -- we need to save the name! */ + /* first check if this is a duplicate constant */ GLint pos; - GLuint swizzle; - ASSERT(size == 4); /* XXX future feature */ - /* check if we already have this constant */ - if (_mesa_lookup_parameter_constant(paramList, values, 4, &pos, &swizzle)) { - return pos; + for (pos = 0; pos < paramList->NumParameters; pos++) { + const GLfloat *pvals = paramList->ParameterValues[pos]; + if (pvals[0] == values[0] && + pvals[1] == values[1] && + pvals[2] == values[2] && + pvals[3] == values[3] && + _mesa_strcmp(paramList->Parameters[pos].Name, name) == 0) { + /* Same name and value is already in the param list - reuse it */ + return pos; + } } -#endif + /* not found, add new parameter */ return _mesa_add_parameter(paramList, PROGRAM_CONSTANT, name, size, GL_NONE, values, NULL, 0x0); } -- cgit v1.2.3 From 5d3b1494b699184ba9363ee199490104048e9a2c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 15:43:13 -0600 Subject: softpipe: add additional surface formats in tile cache code --- src/gallium/drivers/softpipe/sp_tile_cache.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 69292753f13..fd1097f41c9 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -608,18 +608,21 @@ sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue) switch (tc->transfer->format) { case PIPE_FORMAT_R8G8B8A8_UNORM: + case PIPE_FORMAT_R8G8B8X8_UNORM: r = (clearValue >> 24) & 0xff; g = (clearValue >> 16) & 0xff; b = (clearValue >> 8) & 0xff; a = (clearValue ) & 0xff; break; case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_X8R8G8B8_UNORM: r = (clearValue >> 16) & 0xff; g = (clearValue >> 8) & 0xff; b = (clearValue ) & 0xff; a = (clearValue >> 24) & 0xff; break; case PIPE_FORMAT_B8G8R8A8_UNORM: + case PIPE_FORMAT_B8G8R8X8_UNORM: r = (clearValue >> 8) & 0xff; g = (clearValue >> 16) & 0xff; b = (clearValue >> 24) & 0xff; -- cgit v1.2.3 From a5ce781282b674002379d699a7f2e1ebf3a46df1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 16:37:36 -0600 Subject: mesa: remove extra semicolons --- src/mesa/main/texformat_tmp.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index d0d38046082..ef5bb34db6a 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1112,7 +1112,7 @@ static void FETCH(f_ci8)( const struct gl_texture_image *texImage, texel[GCOMP] = texel[BCOMP] = 0.0F; texel[ACOMP] = table[index]; - break;; + break; case GL_LUMINANCE: texel[RCOMP] = texel[GCOMP] = @@ -1124,25 +1124,25 @@ static void FETCH(f_ci8)( const struct gl_texture_image *texImage, texel[GCOMP] = texel[BCOMP] = texel[ACOMP] = table[index]; - break;; + break; case GL_LUMINANCE_ALPHA: texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = table[index * 2 + 0]; texel[ACOMP] = table[index * 2 + 1]; - break;; + break; case GL_RGB: texel[RCOMP] = table[index * 3 + 0]; texel[GCOMP] = table[index * 3 + 1]; texel[BCOMP] = table[index * 3 + 2]; texel[ACOMP] = 1.0F; - break;; + break; case GL_RGBA: texel[RCOMP] = table[index * 4 + 0]; texel[GCOMP] = table[index * 4 + 1]; texel[BCOMP] = table[index * 4 + 2]; texel[ACOMP] = table[index * 4 + 3]; - break;; + break; default: _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8"); return; -- cgit v1.2.3 From b7cb6650c1603cd9e6f26b32f5e0fae8377d59b8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 16:51:04 -0600 Subject: mesa: whitespace and comment clean-up --- src/mesa/main/texstore.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index a94df532c64..c65b9a99d8c 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3940,21 +3940,26 @@ linear_to_nonlinear(GLfloat cl) #endif /* FEATURE_EXT_texture_sRGB */ + +/** + * Can the given type represent negative values? + */ static INLINE GLboolean type_with_negative_values(GLenum type) { - switch (type) { - case GL_BYTE: - case GL_SHORT: - case GL_INT: - case GL_FLOAT: - case GL_HALF_FLOAT_ARB: - return GL_TRUE; + switch (type) { + case GL_BYTE: + case GL_SHORT: + case GL_INT: + case GL_FLOAT: + case GL_HALF_FLOAT_ARB: + return GL_TRUE; default: return GL_FALSE; - } + } } + /** * This is the software fallback for Driver.GetTexImage(). * All error checking will have been done before this routine is called. @@ -4107,9 +4112,9 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, GLbitfield transferOps = 0x0; /* clamp does not apply to GetTexImage (final conversion)? - Looks like we need clamp though when going from format containing - negative values to unsigned format */ - + * Looks like we need clamp though when going from format + * containing negative values to unsigned format. + */ if (!type_with_negative_values(type) && (texImage->TexFormat->DataType == GL_FLOAT || texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED)) -- cgit v1.2.3 From 35d88e1ac2cd34d5cc62f521654d79f5b24fcdf8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 17:10:31 -0600 Subject: mesa: clamp colors to [0,1] for glGetTexImage() when format is GL_LUMINANCE For luminance, we add R+G+B and it seems we should always clamp in case. --- src/mesa/main/texstore.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index c65b9a99d8c..28e9d5c3ecb 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -4115,9 +4115,11 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, * Looks like we need clamp though when going from format * containing negative values to unsigned format. */ - if (!type_with_negative_values(type) && - (texImage->TexFormat->DataType == GL_FLOAT || - texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED)) + if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) + transferOps |= IMAGE_CLAMP_BIT; + else if (!type_with_negative_values(type) && + (texImage->TexFormat->DataType == GL_FLOAT || + texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED)) transferOps |= IMAGE_CLAMP_BIT; for (col = 0; col < width; col++) { @@ -4144,7 +4146,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, } _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, type, dest, - &ctx->Pack, transferOps, GL_TRUE); + &ctx->Pack, transferOps, GL_FALSE); } /* format */ } /* row */ } /* img */ -- cgit v1.2.3 From c7eb423c49ef3e0e071deaab04dad55254f2fa30 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 17:28:35 -0600 Subject: mesa: remove the noClamp parameter to _mesa_pack_rgba_span_float() It was only set to GL_TRUE in one place where it isn't really needed (glGetTexImage(sRGB format)). --- src/mesa/main/colortab.c | 2 +- src/mesa/main/convolve.c | 6 +++--- src/mesa/main/histogram.c | 2 +- src/mesa/main/image.c | 9 ++++++--- src/mesa/main/image.h | 2 +- src/mesa/main/texstore.c | 6 +++--- src/mesa/state_tracker/st_cb_readpixels.c | 2 +- src/mesa/swrast/s_readpix.c | 4 ++-- 8 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index b05c0513aa6..bd9cf438b4f 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -718,7 +718,7 @@ _mesa_GetColorTable( GLenum target, GLenum format, } _mesa_pack_rgba_span_float(ctx, table->Size, rgba, - format, type, data, &ctx->Pack, 0x0, GL_FALSE); + format, type, data, &ctx->Pack, 0x0); if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index 63b652bf705..814c6a0a5a6 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -626,7 +626,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, row, 0); GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + row * filter->Width * 4); _mesa_pack_rgba_span_float(ctx, filter->Width, src, - format, type, dst, &ctx->Pack, 0x0, GL_FALSE); + format, type, dst, &ctx->Pack, 0x0); } if (ctx->Pack.BufferObj->Name) { @@ -836,7 +836,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, format, type, 0); _mesa_pack_rgba_span_float(ctx, filter->Width, (GLfloat (*)[4]) filter->Filter, - format, type, dst, &ctx->Pack, 0x0, GL_FALSE); + format, type, dst, &ctx->Pack, 0x0); } /* Column filter */ @@ -845,7 +845,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, format, type, 0); GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + colStart); _mesa_pack_rgba_span_float(ctx, filter->Height, src, - format, type, dst, &ctx->Pack, 0x0, GL_FALSE); + format, type, dst, &ctx->Pack, 0x0); } (void) span; /* unused at this time */ diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index febf8d99c45..905c1ad8301 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -684,7 +684,7 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F); minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F); _mesa_pack_rgba_span_float(ctx, 2, minmax, - format, type, values, &ctx->Pack, 0x0, GL_FALSE); + format, type, values, &ctx->Pack, 0x0); } if (ctx->Pack.BufferObj->Name) { diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 44972ae8e2c..5cb110f3a5d 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1677,7 +1677,6 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n, * Used to pack an array [][4] of RGBA float colors as specified * by the dstFormat, dstType and dstPacking. Used by glReadPixels, * glGetConvolutionFilter(), etc. - * Incoming colors will be clamped to [0,1] if needed. * Note: the rgba values will be modified by this function when any pixel * transfer ops are enabled. */ @@ -1686,13 +1685,17 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, - GLbitfield transferOps, GLboolean noClamp) + GLbitfield transferOps) { GLfloat luminance[MAX_WIDTH]; const GLint comps = _mesa_components_in_format(dstFormat); GLuint i; - if ((!noClamp) && (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE)) { + /* XXX + * This test should probably go away. Have the caller set/clear the + * IMAGE_CLAMP_BIT as needed. + */ + if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) { /* need to clamp to [0, 1] */ transferOps |= IMAGE_CLAMP_BIT; } diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h index fb7a5c0e903..b26c27e5a8a 100644 --- a/src/mesa/main/image.h +++ b/src/mesa/main/image.h @@ -178,7 +178,7 @@ extern void _mesa_pack_rgba_span_float( GLcontext *ctx, GLuint n, GLfloat rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, - GLbitfield transferOps, GLboolean noClamp ); + GLbitfield transferOps ); extern void diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 28e9d5c3ecb..bde69b11485 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -417,7 +417,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, (GLfloat (*)[4]) src, logicalBaseFormat, GL_FLOAT, dst, &ctx->DefaultPacking, - postConvTransferOps, GL_FALSE); + postConvTransferOps); src += convWidth * 4; dst += convWidth * logComponents; } @@ -4102,7 +4102,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, } _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, type, dest, - &ctx->Pack, transferOps, GL_TRUE); + &ctx->Pack, transferOps); } #endif /* FEATURE_EXT_texture_sRGB */ else { @@ -4146,7 +4146,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, } _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, type, dest, - &ctx->Pack, transferOps, GL_FALSE); + &ctx->Pack, transferOps); } /* format */ } /* row */ } /* img */ diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index c11973cdb3d..ce7a8cda4e8 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -486,7 +486,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, df += dfStride; if (!dfStride) { _mesa_pack_rgba_span_float(ctx, width, temp, format, type, dst, - &clippedPacking, transferOps, GL_FALSE); + &clippedPacking, transferOps); dst += dstStride; } } diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 524ac4ee219..e901fc6b5dc 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -396,7 +396,7 @@ read_rgba_pixels( GLcontext *ctx, format, type, row, 0); _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) src, format, type, dest, packing, - transferOps & IMAGE_POST_CONVOLUTION_BITS, GL_FALSE); + transferOps & IMAGE_POST_CONVOLUTION_BITS); src += width * 4; } _mesa_free(convImage); @@ -441,7 +441,7 @@ read_rgba_pixels( GLcontext *ctx, /* pack the row of RGBA pixels into user's buffer */ _mesa_pack_rgba_span_float(ctx, width, rgba, format, type, dst, - packing, transferOps, GL_FALSE); + packing, transferOps); dst += dstStride; } -- cgit v1.2.3 From a4bec69e7271eda0137874973aa8c7d44175fedf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 17:42:22 -0600 Subject: mesa: move glGetTexImage(), glGetCompresssedTexImage() code into new file --- src/mesa/SConscript | 1 + src/mesa/drivers/common/driverfuncs.c | 1 + src/mesa/main/sources | 1 + src/mesa/main/texgetimage.c | 356 +++++++++++++++++++++++++++++++++ src/mesa/main/texgetimage.h | 46 +++++ src/mesa/main/texstore.c | 324 +----------------------------- src/mesa/main/texstore.h | 13 -- src/mesa/sources.mak | 1 + src/mesa/state_tracker/st_cb_texture.c | 1 + 9 files changed, 409 insertions(+), 335 deletions(-) create mode 100644 src/mesa/main/texgetimage.c create mode 100644 src/mesa/main/texgetimage.h diff --git a/src/mesa/SConscript b/src/mesa/SConscript index d1b9e93c0c7..9ffc15eeb7b 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -91,6 +91,7 @@ if env['platform'] != 'winddk': 'main/texenvprogram.c', 'main/texformat.c', 'main/texgen.c', + 'main/texgetimage.c', 'main/teximage.c', 'main/texobj.c', 'main/texparam.c', diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 44adaf86828..276da41f4e4 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -34,6 +34,7 @@ #include "main/renderbuffer.h" #include "main/texcompress.h" #include "main/texformat.h" +#include "main/texgetimage.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/texstore.h" diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 4e58702c746..5d9d99040ed 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -63,6 +63,7 @@ texenv.c \ texenvprogram.c \ texformat.c \ texgen.c \ +texgetimage.c \ teximage.c \ texobj.c \ texparam.c \ diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c new file mode 100644 index 00000000000..70a25080cb0 --- /dev/null +++ b/src/mesa/main/texgetimage.c @@ -0,0 +1,356 @@ +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (c) 2009 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Code for glGetTexImage() and glGetCompressedTexImage(). + */ + + +#include "glheader.h" +#include "context.h" +#include "image.h" +#include "texcompress.h" +#include "texformat.h" +#include "texgetimage.h" + + + +#if FEATURE_EXT_texture_sRGB + +/** + * Test if given texture image is an sRGB format. + */ +static GLboolean +is_srgb_teximage(const struct gl_texture_image *texImage) +{ + switch (texImage->TexFormat->MesaFormat) { + case MESA_FORMAT_SRGB8: + case MESA_FORMAT_SRGBA8: + case MESA_FORMAT_SARGB8: + case MESA_FORMAT_SL8: + case MESA_FORMAT_SLA8: + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/** + * Convert a float value from linear space to a + * non-linear sRGB value in [0, 255]. + * Not terribly efficient. + */ +static INLINE GLfloat +linear_to_nonlinear(GLfloat cl) +{ + /* can't have values outside [0, 1] */ + GLfloat cs; + if (cl < 0.0031308) { + cs = 12.92 * cl; + } + else { + cs = 1.055 * _mesa_pow(cl, 0.41666) - 0.055; + } + return cs; +} + +#endif /* FEATURE_EXT_texture_sRGB */ + + +/** + * Can the given type represent negative values? + */ +static INLINE GLboolean +type_with_negative_values(GLenum type) +{ + switch (type) { + case GL_BYTE: + case GL_SHORT: + case GL_INT: + case GL_FLOAT: + case GL_HALF_FLOAT_ARB: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/** + * This is the software fallback for Driver.GetTexImage(). + * All error checking will have been done before this routine is called. + */ +void +_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2; + + if (ctx->Pack.BufferObj->Name) { + /* Packing texture image into a PBO. + * Map the (potentially) VRAM-based buffer into our process space so + * we can write into it with the code below. + * A hardware driver might use a sophisticated blit to move the + * texture data to the PBO if the PBO is in VRAM along with the texture. + */ + GLubyte *buf = (GLubyte *) + ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION,"glGetTexImage(PBO is mapped)"); + return; + } + /* was an offset into the PBO. + * Now make it a real, client-side pointer inside the mapped region. + */ + pixels = ADD_POINTERS(buf, pixels); + } + else if (!pixels) { + /* not an error */ + return; + } + + { + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + GLint img, row; + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + /* compute destination address in client memory */ + GLvoid *dest = _mesa_image_address( dimensions, &ctx->Pack, pixels, + width, height, format, type, + img, row, 0); + assert(dest); + + if (format == GL_COLOR_INDEX) { + GLuint indexRow[MAX_WIDTH]; + GLint col; + /* Can't use FetchTexel here because that returns RGBA */ + if (texImage->TexFormat->IndexBits == 8) { + const GLubyte *src = (const GLubyte *) texImage->Data; + src += width * (img * texImage->Height + row); + for (col = 0; col < width; col++) { + indexRow[col] = src[col]; + } + } + else if (texImage->TexFormat->IndexBits == 16) { + const GLushort *src = (const GLushort *) texImage->Data; + src += width * (img * texImage->Height + row); + for (col = 0; col < width; col++) { + indexRow[col] = src[col]; + } + } + else { + _mesa_problem(ctx, + "Color index problem in _mesa_GetTexImage"); + } + _mesa_pack_index_span(ctx, width, type, dest, + indexRow, &ctx->Pack, + 0 /* no image transfer */); + } + else if (format == GL_DEPTH_COMPONENT) { + GLfloat depthRow[MAX_WIDTH]; + GLint col; + for (col = 0; col < width; col++) { + (*texImage->FetchTexelf)(texImage, col, row, img, + depthRow + col); + } + _mesa_pack_depth_span(ctx, width, dest, type, + depthRow, &ctx->Pack); + } + else if (format == GL_DEPTH_STENCIL_EXT) { + /* XXX Note: we're bypassing texImage->FetchTexel()! */ + const GLuint *src = (const GLuint *) texImage->Data; + src += width * row + width * height * img; + _mesa_memcpy(dest, src, width * sizeof(GLuint)); + if (ctx->Pack.SwapBytes) { + _mesa_swap4((GLuint *) dest, width); + } + } + else if (format == GL_YCBCR_MESA) { + /* No pixel transfer */ + const GLint rowstride = texImage->RowStride; + MEMCPY(dest, + (const GLushort *) texImage->Data + row * rowstride, + width * sizeof(GLushort)); + /* check for byte swapping */ + if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR + && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || + (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV + && type == GL_UNSIGNED_SHORT_8_8_MESA)) { + if (!ctx->Pack.SwapBytes) + _mesa_swap2((GLushort *) dest, width); + } + else if (ctx->Pack.SwapBytes) { + _mesa_swap2((GLushort *) dest, width); + } + } +#if FEATURE_EXT_texture_sRGB + else if (is_srgb_teximage(texImage)) { + /* special case this since need to backconvert values */ + /* convert row to RGBA format */ + GLfloat rgba[MAX_WIDTH][4]; + GLint col; + GLbitfield transferOps = 0x0; + + for (col = 0; col < width; col++) { + (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); + if (texImage->_BaseFormat == GL_LUMINANCE) { + rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + } + else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) { + rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + } + else if (texImage->_BaseFormat == GL_RGB || + texImage->_BaseFormat == GL_RGBA) { + rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); + rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]); + rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]); + } + } + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, + format, type, dest, + &ctx->Pack, transferOps); + } +#endif /* FEATURE_EXT_texture_sRGB */ + else { + /* general case: convert row to RGBA format */ + GLfloat rgba[MAX_WIDTH][4]; + GLint col; + GLbitfield transferOps = 0x0; + + /* clamp does not apply to GetTexImage (final conversion)? + * Looks like we need clamp though when going from format + * containing negative values to unsigned format. + */ + if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) + transferOps |= IMAGE_CLAMP_BIT; + else if (!type_with_negative_values(type) && + (texImage->TexFormat->DataType == GL_FLOAT || + texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED)) + transferOps |= IMAGE_CLAMP_BIT; + + for (col = 0; col < width; col++) { + (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); + if (texImage->_BaseFormat == GL_ALPHA) { + rgba[col][RCOMP] = 0.0; + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + } + else if (texImage->_BaseFormat == GL_LUMINANCE) { + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + rgba[col][ACOMP] = 1.0; + } + else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) { + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + } + else if (texImage->_BaseFormat == GL_INTENSITY) { + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + rgba[col][ACOMP] = 1.0; + } + } + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, + format, type, dest, + &ctx->Pack, transferOps); + } /* format */ + } /* row */ + } /* img */ + } + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } +} + + + +/** + * This is the software fallback for Driver.GetCompressedTexImage(). + * All error checking will have been done before this routine is called. + */ +void +_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, + GLvoid *img, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + GLuint size; + + if (ctx->Pack.BufferObj->Name) { + /* pack texture image into a PBO */ + GLubyte *buf; + if ((const GLubyte *) img + texImage->CompressedSize > + (const GLubyte *) ctx->Pack.BufferObj->Size) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetCompressedTexImage(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetCompressedTexImage(PBO is mapped)"); + return; + } + img = ADD_POINTERS(buf, img); + } + else if (!img) { + /* not an error */ + return; + } + + /* don't use texImage->CompressedSize since that may be padded out */ + size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height, + texImage->Depth, + texImage->TexFormat->MesaFormat); + + /* just memcpy, no pixelstore or pixel transfer */ + _mesa_memcpy(img, texImage->Data, size); + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } +} diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h new file mode 100644 index 00000000000..01f486e8f02 --- /dev/null +++ b/src/mesa/main/texgetimage.h @@ -0,0 +1,46 @@ +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (c) 2009 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef TEXGETIMAGE_H +#define TEXGETIMAGE_H + + +extern void +_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + + +extern void +_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, + GLvoid *img, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + + + +#endif /* TEXGETIMAGE_H */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index bde69b11485..f3739f950b0 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.3 + * Version: 7.5 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (c) 2008 VMware, Inc. + * Copyright (c) 2008-2009 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -3890,323 +3890,3 @@ _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, (void) texObj; (void) texImage; } - - - - -#if FEATURE_EXT_texture_sRGB - -/** - * Test if given texture image is an sRGB format. - */ -static GLboolean -is_srgb_teximage(const struct gl_texture_image *texImage) -{ - switch (texImage->TexFormat->MesaFormat) { - case MESA_FORMAT_SRGB8: - case MESA_FORMAT_SRGBA8: - case MESA_FORMAT_SARGB8: - case MESA_FORMAT_SL8: - case MESA_FORMAT_SLA8: - case MESA_FORMAT_SRGB_DXT1: - case MESA_FORMAT_SRGBA_DXT1: - case MESA_FORMAT_SRGBA_DXT3: - case MESA_FORMAT_SRGBA_DXT5: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * Convert a float value from linear space to a - * non-linear sRGB value in [0, 255]. - * Not terribly efficient. - */ -static INLINE GLfloat -linear_to_nonlinear(GLfloat cl) -{ - /* can't have values outside [0, 1] */ - GLfloat cs; - if (cl < 0.0031308) { - cs = 12.92 * cl; - } - else { - cs = 1.055 * _mesa_pow(cl, 0.41666) - 0.055; - } - return cs; -} - -#endif /* FEATURE_EXT_texture_sRGB */ - - -/** - * Can the given type represent negative values? - */ -static INLINE GLboolean -type_with_negative_values(GLenum type) -{ - switch (type) { - case GL_BYTE: - case GL_SHORT: - case GL_INT: - case GL_FLOAT: - case GL_HALF_FLOAT_ARB: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * This is the software fallback for Driver.GetTexImage(). - * All error checking will have been done before this routine is called. - */ -void -_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, - GLenum format, GLenum type, GLvoid *pixels, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) -{ - const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2; - - if (ctx->Pack.BufferObj->Name) { - /* Packing texture image into a PBO. - * Map the (potentially) VRAM-based buffer into our process space so - * we can write into it with the code below. - * A hardware driver might use a sophisticated blit to move the - * texture data to the PBO if the PBO is in VRAM along with the texture. - */ - GLubyte *buf = (GLubyte *) - ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION,"glGetTexImage(PBO is mapped)"); - return; - } - /* was an offset into the PBO. - * Now make it a real, client-side pointer inside the mapped region. - */ - pixels = ADD_POINTERS(buf, pixels); - } - else if (!pixels) { - /* not an error */ - return; - } - - { - const GLint width = texImage->Width; - const GLint height = texImage->Height; - const GLint depth = texImage->Depth; - GLint img, row; - for (img = 0; img < depth; img++) { - for (row = 0; row < height; row++) { - /* compute destination address in client memory */ - GLvoid *dest = _mesa_image_address( dimensions, &ctx->Pack, pixels, - width, height, format, type, - img, row, 0); - assert(dest); - - if (format == GL_COLOR_INDEX) { - GLuint indexRow[MAX_WIDTH]; - GLint col; - /* Can't use FetchTexel here because that returns RGBA */ - if (texImage->TexFormat->IndexBits == 8) { - const GLubyte *src = (const GLubyte *) texImage->Data; - src += width * (img * texImage->Height + row); - for (col = 0; col < width; col++) { - indexRow[col] = src[col]; - } - } - else if (texImage->TexFormat->IndexBits == 16) { - const GLushort *src = (const GLushort *) texImage->Data; - src += width * (img * texImage->Height + row); - for (col = 0; col < width; col++) { - indexRow[col] = src[col]; - } - } - else { - _mesa_problem(ctx, - "Color index problem in _mesa_GetTexImage"); - } - _mesa_pack_index_span(ctx, width, type, dest, - indexRow, &ctx->Pack, - 0 /* no image transfer */); - } - else if (format == GL_DEPTH_COMPONENT) { - GLfloat depthRow[MAX_WIDTH]; - GLint col; - for (col = 0; col < width; col++) { - (*texImage->FetchTexelf)(texImage, col, row, img, - depthRow + col); - } - _mesa_pack_depth_span(ctx, width, dest, type, - depthRow, &ctx->Pack); - } - else if (format == GL_DEPTH_STENCIL_EXT) { - /* XXX Note: we're bypassing texImage->FetchTexel()! */ - const GLuint *src = (const GLuint *) texImage->Data; - src += width * row + width * height * img; - _mesa_memcpy(dest, src, width * sizeof(GLuint)); - if (ctx->Pack.SwapBytes) { - _mesa_swap4((GLuint *) dest, width); - } - } - else if (format == GL_YCBCR_MESA) { - /* No pixel transfer */ - const GLint rowstride = texImage->RowStride; - MEMCPY(dest, - (const GLushort *) texImage->Data + row * rowstride, - width * sizeof(GLushort)); - /* check for byte swapping */ - if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR - && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || - (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV - && type == GL_UNSIGNED_SHORT_8_8_MESA)) { - if (!ctx->Pack.SwapBytes) - _mesa_swap2((GLushort *) dest, width); - } - else if (ctx->Pack.SwapBytes) { - _mesa_swap2((GLushort *) dest, width); - } - } -#if FEATURE_EXT_texture_sRGB - else if (is_srgb_teximage(texImage)) { - /* special case this since need to backconvert values */ - /* convert row to RGBA format */ - GLfloat rgba[MAX_WIDTH][4]; - GLint col; - GLbitfield transferOps = 0x0; - - for (col = 0; col < width; col++) { - (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); - if (texImage->_BaseFormat == GL_LUMINANCE) { - rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); - rgba[col][GCOMP] = 0.0; - rgba[col][BCOMP] = 0.0; - } - else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) { - rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); - rgba[col][GCOMP] = 0.0; - rgba[col][BCOMP] = 0.0; - } - else if (texImage->_BaseFormat == GL_RGB || - texImage->_BaseFormat == GL_RGBA) { - rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); - rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]); - rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]); - } - } - _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, - format, type, dest, - &ctx->Pack, transferOps); - } -#endif /* FEATURE_EXT_texture_sRGB */ - else { - /* general case: convert row to RGBA format */ - GLfloat rgba[MAX_WIDTH][4]; - GLint col; - GLbitfield transferOps = 0x0; - - /* clamp does not apply to GetTexImage (final conversion)? - * Looks like we need clamp though when going from format - * containing negative values to unsigned format. - */ - if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) - transferOps |= IMAGE_CLAMP_BIT; - else if (!type_with_negative_values(type) && - (texImage->TexFormat->DataType == GL_FLOAT || - texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED)) - transferOps |= IMAGE_CLAMP_BIT; - - for (col = 0; col < width; col++) { - (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); - if (texImage->_BaseFormat == GL_ALPHA) { - rgba[col][RCOMP] = 0.0; - rgba[col][GCOMP] = 0.0; - rgba[col][BCOMP] = 0.0; - } - else if (texImage->_BaseFormat == GL_LUMINANCE) { - rgba[col][GCOMP] = 0.0; - rgba[col][BCOMP] = 0.0; - rgba[col][ACOMP] = 1.0; - } - else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) { - rgba[col][GCOMP] = 0.0; - rgba[col][BCOMP] = 0.0; - } - else if (texImage->_BaseFormat == GL_INTENSITY) { - rgba[col][GCOMP] = 0.0; - rgba[col][BCOMP] = 0.0; - rgba[col][ACOMP] = 1.0; - } - } - _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, - format, type, dest, - &ctx->Pack, transferOps); - } /* format */ - } /* row */ - } /* img */ - } - - if (ctx->Pack.BufferObj->Name) { - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - ctx->Pack.BufferObj); - } -} - - - -/** - * This is the software fallback for Driver.GetCompressedTexImage(). - * All error checking will have been done before this routine is called. - */ -void -_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, - GLvoid *img, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) -{ - GLuint size; - - if (ctx->Pack.BufferObj->Name) { - /* pack texture image into a PBO */ - GLubyte *buf; - if ((const GLubyte *) img + texImage->CompressedSize > - (const GLubyte *) ctx->Pack.BufferObj->Size) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetCompressedTexImage(invalid PBO access)"); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - GL_WRITE_ONLY_ARB, - ctx->Pack.BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetCompressedTexImage(PBO is mapped)"); - return; - } - img = ADD_POINTERS(buf, img); - } - else if (!img) { - /* not an error */ - return; - } - - /* don't use texImage->CompressedSize since that may be padded out */ - size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height, - texImage->Depth, - texImage->TexFormat->MesaFormat); - - /* just memcpy, no pixelstore or pixel transfer */ - _mesa_memcpy(img, texImage->Data, size); - - if (ctx->Pack.BufferObj->Name) { - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - ctx->Pack.BufferObj); - } -} diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 91cb64f377a..313f2d6a598 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -210,19 +210,6 @@ _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, struct gl_texture_image *texImage); -extern void -_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, - GLenum format, GLenum type, GLvoid *pixels, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - - -extern void -_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, - GLvoid *img, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - extern const GLvoid * _mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 6913d9f40fd..78ca60f3ca9 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -68,6 +68,7 @@ MAIN_SOURCES = \ main/texenvprogram.c \ main/texformat.c \ main/texgen.c \ + main/texgetimage.c \ main/teximage.c \ main/texobj.c \ main/texparam.c \ diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index d353241a7eb..4d8adcd9cd6 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -37,6 +37,7 @@ #include "main/pixel.h" #include "main/texcompress.h" #include "main/texformat.h" +#include "main/texgetimage.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/texstore.h" -- cgit v1.2.3 From 4d363cc16d94b1e356b7cc23bb3b15ca0374d1e3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 17:43:03 -0600 Subject: intel: #include texgetimage.h --- src/mesa/drivers/dri/intel/intel_tex_image.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 61ecabfa680..71561cf85cd 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -12,6 +12,7 @@ #include "main/simple_list.h" #include "main/texcompress.h" #include "main/texformat.h" +#include "main/texgetimage.h" #include "main/texobj.h" #include "main/texstore.h" #include "main/teximage.h" -- cgit v1.2.3 From a7dc04fa73f9879d94ab4abf8fcd6f38ee2e9531 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 00:29:56 -0700 Subject: r300-gallium: r500 surface_copy fragment shader. --- src/gallium/drivers/r300/r300_state_shader.h | 31 +++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index 76f2989fd13..185fdd90f0c 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -187,26 +187,41 @@ static struct r300_fragment_shader r300_texture_fragment_shader = { }; static struct r500_fragment_shader r500_texture_fragment_shader = { - .shader.stack_size = 0, - .instruction_count = 1, - .instructions[0].inst0 = R500_INST_TYPE_OUT | + .shader.stack_size = 1, + .instruction_count = 2, + .instructions[0].inst0 = R500_INST_TYPE_TEX | + R500_INST_TEX_SEM_WAIT | + R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK | + R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP, + .instructions[0].inst1 = R500_TEX_ID(0) | R500_TEX_INST_LD | + R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED, + .instructions[0].inst2 = R500_TEX_SRC_ADDR(0) | + R500_TEX_SRC_S_SWIZ_R | R500_TEX_SRC_T_SWIZ_G | + R500_TEX_SRC_R_SWIZ_B | R500_TEX_SRC_Q_SWIZ_A | + R500_TEX_DST_ADDR(0) | + R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G | + R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A, + .instructions[0].inst3 = 0x0, + .instructions[0].inst4 = 0x0, + .instructions[0].inst5 = 0x0, + .instructions[1].inst0 = R500_INST_TYPE_OUT | R500_INST_TEX_SEM_WAIT | R500_INST_LAST | R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK | R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP, - .instructions[0].inst1 = + .instructions[1].inst1 = R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST | R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST, - .instructions[0].inst2 = + .instructions[1].inst2 = R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST | R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST, - .instructions[0].inst3 = + .instructions[1].inst3 = R500_ALU_RGB_SEL_A_SRC0 | R500_ALU_RGB_R_SWIZ_A_R | R500_ALU_RGB_G_SWIZ_A_G | R500_ALU_RGB_B_SWIZ_A_B | R500_ALU_RGB_SEL_B_SRC0 | R500_ALU_RGB_R_SWIZ_B_R | R500_ALU_RGB_B_SWIZ_B_G | R500_ALU_RGB_G_SWIZ_B_B, - .instructions[0].inst4 = + .instructions[1].inst4 = R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A, - .instructions[0].inst5 = + .instructions[1].inst5 = R500_ALU_RGBA_OP_CMP | R500_ALU_RGBA_R_SWIZ_0 | R500_ALU_RGBA_G_SWIZ_0 | R500_ALU_RGBA_B_SWIZ_0 | R500_ALU_RGBA_A_SWIZ_0, -- cgit v1.2.3 From be1dbba0a4d0d75468461aff8c281a512a537ecc Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 00:31:49 -0700 Subject: r300-gallium: Clean up compile warnings and strict compile errors. --- src/gallium/drivers/r300/r300_emit.c | 20 +++++++++----------- src/gallium/drivers/r300/r300_query.c | 8 ++++---- src/gallium/drivers/r300/r300_state.c | 1 + src/gallium/drivers/r300/r300_surface.c | 12 ++++++------ src/gallium/drivers/r300/r300_surface.h | 6 +++--- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 989fba74df0..0ee32334460 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -82,8 +82,8 @@ void r300_emit_dsa_state(struct r300_context* r300, void r300_emit_fragment_shader(struct r300_context* r300, struct r300_fragment_shader* fs) { - CS_LOCALS(r300); int i; + CS_LOCALS(r300); BEGIN_CS(22); @@ -114,10 +114,10 @@ void r300_emit_fragment_shader(struct r300_context* r300, void r500_emit_fragment_shader(struct r300_context* r300, struct r500_fragment_shader* fs) { - CS_LOCALS(r300); + int i; struct r300_constant_buffer* constants = &r300->shader_constants[PIPE_SHADER_FRAGMENT]; - int i; + CS_LOCALS(r300); BEGIN_CS(9 + (fs->instruction_count * 6) + (constants->count ? 3 : 0) + (constants->count * 4)); @@ -156,9 +156,9 @@ void r500_emit_fragment_shader(struct r300_context* r300, void r300_emit_fb_state(struct r300_context* r300, struct pipe_framebuffer_state* fb) { - CS_LOCALS(r300); - struct r300_texture* tex; int i; + struct r300_texture* tex; + CS_LOCALS(r300); BEGIN_CS((6 * fb->nr_cbufs) + (fb->zsbuf ? 6 : 0) + 4); for (i = 0; i < fb->nr_cbufs; i++) { @@ -217,9 +217,9 @@ 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) { + int i; struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); - int i; BEGIN_CS(21); if (r300screen->caps->is_r500) { @@ -293,8 +293,8 @@ void r300_emit_texture(struct r300_context* r300, void r300_emit_vertex_format_state(struct r300_context* r300) { - CS_LOCALS(r300); int i; + CS_LOCALS(r300); BEGIN_CS(26); OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info.vinfo.size); @@ -328,9 +328,9 @@ void r300_emit_vertex_format_state(struct r300_context* r300) void r300_emit_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs) { - CS_LOCALS(r300); - struct r300_screen* r300screen = r300_screen(r300->context.screen); int i; + struct r300_screen* r300screen = r300_screen(r300->context.screen); + CS_LOCALS(r300); if (!r300screen->caps->has_tcl) { debug_printf("r300: Implementation error: emit_vertex_shader called," @@ -368,8 +368,6 @@ void r300_emit_vertex_shader(struct r300_context* r300, void r300_emit_viewport_state(struct r300_context* r300, struct r300_viewport_state* viewport) { - /* XXX has_tcl */ - return; CS_LOCALS(r300); BEGIN_CS(7); diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 5f5f4c4dbd4..8fc61c2dec7 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -46,12 +46,12 @@ static void r300_destroy_query(struct pipe_context* pipe, static void r300_begin_query(struct pipe_context* pipe, struct pipe_query* query) { + uint32_t* map; struct r300_context* r300 = r300_context(pipe); struct r300_query* q = (struct r300_query*)query; CS_LOCALS(r300); - uint32_t* map = pipe_buffer_map(pipe->screen, q->buf, - PIPE_BUFFER_USAGE_CPU_WRITE); + map = pipe_buffer_map(pipe->screen, q->buf, PIPE_BUFFER_USAGE_CPU_WRITE); *map = ~0; pipe_buffer_unmap(pipe->screen, q->buf); @@ -79,6 +79,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe, uint64_t* result) { struct r300_query* q = (struct r300_query*)query; + uint32_t* map; uint32_t temp; if (wait) { @@ -88,8 +89,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe, pipe->flush(pipe, 0, NULL); } - uint32_t* map = pipe_buffer_map(pipe->screen, q->buf, - PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pipe->screen, q->buf, PIPE_BUFFER_USAGE_CPU_READ); temp = *map; pipe_buffer_unmap(pipe->screen, q->buf); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index c9a20c9e8ac..b1d85260cc1 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -593,6 +593,7 @@ static void* r300_create_vs_state(struct pipe_context* pipe, const struct pipe_shader_state* state) { struct r300_context* context = r300_context(pipe); + tgsi_dump(state->tokens); /* XXX handing this off to Draw for now */ return draw_create_vertex_shader(context->draw, state); } diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index ab0ecac35a4..dc4b29eb40a 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -29,10 +29,10 @@ static void r300_surface_setup(struct pipe_context* pipe, unsigned w, unsigned h) { struct r300_context* r300 = r300_context(pipe); - CS_LOCALS(r300); struct r300_capabilities* caps = r300_screen(pipe->screen)->caps; struct r300_texture* tex = (struct r300_texture*)dest->texture; unsigned pixpitch = tex->stride / tex->tex.block.size; + CS_LOCALS(r300); r300_emit_blend_state(r300, &blend_clear_state); r300_emit_blend_color_state(r300, &blend_color_clear_state); @@ -80,13 +80,13 @@ static void r300_surface_fill(struct pipe_context* pipe, unsigned w, unsigned h, unsigned color) { + int i; + float r, g, b, a, depth; struct r300_context* r300 = r300_context(pipe); - CS_LOCALS(r300); struct r300_capabilities* caps = r300_screen(pipe->screen)->caps; struct r300_texture* tex = (struct r300_texture*)dest->texture; - int i; - float r, g, b, a, depth; unsigned pixpitch = tex->stride / tex->tex.block.size; + CS_LOCALS(r300); a = (float)((color >> 24) & 0xff) / 255.0f; r = (float)((color >> 16) & 0xff) / 255.0f; @@ -201,12 +201,12 @@ static void r300_surface_copy(struct pipe_context* pipe, unsigned w, unsigned h) { struct r300_context* r300 = r300_context(pipe); - CS_LOCALS(r300); struct r300_capabilities* caps = r300_screen(pipe->screen)->caps; struct r300_texture* srctex = (struct r300_texture*)src->texture; struct r300_texture* desttex = (struct r300_texture*)dest->texture; - unsigned pixpitch = srctex->stride / srctex->tex.block.size; + 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); diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h index 36090882f13..894def07aa8 100644 --- a/src/gallium/drivers/r300/r300_surface.h +++ b/src/gallium/drivers/r300/r300_surface.h @@ -105,11 +105,11 @@ static struct r300_rs_block r300_rs_block_copy_state = { }; static struct r300_rs_block r500_rs_block_copy_state = { - .ip[0] = R500_RS_SEL_S(R500_RS_IP_PTR_K0) | - R500_RS_SEL_T(R500_RS_IP_PTR_K0) | + .ip[0] = R500_RS_SEL_S(0) | + R500_RS_SEL_T(1) | R500_RS_SEL_R(R500_RS_IP_PTR_K0) | R500_RS_SEL_Q(R500_RS_IP_PTR_K1), - .inst[0] = R500_RS_INST_COL_CN_WRITE, + .inst[0] = R500_RS_INST_TEX_CN_WRITE, .count = R300_IT_COUNT(2) | R300_IC_COUNT(0) | R300_HIRES_EN, .inst_count = R300_RS_TX_OFFSET(6), }; -- cgit v1.2.3 From d6fd672bf9a9b7b24147341338055da3b9f81f89 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 00:33:23 -0700 Subject: radeon: Fix compile warnings, compile errors. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index c7b6813014f..ce03bf2260b 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -79,10 +79,15 @@ struct r300_winsys* radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys) { struct r300_winsys* winsys = CALLOC_STRUCT(r300_winsys); + struct radeon_cs_manager* csm; + + if (winsys == NULL) { + return NULL; + } do_ioctls(winsys, fd); - struct radeon_cs_manager* csm = radeon_cs_manager_gem_ctor(fd); + csm = radeon_cs_manager_gem_ctor(fd); winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4); -- cgit v1.2.3 From b7ffe1e8763efdf042e2d5eb33ce4f3d5d365121 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 00:34:10 -0700 Subject: Add scons build support for radeon/r300. --- SConstruct | 2 +- src/gallium/drivers/r300/SConscript | 28 ++++++++++++++++++--------- src/gallium/winsys/drm/SConscript | 5 +++++ src/gallium/winsys/drm/radeon/SConscript | 28 +++------------------------ src/gallium/winsys/drm/radeon/core/SConscript | 17 ++++++++++++++++ src/gallium/winsys/drm/radeon/dri2/SConscript | 14 ++++++++++++++ 6 files changed, 59 insertions(+), 35 deletions(-) create mode 100644 src/gallium/winsys/drm/radeon/core/SConscript create mode 100644 src/gallium/winsys/drm/radeon/dri2/SConscript diff --git a/SConstruct b/SConstruct index 7e7f51516e8..1e5fd71adce 100644 --- a/SConstruct +++ b/SConstruct @@ -48,7 +48,7 @@ opts.Add(ListOption('statetrackers', 'state trackers to build', default_statetra opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers, ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300'])) opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys, - ['xlib', 'intel', 'gdi', 'amd'])) + ['xlib', 'intel', 'gdi', 'radeon'])) opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0'))) diff --git a/src/gallium/drivers/r300/SConscript b/src/gallium/drivers/r300/SConscript index 18684c3e7f9..c914bc7c40a 100644 --- a/src/gallium/drivers/r300/SConscript +++ b/src/gallium/drivers/r300/SConscript @@ -3,15 +3,25 @@ Import('*') env = env.Clone() r300 = env.ConvenienceLibrary( - target = 'r300', - source = [ - 'r300_blit.c', - 'r300_clear.c', - 'r300_context.c', - 'r300_screen.c', - 'r300_state.c', - 'r300_surface.c', - ]) + target = 'r300', + source = [ + 'r300_chipset.c', + 'r300_clear.c', + 'r300_context.c', + 'r300_debug.c', + 'r300_emit.c', + 'r300_flush.c', + 'r300_query.c', + 'r300_screen.c', + 'r300_state.c', + 'r300_state_derived.c', + 'r300_state_invariant.c', + 'r300_state_shader.c', + 'r300_state_tcl.c', + 'r300_surface.c', + 'r300_swtcl_emit.c', + 'r300_texture.c', + ]) Export('r300') diff --git a/src/gallium/winsys/drm/SConscript b/src/gallium/winsys/drm/SConscript index aef5210a32d..a9e9f2682a7 100644 --- a/src/gallium/winsys/drm/SConscript +++ b/src/gallium/winsys/drm/SConscript @@ -52,3 +52,8 @@ if env['dri']: SConscript([ 'intel/SConscript', ]) + + if 'radeon' in env['winsys']: + SConscript([ + 'radeon/SConscript', + ]) diff --git a/src/gallium/winsys/drm/radeon/SConscript b/src/gallium/winsys/drm/radeon/SConscript index 2435211a327..8f99055b2f7 100644 --- a/src/gallium/winsys/drm/radeon/SConscript +++ b/src/gallium/winsys/drm/radeon/SConscript @@ -1,29 +1,7 @@ Import('*') -if 'mesa' in env['statetrackers']: - - env = drienv.Clone() - - DRIVER_SOURCES = [ - 'radeon_buffer.c', - 'radeon_context.c', - 'radeon_screen.c', - 'radeon_winsys_softpipe.c', - ] +SConscript(['core/SConscript',]) - sources = \ - COMMON_GALLIUM_SOURCES + \ - DRIVER_SOURCES - - drivers = [ - softpipe, - r300 - ] - - # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions - env.SharedLibrary( - target ='radeon_dri.so', - source = sources, - LIBS = drivers + mesa + auxiliaries + env['LIBS'], - ) +if 'mesa' in env['statetrackers']: + SConscript(['dri2/SConscript']) diff --git a/src/gallium/winsys/drm/radeon/core/SConscript b/src/gallium/winsys/drm/radeon/core/SConscript new file mode 100644 index 00000000000..578174e32ba --- /dev/null +++ b/src/gallium/winsys/drm/radeon/core/SConscript @@ -0,0 +1,17 @@ +Import('*') + +env = drienv.Clone() + +radeon_sources = [ + 'radeon_buffer.c', + 'radeon_drm.c', + 'radeon_r300.c', + 'radeon_winsys_softpipe.c', +] + +env.Append(CPPPATH = '#/src/gallium/drivers/r300') + +env.ConvenienceLibrary( + target ='radeonwinsys', + source = radeon_sources, +) diff --git a/src/gallium/winsys/drm/radeon/dri2/SConscript b/src/gallium/winsys/drm/radeon/dri2/SConscript new file mode 100644 index 00000000000..f2cdee97d92 --- /dev/null +++ b/src/gallium/winsys/drm/radeon/dri2/SConscript @@ -0,0 +1,14 @@ +Import('*') + +env = drienv.Clone() + +drivers = [ + softpipe, + r300 +] + +env.SharedLibrary( + target ='radeon_dri.so', + source = COMMON_GALLIUM_SOURCES, + LIBS = drivers + mesa + auxiliaries + env['LIBS'], +) -- cgit v1.2.3 From 5c50218d009a4c8276aa561bd1483742cf6aa20e Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 02:05:45 -0700 Subject: r300-gallium: Move swtcl_emit to render to reflect its true purpose. --- src/gallium/drivers/r300/Makefile | 2 +- src/gallium/drivers/r300/SConscript | 2 +- src/gallium/drivers/r300/r300_context.c | 2 +- src/gallium/drivers/r300/r300_context.h | 2 +- src/gallium/drivers/r300/r300_render.c | 316 +++++++++++++++++++++++++++++ src/gallium/drivers/r300/r300_swtcl_emit.c | 316 ----------------------------- 6 files changed, 320 insertions(+), 320 deletions(-) create mode 100644 src/gallium/drivers/r300/r300_render.c delete mode 100644 src/gallium/drivers/r300/r300_swtcl_emit.c diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index 9330c286d2b..e44f9b9dfc5 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -11,6 +11,7 @@ C_SOURCES = \ r300_emit.c \ r300_flush.c \ r300_query.c \ + r300_render.c \ r300_screen.c \ r300_state.c \ r300_state_derived.c \ @@ -18,7 +19,6 @@ C_SOURCES = \ r300_state_shader.c \ r300_state_tcl.c \ r300_surface.c \ - r300_swtcl_emit.c \ r300_texture.c include ../../Makefile.template diff --git a/src/gallium/drivers/r300/SConscript b/src/gallium/drivers/r300/SConscript index c914bc7c40a..182ed2d459a 100644 --- a/src/gallium/drivers/r300/SConscript +++ b/src/gallium/drivers/r300/SConscript @@ -12,6 +12,7 @@ r300 = env.ConvenienceLibrary( 'r300_emit.c', 'r300_flush.c', 'r300_query.c', + 'r300_render.c', 'r300_screen.c', 'r300_state.c', 'r300_state_derived.c', @@ -19,7 +20,6 @@ r300 = env.ConvenienceLibrary( 'r300_state_shader.c', 'r300_state_tcl.c', 'r300_surface.c', - 'r300_swtcl_emit.c', 'r300_texture.c', ]) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index b8584702aad..31efe914171 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -125,7 +125,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.draw_range_elements = r300_draw_range_elements; r300->draw = draw_create(); - draw_set_rasterize_stage(r300->draw, r300_draw_swtcl_stage(r300)); + draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state); r300->rs_block = CALLOC_STRUCT(r300_rs_block); diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 0ca445c0918..9d2a07a7d97 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -306,7 +306,7 @@ static struct r300_context* r300_context(struct pipe_context* context) { } /* Context initialization. */ -struct draw_stage* r300_draw_swtcl_stage(struct r300_context* r300); +struct draw_stage* r300_draw_stage(struct r300_context* r300); void r300_init_state_functions(struct r300_context* r300); void r300_init_surface_functions(struct r300_context* r300); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c new file mode 100644 index 00000000000..57bbc7a9944 --- /dev/null +++ b/src/gallium/drivers/r300/r300_render.c @@ -0,0 +1,316 @@ +/* + * Copyright 2009 Corbin Simpson + * + * 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 "draw/draw_pipe.h" +#include "draw/draw_vbuf.h" +#include "util/u_memory.h" + +#include "r300_cs.h" +#include "r300_context.h" +#include "r300_reg.h" +#include "r300_state_derived.h" + +/* r300_render: Vertex and index buffer primitive emission. */ + +struct r300_render { + /* Parent class */ + struct vbuf_render base; + + /* Pipe context */ + struct r300_context* r300; + + /* Vertex information */ + size_t vertex_size; + unsigned prim; + unsigned hwprim; + + /* VBO */ + struct pipe_buffer* vbo; + size_t vbo_size; + size_t vbo_offset; + void* vbo_map; + size_t vbo_alloc_size; + size_t vbo_max_used; +}; + +static INLINE struct r300_render* +r300_render(struct vbuf_render* render) +{ + return (struct r300_render*)render; +} + +static const struct vertex_info* +r300_render_get_vertex_info(struct vbuf_render* render) +{ + struct r300_render* r300render = r300_render(render); + struct r300_context* r300 = r300render->r300; + + r300_update_derived_state(r300); + + return &r300->vertex_info.vinfo; +} + +static boolean r300_render_allocate_vertices(struct vbuf_render* render, + ushort vertex_size, + ushort count) +{ + struct r300_render* r300render = r300_render(render); + struct r300_context* r300 = r300render->r300; + struct pipe_screen* screen = r300->context.screen; + size_t size = (size_t)vertex_size * (size_t)count; + + if (r300render->vbo) { + pipe_buffer_reference(&r300render->vbo, NULL); + } + + r300render->vbo_size = MAX2(size, r300render->vbo_alloc_size); + r300render->vbo_offset = 0; + r300render->vbo = pipe_buffer_create(screen, + 64, + PIPE_BUFFER_USAGE_VERTEX, + r300render->vbo_size); + + r300render->vertex_size = vertex_size; + + if (r300render->vbo) { + return TRUE; + } else { + return FALSE; + } +} + +static void* r300_render_map_vertices(struct vbuf_render* render) +{ + struct r300_render* r300render = r300_render(render); + struct pipe_screen* screen = r300render->r300->context.screen; + + r300render->vbo_map = pipe_buffer_map(screen, r300render->vbo, + PIPE_BUFFER_USAGE_CPU_WRITE); + + return (unsigned char*)r300render->vbo_map + r300render->vbo_offset; +} + +static void r300_render_unmap_vertices(struct vbuf_render* render, + ushort min, + ushort max) +{ + struct r300_render* r300render = r300_render(render); + struct pipe_screen* screen = r300render->r300->context.screen; + + r300render->vbo_max_used = MAX2(r300render->vbo_max_used, + r300render->vertex_size * (max + 1)); + + pipe_buffer_unmap(screen, r300render->vbo); +} + +static void r300_render_release_vertices(struct vbuf_render* render) +{ + struct r300_render* r300render = r300_render(render); + + pipe_buffer_reference(&r300render->vbo, NULL); +} + +static boolean r300_render_set_primitive(struct vbuf_render* render, + unsigned prim) +{ + struct r300_render* r300render = r300_render(render); + r300render->prim = prim; + + switch (prim) { + case PIPE_PRIM_POINTS: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POINTS; + break; + case PIPE_PRIM_LINES: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINES; + break; + case PIPE_PRIM_LINE_LOOP: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINE_LOOP; + break; + case PIPE_PRIM_LINE_STRIP: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINE_STRIP; + break; + case PIPE_PRIM_TRIANGLES: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLES; + break; + case PIPE_PRIM_TRIANGLE_STRIP: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP; + break; + case PIPE_PRIM_TRIANGLE_FAN: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN; + break; + case PIPE_PRIM_QUADS: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_QUADS; + break; + case PIPE_PRIM_QUAD_STRIP: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_QUAD_STRIP; + break; + case PIPE_PRIM_POLYGON: + r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POLYGON; + break; + default: + return FALSE; + break; + } + + return TRUE; +} + +static void prepare_render(struct r300_render* render, unsigned count) +{ + struct r300_context* r300 = render->r300; + + CS_LOCALS(r300); + + /* Make sure that all possible state is emitted. */ + r300_emit_dirty_state(r300); + + debug_printf("r300: Preparing vertex buffer %p for render, " + "vertex size %d, vertex count %d\n", render->vbo, + r300->vertex_info.vinfo.size, count); + /* Set the pointer to our vertex buffer. The emitted values are this: + * PACKET3 [3D_LOAD_VBPNTR] + * COUNT [1] + * FORMAT [size | stride << 8] + * OFFSET [0] + * VBPNTR [relocated BO] + */ + BEGIN_CS(7); + OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3); + OUT_CS(1); + OUT_CS(r300->vertex_info.vinfo.size | + (r300->vertex_info.vinfo.size << 8)); + OUT_CS(render->vbo_offset); + OUT_CS_RELOC(render->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); + END_CS; +} + +static void r300_render_draw_arrays(struct vbuf_render* render, + unsigned start, + unsigned count) +{ + struct r300_render* r300render = r300_render(render); + struct r300_context* r300 = r300render->r300; + + CS_LOCALS(r300); + + r300render->vbo_offset = start; + + prepare_render(r300render, count); + + debug_printf("r300: Doing vbuf render, count %d\n", count); + + BEGIN_CS(2); + OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0); + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) | + r300render->hwprim); + END_CS; +} + +static void r300_render_draw(struct vbuf_render* render, + const ushort* indices, + uint count) +{ + struct r300_render* r300render = r300_render(render); + struct r300_context* r300 = r300render->r300; + struct pipe_screen* screen = r300->context.screen; + struct pipe_buffer* index_buffer; + void* index_map; + + CS_LOCALS(r300); + + prepare_render(r300render, count); + + /* Send our indices into an index buffer. */ + index_buffer = pipe_buffer_create(screen, 64, PIPE_BUFFER_USAGE_VERTEX, + count); + if (!index_buffer) { + return; + } + + index_map = pipe_buffer_map(screen, index_buffer, + PIPE_BUFFER_USAGE_CPU_WRITE); + memcpy(index_map, indices, count); + pipe_buffer_unmap(screen, index_buffer); + + debug_printf("r300: Doing indexbuf render, count %d\n", count); + + BEGIN_CS(5); + OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0); + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | + r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); + + OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2); + OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2)); + OUT_CS_RELOC(index_buffer, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); + END_CS; +} + +static void r300_render_destroy(struct vbuf_render* render) +{ + FREE(render); +} + +static struct vbuf_render* r300_render_create(struct r300_context* r300) +{ + struct r300_render* r300render = CALLOC_STRUCT(r300_render); + + r300render->r300 = r300; + + /* XXX find real numbers plz */ + r300render->base.max_vertex_buffer_bytes = 128 * 1024; + r300render->base.max_indices = 16 * 1024; + + r300render->base.get_vertex_info = r300_render_get_vertex_info; + r300render->base.allocate_vertices = r300_render_allocate_vertices; + r300render->base.map_vertices = r300_render_map_vertices; + r300render->base.unmap_vertices = r300_render_unmap_vertices; + r300render->base.set_primitive = r300_render_set_primitive; + r300render->base.draw = r300_render_draw; + r300render->base.draw_arrays = r300_render_draw_arrays; + r300render->base.release_vertices = r300_render_release_vertices; + r300render->base.destroy = r300_render_destroy; + + return &r300render->base; +} + +struct draw_stage* r300_draw_stage(struct r300_context* r300) +{ + struct vbuf_render* render; + struct draw_stage* stage; + + render = r300_render_create(r300); + + if (!render) { + return NULL; + } + + stage = draw_vbuf_stage(r300->draw, render); + + if (!stage) { + render->destroy(render); + return NULL; + } + + draw_set_render(r300->draw, render); + + return stage; +} diff --git a/src/gallium/drivers/r300/r300_swtcl_emit.c b/src/gallium/drivers/r300/r300_swtcl_emit.c deleted file mode 100644 index 83c25f496bf..00000000000 --- a/src/gallium/drivers/r300/r300_swtcl_emit.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright 2008 Corbin Simpson - * - * 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 "draw/draw_pipe.h" -#include "draw/draw_vbuf.h" -#include "util/u_memory.h" - -#include "r300_cs.h" -#include "r300_context.h" -#include "r300_reg.h" -#include "r300_state_derived.h" - -/* r300_swtcl_emit: Vertex and index buffer primitive emission. No HW TCL. */ - -struct r300_swtcl_render { - /* Parent class */ - struct vbuf_render base; - - /* Pipe context */ - struct r300_context* r300; - - /* Vertex information */ - size_t vertex_size; - unsigned prim; - unsigned hwprim; - - /* VBO */ - struct pipe_buffer* vbo; - size_t vbo_size; - size_t vbo_offset; - void* vbo_map; - size_t vbo_alloc_size; - size_t vbo_max_used; -}; - -static INLINE struct r300_swtcl_render* -r300_swtcl_render(struct vbuf_render* render) -{ - return (struct r300_swtcl_render*)render; -} - -static const struct vertex_info* -r300_swtcl_render_get_vertex_info(struct vbuf_render* render) -{ - struct r300_swtcl_render* r300render = r300_swtcl_render(render); - struct r300_context* r300 = r300render->r300; - - r300_update_derived_state(r300); - - return &r300->vertex_info.vinfo; -} - -static boolean r300_swtcl_render_allocate_vertices(struct vbuf_render* render, - ushort vertex_size, - ushort count) -{ - struct r300_swtcl_render* r300render = r300_swtcl_render(render); - struct r300_context* r300 = r300render->r300; - struct pipe_screen* screen = r300->context.screen; - size_t size = (size_t)vertex_size * (size_t)count; - - if (r300render->vbo) { - pipe_buffer_reference(&r300render->vbo, NULL); - } - - r300render->vbo_size = MAX2(size, r300render->vbo_alloc_size); - r300render->vbo_offset = 0; - r300render->vbo = pipe_buffer_create(screen, - 64, - PIPE_BUFFER_USAGE_VERTEX, - r300render->vbo_size); - - r300render->vertex_size = vertex_size; - - if (r300render->vbo) { - return TRUE; - } else { - return FALSE; - } -} - -static void* r300_swtcl_render_map_vertices(struct vbuf_render* render) -{ - struct r300_swtcl_render* r300render = r300_swtcl_render(render); - struct pipe_screen* screen = r300render->r300->context.screen; - - r300render->vbo_map = pipe_buffer_map(screen, r300render->vbo, - PIPE_BUFFER_USAGE_CPU_WRITE); - - return (unsigned char*)r300render->vbo_map + r300render->vbo_offset; -} - -static void r300_swtcl_render_unmap_vertices(struct vbuf_render* render, - ushort min, - ushort max) -{ - struct r300_swtcl_render* r300render = r300_swtcl_render(render); - struct pipe_screen* screen = r300render->r300->context.screen; - - r300render->vbo_max_used = MAX2(r300render->vbo_max_used, - r300render->vertex_size * (max + 1)); - - pipe_buffer_unmap(screen, r300render->vbo); -} - -static void r300_swtcl_render_release_vertices(struct vbuf_render* render) -{ - struct r300_swtcl_render* r300render = r300_swtcl_render(render); - - pipe_buffer_reference(&r300render->vbo, NULL); -} - -static boolean r300_swtcl_render_set_primitive(struct vbuf_render* render, - unsigned prim) -{ - struct r300_swtcl_render* r300render = r300_swtcl_render(render); - r300render->prim = prim; - - switch (prim) { - case PIPE_PRIM_POINTS: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POINTS; - break; - case PIPE_PRIM_LINES: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINES; - break; - case PIPE_PRIM_LINE_LOOP: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINE_LOOP; - break; - case PIPE_PRIM_LINE_STRIP: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_LINE_STRIP; - break; - case PIPE_PRIM_TRIANGLES: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLES; - break; - case PIPE_PRIM_TRIANGLE_STRIP: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP; - break; - case PIPE_PRIM_TRIANGLE_FAN: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN; - break; - case PIPE_PRIM_QUADS: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_QUADS; - break; - case PIPE_PRIM_QUAD_STRIP: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_QUAD_STRIP; - break; - case PIPE_PRIM_POLYGON: - r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POLYGON; - break; - default: - return FALSE; - break; - } - - return TRUE; -} - -static void prepare_render(struct r300_swtcl_render* render, unsigned count) -{ - struct r300_context* r300 = render->r300; - - CS_LOCALS(r300); - - /* Make sure that all possible state is emitted. */ - r300_emit_dirty_state(r300); - - debug_printf("r300: Preparing vertex buffer %p for render, " - "vertex size %d, vertex count %d\n", render->vbo, - r300->vertex_info.vinfo.size, count); - /* Set the pointer to our vertex buffer. The emitted values are this: - * PACKET3 [3D_LOAD_VBPNTR] - * COUNT [1] - * FORMAT [size | stride << 8] - * OFFSET [0] - * VBPNTR [relocated BO] - */ - BEGIN_CS(7); - OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3); - OUT_CS(1); - OUT_CS(r300->vertex_info.vinfo.size | - (r300->vertex_info.vinfo.size << 8)); - OUT_CS(render->vbo_offset); - OUT_CS_RELOC(render->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); - END_CS; -} - -static void r300_swtcl_render_draw_arrays(struct vbuf_render* render, - unsigned start, - unsigned count) -{ - struct r300_swtcl_render* r300render = r300_swtcl_render(render); - struct r300_context* r300 = r300render->r300; - - CS_LOCALS(r300); - - r300render->vbo_offset = start; - - prepare_render(r300render, count); - - debug_printf("r300: Doing vbuf render, count %d\n", count); - - BEGIN_CS(2); - OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0); - OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) | - r300render->hwprim); - END_CS; -} - -static void r300_swtcl_render_draw(struct vbuf_render* render, - const ushort* indices, - uint count) -{ - struct r300_swtcl_render* r300render = r300_swtcl_render(render); - struct r300_context* r300 = r300render->r300; - struct pipe_screen* screen = r300->context.screen; - struct pipe_buffer* index_buffer; - void* index_map; - - CS_LOCALS(r300); - - prepare_render(r300render, count); - - /* Send our indices into an index buffer. */ - index_buffer = pipe_buffer_create(screen, 64, PIPE_BUFFER_USAGE_VERTEX, - count); - if (!index_buffer) { - return; - } - - index_map = pipe_buffer_map(screen, index_buffer, - PIPE_BUFFER_USAGE_CPU_WRITE); - memcpy(index_map, indices, count); - pipe_buffer_unmap(screen, index_buffer); - - debug_printf("r300: Doing indexbuf render, count %d\n", count); - - BEGIN_CS(5); - OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0); - OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | - r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); - - OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2); - OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2)); - OUT_CS_RELOC(index_buffer, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); - END_CS; -} - -static void r300_swtcl_render_destroy(struct vbuf_render* render) -{ - FREE(render); -} - -static struct vbuf_render* r300_swtcl_render_create(struct r300_context* r300) -{ - struct r300_swtcl_render* r300render = CALLOC_STRUCT(r300_swtcl_render); - - r300render->r300 = r300; - - /* XXX find real numbers plz */ - r300render->base.max_vertex_buffer_bytes = 128 * 1024; - r300render->base.max_indices = 16 * 1024; - - r300render->base.get_vertex_info = r300_swtcl_render_get_vertex_info; - r300render->base.allocate_vertices = r300_swtcl_render_allocate_vertices; - r300render->base.map_vertices = r300_swtcl_render_map_vertices; - r300render->base.unmap_vertices = r300_swtcl_render_unmap_vertices; - r300render->base.set_primitive = r300_swtcl_render_set_primitive; - r300render->base.draw = r300_swtcl_render_draw; - r300render->base.draw_arrays = r300_swtcl_render_draw_arrays; - r300render->base.release_vertices = r300_swtcl_render_release_vertices; - r300render->base.destroy = r300_swtcl_render_destroy; - - return &r300render->base; -} - -struct draw_stage* r300_draw_swtcl_stage(struct r300_context* r300) -{ - struct vbuf_render* render; - struct draw_stage* stage; - - render = r300_swtcl_render_create(r300); - - if (!render) { - return NULL; - } - - stage = draw_vbuf_stage(r300->draw, render); - - if (!stage) { - render->destroy(render); - return NULL; - } - - draw_set_render(r300->draw, render); - - return stage; -} -- cgit v1.2.3 From 23639ddbaea67185c87c9e2332f10ba95723b2cb Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 02:19:48 -0700 Subject: r300-gallium: Fix bad register write. --- src/gallium/drivers/r300/r300_emit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 0ee32334460..f28404152f0 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -370,15 +370,16 @@ void r300_emit_viewport_state(struct r300_context* r300, { CS_LOCALS(r300); - BEGIN_CS(7); - OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 7); + BEGIN_CS(9); + OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6); OUT_CS_32F(viewport->xscale); OUT_CS_32F(viewport->xoffset); OUT_CS_32F(viewport->yscale); OUT_CS_32F(viewport->yoffset); OUT_CS_32F(viewport->zscale); OUT_CS_32F(viewport->zoffset); - OUT_CS(viewport->vte_control); + + OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control); END_CS; } -- cgit v1.2.3 From 21f1cdbe075ee6c24ebd6db2902f19a9d33beb22 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 02:20:29 -0700 Subject: radeon: If the CS emit fails, dump it to stderr. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index ce03bf2260b..293b6c2d389 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -39,7 +39,13 @@ static void radeon_r300_write_cs_reloc(struct radeon_cs* cs, static void radeon_r300_flush_cs(struct radeon_cs* cs) { - radeon_cs_emit(cs); + int retval = 0; + + retval = radeon_cs_emit(cs); + if (retval) { + debug_printf("radeon: Bad CS, dumping...\n"); + radeon_cs_print(cs, stderr); + } radeon_cs_erase(cs); } -- cgit v1.2.3 From 48688e5e8f9501cad3d2862f8e057166992fddc0 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 02:38:13 -0700 Subject: r300-gallium: Calculate vert shader inputs for HW TCL. This is definitely not perfect. --- src/gallium/drivers/r300/r300_state_derived.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 0e7a2b6726f..2f34698e359 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -30,9 +30,9 @@ * The vertex_info struct describes the post-TCL format of vertices. It is * required for Draw when doing SW TCL, and also for describing the * dreaded RS block on R300 chipsets. */ -/* XXX this function should be able to handle vert shaders as well as draw */ static void r300_update_vertex_layout(struct r300_context* r300) { + struct r300_screen* r300screen = r300_screen(r300->context.screen); struct r300_vertex_format vformat; struct vertex_info vinfo; boolean pos = FALSE, psize = FALSE, fog = FALSE; @@ -74,6 +74,13 @@ static void r300_update_vertex_layout(struct r300_context* r300) } } + if (r300screen->caps->has_tcl) { + for (i = 0; i < info->num_inputs; i++) { + /* XXX should probably do real lookup with vert shader */ + tab[i] = i; + } + } + /* Do the actual vertex_info setup. * * vertex_info has four uints of hardware-specific data in it. -- cgit v1.2.3 From 024817649f61d303f799c7b0449e71b84a52b6de Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 02:43:09 -0700 Subject: radeon: A bit of indent and line break cleanup. --- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 17 +++++++++++------ src/gallium/winsys/drm/radeon/core/radeon_buffer.h | 3 ++- .../winsys/drm/radeon/core/radeon_winsys_softpipe.c | 17 +++++++++-------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 9dca510c815..611ee68da63 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -82,7 +82,8 @@ static struct pipe_buffer *radeon_buffer_user_create(struct pipe_winsys *ws, { struct radeon_pipe_buffer *radeon_buffer; - radeon_buffer = (struct radeon_pipe_buffer*)radeon_buffer_create(ws, 0, 0, bytes); + radeon_buffer = + (struct radeon_pipe_buffer*)radeon_buffer_create(ws, 0, 0, bytes); if (radeon_buffer == NULL) { return NULL; } @@ -94,7 +95,8 @@ static struct pipe_buffer *radeon_buffer_user_create(struct pipe_winsys *ws, static void radeon_buffer_del(struct pipe_buffer *buffer) { - struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer; + struct radeon_pipe_buffer *radeon_buffer = + (struct radeon_pipe_buffer*)buffer; radeon_bo_unref(radeon_buffer->bo); free(radeon_buffer); @@ -104,7 +106,8 @@ static void *radeon_buffer_map(struct pipe_winsys *ws, struct pipe_buffer *buffer, unsigned flags) { - struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer; + struct radeon_pipe_buffer *radeon_buffer = + (struct radeon_pipe_buffer*)buffer; int write = 0; if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) { @@ -120,9 +123,11 @@ static void *radeon_buffer_map(struct pipe_winsys *ws, return radeon_buffer->bo->ptr; } -static void radeon_buffer_unmap(struct pipe_winsys *ws, struct pipe_buffer *buffer) +static void radeon_buffer_unmap(struct pipe_winsys *ws, + struct pipe_buffer *buffer) { - struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer; + struct radeon_pipe_buffer *radeon_buffer = + (struct radeon_pipe_buffer*)buffer; radeon_bo_unmap(radeon_buffer->bo); } @@ -151,7 +156,7 @@ static void radeon_flush_frontbuffer(struct pipe_winsys *pipe_winsys, struct pipe_surface *pipe_surface, void *context_private) { - /* TODO: call dri2CopyRegion */ + /* XXX TODO: call dri2CopyRegion */ } struct radeon_winsys* radeon_pipe_winsys(int fd) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h index 40ad0fc8d19..163422f2969 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h @@ -59,9 +59,10 @@ struct radeon_winsys { }; struct radeon_winsys* radeon_pipe_winsys(int fb); +#if 0 struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_context, uint32_t handle, enum pipe_format format, int w, int h, int pitch); - +#endif #endif diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c index 226e16674c8..33f9ac15ab1 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c @@ -39,16 +39,17 @@ struct radeon_softpipe_winsys { /** * Return list of surface formats supported by this driver. */ -static boolean radeon_is_format_supported(struct softpipe_winsys *sws, uint format) +static boolean radeon_is_format_supported(struct softpipe_winsys *sws, + uint format) { switch (format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_R5G6B5_UNORM: - case PIPE_FORMAT_Z24S8_UNORM: - return TRUE; - default: - break; - }; + case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_R5G6B5_UNORM: + case PIPE_FORMAT_Z24S8_UNORM: + return TRUE; + default: + break; + } return FALSE; } -- cgit v1.2.3 From 2d8bf51ffc2dfdd3a1c44f550385250c3398e1d0 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Sat, 4 Apr 2009 11:52:19 +0200 Subject: python/regress: Use X8R8G8B8 rendertarget in vertex shader test. --- .../state_trackers/python/tests/regress/vertex-shader/vertex-shader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 99fe7877389..6a927f59575 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -112,7 +112,7 @@ def test(dev, name): # framebuffer cbuf = dev.texture_create( - PIPE_FORMAT_A8R8G8B8_UNORM, + PIPE_FORMAT_X8R8G8B8_UNORM, width, height, tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, ).get_surface() -- cgit v1.2.3 From 4661817dacec5ef77d013828423c7ebeacf807c5 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Sat, 4 Apr 2009 13:34:27 +0200 Subject: python/regress: Initial fragment shader test suite. --- .../tests/regress/fragment-shader/frag-abs.sh | 13 ++ .../tests/regress/fragment-shader/frag-add.sh | 8 + .../tests/regress/fragment-shader/frag-dp3.sh | 8 + .../tests/regress/fragment-shader/frag-dp4.sh | 8 + .../tests/regress/fragment-shader/frag-dst.sh | 8 + .../tests/regress/fragment-shader/frag-ex2.sh | 11 ++ .../tests/regress/fragment-shader/frag-flr.sh | 15 ++ .../tests/regress/fragment-shader/frag-frc.sh | 13 ++ .../tests/regress/fragment-shader/frag-lg2.sh | 15 ++ .../tests/regress/fragment-shader/frag-lit.sh | 8 + .../tests/regress/fragment-shader/frag-lrp.sh | 11 ++ .../tests/regress/fragment-shader/frag-mad.sh | 11 ++ .../tests/regress/fragment-shader/frag-max.sh | 10 + .../tests/regress/fragment-shader/frag-min.sh | 10 + .../tests/regress/fragment-shader/frag-mov.sh | 8 + .../tests/regress/fragment-shader/frag-mul.sh | 10 + .../tests/regress/fragment-shader/frag-rcp.sh | 15 ++ .../tests/regress/fragment-shader/frag-rsq.sh | 15 ++ .../tests/regress/fragment-shader/frag-sge.sh | 13 ++ .../tests/regress/fragment-shader/frag-slt.sh | 13 ++ .../regress/fragment-shader/frag-srcmod-abs.sh | 13 ++ .../regress/fragment-shader/frag-srcmod-absneg.sh | 15 ++ .../regress/fragment-shader/frag-srcmod-neg.sh | 11 ++ .../regress/fragment-shader/frag-srcmod-swz.sh | 8 + .../tests/regress/fragment-shader/frag-sub.sh | 8 + .../tests/regress/fragment-shader/frag-xpd.sh | 8 + .../regress/fragment-shader/fragment-shader.py | 213 +++++++++++++++++++++ 27 files changed, 499 insertions(+) create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh create mode 100644 src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh new file mode 100644 index 00000000000..7a0006bf660 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh @@ -0,0 +1,13 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { -0.5, -0.4, -0.6, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +ABS OUT[0], TEMP[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh new file mode 100644 index 00000000000..f7836c85ddb --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh @@ -0,0 +1,8 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +ADD OUT[0], IN[0], IN[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh new file mode 100644 index 00000000000..c89cd748a80 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh @@ -0,0 +1,8 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DP3 OUT[0], IN[0], IN[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh new file mode 100644 index 00000000000..6517e3c4945 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh @@ -0,0 +1,8 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DP4 OUT[0], IN[0].xyzx, IN[0].xyzx + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh new file mode 100644 index 00000000000..464880ba68f --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh @@ -0,0 +1,8 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DST OUT[0], IN[0], IN[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh new file mode 100644 index 00000000000..2684076f1d6 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh @@ -0,0 +1,11 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +EX2 TEMP[0], IN[0].xxxx +MUL OUT[0], TEMP[0], IN[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh new file mode 100644 index 00000000000..ad11e28918a --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh @@ -0,0 +1,15 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { 2.5, 4.0, 2.0, 1.0 } +IMM FLT32 { 0.4, 0.25, 0.5, 1.0 } + +MUL TEMP[0], IN[0], IMM[0] +FLR TEMP[0], TEMP[0] +MUL OUT[0], TEMP[0], IMM[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh new file mode 100644 index 00000000000..4f3aa30d666 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh @@ -0,0 +1,13 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { 2.7, 3.1, 4.5, 1.0 } + +MUL TEMP[0], IN[0], IMM[0] +FRC OUT[0], TEMP[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh new file mode 100644 index 00000000000..54c7c644598 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh @@ -0,0 +1,15 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { 1.0, 0.0, 0.0, 0.0 } +IMM FLT32 { 0.5, 0.0, 0.0, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +LG2 TEMP[0].x, TEMP[0].xxxx +ADD OUT[0], TEMP[0], IMM[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh new file mode 100644 index 00000000000..0e78ef86b54 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh @@ -0,0 +1,8 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +LIT OUT[0], IN[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh new file mode 100644 index 00000000000..e9ee0f81478 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh @@ -0,0 +1,11 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +ABS TEMP[0], IN[0] +LRP OUT[0], TEMP[0], IN[0].xxxx, IN[0].yyyy + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh new file mode 100644 index 00000000000..439acd5bbde --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh @@ -0,0 +1,11 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +IMM FLT32 { 0.5, 0.4, 0.6, 1.0 } +IMM FLT32 { 0.5, 0.4, 0.6, 0.0 } + +MAD OUT[0], IN[0], IMM[0], IMM[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh new file mode 100644 index 00000000000..ab21b245dd8 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh @@ -0,0 +1,10 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +IMM FLT32 { 0.4, 0.4, 0.4, 0.0 } + +MAX OUT[0], IN[0], IMM[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh new file mode 100644 index 00000000000..969ae73d98e --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh @@ -0,0 +1,10 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +IMM FLT32 { 0.6, 0.6, 0.6, 1.0 } + +MIN OUT[0], IN[0], IMM[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh new file mode 100644 index 00000000000..612975e0570 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh @@ -0,0 +1,8 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +MOV OUT[0], IN[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh new file mode 100644 index 00000000000..ed158b0fc69 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh @@ -0,0 +1,10 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +IMM FLT32 { 0.5, 0.6, 0.7, 1.0 } + +MUL OUT[0], IN[0], IMM[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh new file mode 100644 index 00000000000..cc9feef07e1 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh @@ -0,0 +1,15 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { 1.0, 0.0, 0.0, 0.0 } +IMM FLT32 { 1.5, 0.0, 0.0, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +RCP TEMP[0].x, TEMP[0].xxxx +SUB OUT[0], TEMP[0], IMM[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh new file mode 100644 index 00000000000..695621fdc97 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh @@ -0,0 +1,15 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { 1.0, 0.0, 0.0, 0.0 } +IMM FLT32 { 1.5, 0.0, 0.0, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +RSQ TEMP[0].x, TEMP[0].xxxx +SUB OUT[0], TEMP[0], IMM[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh new file mode 100644 index 00000000000..9505bc3c3e3 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh @@ -0,0 +1,13 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { 0.6, 0.6, 0.6, 0.0 } + +SGE TEMP[0], IN[0], IMM[0] +MUL OUT[0], IN[0], TEMP[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh new file mode 100644 index 00000000000..f2a1521cbf0 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh @@ -0,0 +1,13 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { 0.6, 0.6, 0.6, 0.0 } + +SLT TEMP[0], IN[0], IMM[0] +MUL OUT[0], IN[0], TEMP[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh new file mode 100644 index 00000000000..9cd4b682955 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh @@ -0,0 +1,13 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { -0.3, -0.5, -0.4, 0.0 } + +ADD TEMP[0], IN[0], IMM[0] +MOV OUT[0], |TEMP[0]| + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh new file mode 100644 index 00000000000..acd6aa750dd --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh @@ -0,0 +1,15 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +IMM FLT32 { -0.2, -0.3, -0.4, 0.0 } +IMM FLT32 { -1.0, -1.0, -1.0, -1.0 } + +ADD TEMP[0], IN[0], IMM[0] +MOV TEMP[0], -|TEMP[0]| +MUL OUT[0], TEMP[0], IMM[1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh new file mode 100644 index 00000000000..ba1b61503b8 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh @@ -0,0 +1,11 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +DCL TEMP[0] + +SUB TEMP[0], IN[0], IN[0].yzxw +MOV OUT[0], -TEMP[0] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh new file mode 100644 index 00000000000..192aa7bb26b --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh @@ -0,0 +1,8 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +MOV OUT[0], IN[0].yxzw + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh new file mode 100644 index 00000000000..83441fa8207 --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh @@ -0,0 +1,8 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +SUB OUT[0], IN[0], IN[0].yzxw + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh new file mode 100644 index 00000000000..d6f66c4927a --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh @@ -0,0 +1,8 @@ +FRAG1.1 + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR + +XPD OUT[0], IN[0], IN[0].yzxw + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py new file mode 100644 index 00000000000..14d8dc60bba --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python +########################################################################## +# +# 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. +# +########################################################################## + + +from gallium import * + +def make_image(surface): + data = surface.get_tile_rgba8(0, 0, surface.width, surface.height) + + import Image + outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1) + return outimage + +def save_image(filename, surface): + outimage = make_image(surface) + outimage.save(filename, "PNG") + +def test(dev, name): + ctx = dev.context_create() + + width = 320 + height = 320 + minz = 0.0 + maxz = 1.0 + + # disabled blending/masking + blend = 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 + ctx.set_blend(blend) + + # depth/stencil/alpha + depth_stencil_alpha = DepthStencilAlpha() + depth_stencil_alpha.depth.enabled = 0 + depth_stencil_alpha.depth.writemask = 1 + depth_stencil_alpha.depth.func = PIPE_FUNC_LESS + ctx.set_depth_stencil_alpha(depth_stencil_alpha) + + # rasterizer + rasterizer = Rasterizer() + rasterizer.front_winding = PIPE_WINDING_CW + rasterizer.cull_mode = PIPE_WINDING_NONE + rasterizer.scissor = 1 + ctx.set_rasterizer(rasterizer) + + # viewport + viewport = Viewport() + scale = FloatArray(4) + scale[0] = width / 2.0 + scale[1] = -height / 2.0 + scale[2] = (maxz - minz) / 2.0 + scale[3] = 1.0 + viewport.scale = scale + translate = FloatArray(4) + translate[0] = width / 2.0 + translate[1] = height / 2.0 + translate[2] = (maxz - minz) / 2.0 + translate[3] = 0.0 + viewport.translate = translate + ctx.set_viewport(viewport) + + # samplers + sampler = 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_MIPFILTER_NEAREST + sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST + sampler.normalized_coords = 1 + ctx.set_sampler(0, sampler) + + # scissor + scissor = Scissor() + scissor.minx = 0 + scissor.miny = 0 + scissor.maxx = width + scissor.maxy = height + ctx.set_scissor(scissor) + + clip = Clip() + clip.nr = 0 + ctx.set_clip(clip) + + # framebuffer + cbuf = dev.texture_create( + PIPE_FORMAT_X8R8G8B8_UNORM, + width, height, + tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, + ).get_surface() + fb = Framebuffer() + fb.width = width + fb.height = height + fb.nr_cbufs = 1 + fb.set_cbuf(0, cbuf) + ctx.set_framebuffer(fb) + ctx.surface_clear(cbuf, 0x80808080) + + # vertex shader + vs = Shader(''' + VERT1.1 + DCL IN[0], POSITION + DCL IN[1], COLOR + DCL OUT[0], POSITION + DCL OUT[1], COLOR + MOV OUT[0], IN[0] + MOV OUT[1], IN[1] + END + ''') + ctx.set_vertex_shader(vs) + + # fragment shader + fs = Shader(file('frag-' + name + '.sh', 'rt').read()) + ctx.set_fragment_shader(fs) + + xy = [ + -0.8, -0.8, + 0.8, -0.8, + 0.0, 0.8, + ] + color = [ + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + ] + + nverts = 3 + nattrs = 2 + verts = FloatArray(nverts * nattrs * 4) + + for i in range(0, nverts): + verts[i * nattrs * 4 + 0] = xy[i * 2 + 0] # x + verts[i * nattrs * 4 + 1] = xy[i * 2 + 1] # y + verts[i * nattrs * 4 + 2] = 0.5 # z + verts[i * nattrs * 4 + 3] = 1.0 # w + verts[i * nattrs * 4 + 4] = color[i * 3 + 0] # r + verts[i * nattrs * 4 + 5] = color[i * 3 + 1] # g + verts[i * nattrs * 4 + 6] = color[i * 3 + 2] # b + verts[i * nattrs * 4 + 7] = 1.0 # a + + ctx.draw_vertices(PIPE_PRIM_TRIANGLES, + nverts, + nattrs, + verts) + + ctx.flush() + + save_image('frag-' + name + '.png', cbuf) + +def main(): + tests = [ + 'abs', + 'add', + 'dp3', + 'dp4', + 'dst', + 'ex2', + 'flr', + 'frc', + 'lg2', + 'lit', + 'lrp', + 'mad', + 'max', + 'min', + 'mov', + 'mul', + 'rcp', + 'rsq', + 'sge', + 'slt', + 'srcmod-abs', + 'srcmod-absneg', + 'srcmod-neg', + 'srcmod-swz', + 'sub', + 'xpd', + ] + + dev = Device() + for t in tests: + test(dev, t) + +if __name__ == '__main__': + main() -- cgit v1.2.3 From b0ce91518646b62169594da661dd92ac899cbd6f Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Sat, 4 Apr 2009 13:42:31 +0200 Subject: python/regress: Remove trailing whitespace. --- .../python/tests/regress/fragment-shader/fragment-shader.py | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vertex-shader.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py index 14d8dc60bba..9f6c0572630 100644 --- a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py @@ -112,7 +112,7 @@ def test(dev, name): # framebuffer cbuf = dev.texture_create( - PIPE_FORMAT_X8R8G8B8_UNORM, + PIPE_FORMAT_X8R8G8B8_UNORM, width, height, tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, ).get_surface() diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 6a927f59575..434ac9b3fc8 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -112,7 +112,7 @@ def test(dev, name): # framebuffer cbuf = dev.texture_create( - PIPE_FORMAT_X8R8G8B8_UNORM, + PIPE_FORMAT_X8R8G8B8_UNORM, width, height, tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET, ).get_surface() -- cgit v1.2.3 From ba14b043bc1ab87e8e5e46e6e909a8def9535028 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sat, 4 Apr 2009 16:04:59 +0200 Subject: gallium: Add utility helper for packing combined depth/stencil values. --- src/gallium/auxiliary/util/u_pack_color.h | 20 ++++++++++++++++++++ src/mesa/state_tracker/st_cb_clear.c | 16 +++------------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index e0e8aa8e9fe..e05d0322532 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -440,6 +440,26 @@ util_pack_z(enum pipe_format format, double z) return 0; } } + + +/** + * Note: it's assumed that z is in [0,1] and s in [0,255] + */ +static INLINE uint +util_pack_z_stencil(enum pipe_format format, double z, uint s) +{ + switch (format) { + case PIPE_FORMAT_S8Z24_UNORM: + return util_pack_z(format, z) | s << 24; + case PIPE_FORMAT_Z24S8_UNORM: + return util_pack_z(format, z) | s; + default: + debug_print_format("gallium: unhandled format in util_pack_z_stencil()", + format); + assert(0); + return 0; + } +} /** diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 020684b4e14..bec32db0502 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -460,19 +460,9 @@ clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) } else { /* clear whole buffer w/out masking */ - GLuint clearValue = util_pack_z(strb->surface->format, ctx->Depth.Clear); - - switch (strb->surface->format) { - case PIPE_FORMAT_S8Z24_UNORM: - clearValue |= ctx->Stencil.Clear << 24; - break; - case PIPE_FORMAT_Z24S8_UNORM: - clearValue |= ctx->Stencil.Clear; - break; - default: - assert(0); - } - + GLuint clearValue = util_pack_z_stencil(strb->surface->format, + ctx->Depth.Clear, + ctx->Stencil.Clear); ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); } } -- cgit v1.2.3 From eb168e26aa63f11a47d70c4555cae30691a2cd57 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sat, 4 Apr 2009 19:01:51 +0200 Subject: gallium: Clean up driver clear() interface. Only allows clearing currently bound buffers, but colour and depth/stencil in a single call. --- src/gallium/auxiliary/util/u_clear.h | 60 +++++++ src/gallium/auxiliary/util/u_pack_color.h | 14 +- src/gallium/drivers/i915simple/i915_clear.c | 13 +- src/gallium/drivers/i915simple/i915_context.h | 4 +- src/gallium/drivers/nv10/nv10_clear.c | 8 +- src/gallium/drivers/nv10/nv10_context.h | 5 +- src/gallium/drivers/nv20/nv20_clear.c | 8 +- src/gallium/drivers/nv20/nv20_context.h | 4 +- src/gallium/drivers/nv30/nv30_clear.c | 8 +- src/gallium/drivers/nv30/nv30_context.h | 4 +- src/gallium/drivers/nv40/nv40_clear.c | 8 +- src/gallium/drivers/nv40/nv40_context.h | 4 +- src/gallium/drivers/nv50/nv50_context.h | 4 +- src/gallium/drivers/softpipe/sp_clear.c | 65 +++----- src/gallium/drivers/softpipe/sp_clear.h | 4 +- src/gallium/drivers/trace/tr_context.c | 21 ++- src/gallium/include/pipe/p_context.h | 16 +- src/gallium/include/pipe/p_defines.h | 9 + src/gallium/state_trackers/g3dvl/vl_basic_csc.c | 3 +- src/gallium/state_trackers/python/p_context.i | 41 +---- .../state_trackers/python/retrace/interpreter.py | 4 +- src/gallium/state_trackers/python/samples/tri.py | 8 +- .../tests/regress/vertex-shader/vertex-shader.py | 7 +- .../state_trackers/python/tests/texture_render.py | 7 +- .../state_trackers/python/tests/texture_sample.py | 7 +- src/mesa/state_tracker/st_cb_clear.c | 183 +++++++-------------- 26 files changed, 263 insertions(+), 256 deletions(-) create mode 100644 src/gallium/auxiliary/util/u_clear.h diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h new file mode 100644 index 00000000000..7c16b32cf9f --- /dev/null +++ b/src/gallium/auxiliary/util/u_clear.h @@ -0,0 +1,60 @@ +/************************************************************************** + * + * 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 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. + * + **************************************************************************/ + +/* Authors: + * Michel Dänzer + */ + + +#include "pipe/p_context.h" +#include "pipe/p_state.h" +#include "util/u_pack_color.h" + + +/** + * Clear the given buffers to the specified values. + * No masking, no scissor (clear entire buffer). + */ +static INLINE void +util_clear(struct pipe_context *pipe, + struct pipe_framebuffer_state *framebuffer, unsigned buffers, + const float *rgba, double depth, unsigned stencil) +{ + if (buffers & PIPE_CLEAR_COLOR) { + struct pipe_surface *ps = framebuffer->cbufs[0]; + unsigned color; + + util_pack_color(rgba, ps->format, &color); + pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color); + } + + if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { + struct pipe_surface *ps = framebuffer->zsbuf; + + pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, + util_pack_z_stencil(ps->format, depth, stencil)); + } +} diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index e05d0322532..4ec7aee192b 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -448,17 +448,19 @@ util_pack_z(enum pipe_format format, double z) static INLINE uint util_pack_z_stencil(enum pipe_format format, double z, uint s) { + unsigned packed = util_pack_z(format, z); + switch (format) { case PIPE_FORMAT_S8Z24_UNORM: - return util_pack_z(format, z) | s << 24; + packed |= s << 24; + break; case PIPE_FORMAT_Z24S8_UNORM: - return util_pack_z(format, z) | s; + packed |= s; default: - debug_print_format("gallium: unhandled format in util_pack_z_stencil()", - format); - assert(0); - return 0; + break; } + + return packed; } diff --git a/src/gallium/drivers/i915simple/i915_clear.c b/src/gallium/drivers/i915simple/i915_clear.c index cde69daacc0..90530f2826f 100644 --- a/src/gallium/drivers/i915simple/i915_clear.c +++ b/src/gallium/drivers/i915simple/i915_clear.c @@ -25,23 +25,24 @@ * **************************************************************************/ -/* Author: +/* Authors: * Brian Paul */ -#include "pipe/p_defines.h" +#include "util/u_clear.h" #include "i915_context.h" #include "i915_state.h" /** - * Clear the given surface to the specified value. + * Clear the given buffers to the specified values. * No masking, no scissor (clear entire buffer). */ void -i915_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue) +i915_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, + double depth, unsigned stencil) { - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); + util_clear(pipe, &i915_context(pipe)->framebuffer, buffers, rgba, depth, + stencil); } diff --git a/src/gallium/drivers/i915simple/i915_context.h b/src/gallium/drivers/i915simple/i915_context.h index 3cdabe45f9d..b6983ba86e7 100644 --- a/src/gallium/drivers/i915simple/i915_context.h +++ b/src/gallium/drivers/i915simple/i915_context.h @@ -314,8 +314,8 @@ void i915_emit_hardware_state(struct i915_context *i915 ); /*********************************************************************** * i915_clear.c: */ -void i915_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue); +void i915_clear( struct pipe_context *pipe, unsigned buffers, const float *rgba, + double depth, unsigned stencil); /*********************************************************************** diff --git a/src/gallium/drivers/nv10/nv10_clear.c b/src/gallium/drivers/nv10/nv10_clear.c index be7e09cf4b0..a39a2b5f525 100644 --- a/src/gallium/drivers/nv10/nv10_clear.c +++ b/src/gallium/drivers/nv10/nv10_clear.c @@ -1,12 +1,14 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "util/u_clear.h" #include "nv10_context.h" void -nv10_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue) +nv10_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil) { - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); + util_clear(pipe, nv10_context(pipe)->framebuffer, buffers, rgba, depth, + stencil); } diff --git a/src/gallium/drivers/nv10/nv10_context.h b/src/gallium/drivers/nv10/nv10_context.h index f3b56de25a7..f1e003c9537 100644 --- a/src/gallium/drivers/nv10/nv10_context.h +++ b/src/gallium/drivers/nv10/nv10_context.h @@ -118,8 +118,9 @@ extern void nv10_init_surface_functions(struct nv10_context *nv10); extern void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen); /* nv10_clear.c */ -extern void nv10_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue); +extern void nv10_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil); + /* nv10_draw.c */ extern struct draw_stage *nv10_draw_render_stage(struct nv10_context *nv10); diff --git a/src/gallium/drivers/nv20/nv20_clear.c b/src/gallium/drivers/nv20/nv20_clear.c index 81b6f3e78ac..2b4490fa5e1 100644 --- a/src/gallium/drivers/nv20/nv20_clear.c +++ b/src/gallium/drivers/nv20/nv20_clear.c @@ -1,12 +1,14 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "util/u_clear.h" #include "nv20_context.h" void -nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue) +nv20_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil) { - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); + util_clear(pipe, nv20_context(pipe)->framebuffer, buffers, rgba, depth, + stencil); } diff --git a/src/gallium/drivers/nv20/nv20_context.h b/src/gallium/drivers/nv20/nv20_context.h index 8ad926db20a..fc932f1f90e 100644 --- a/src/gallium/drivers/nv20/nv20_context.h +++ b/src/gallium/drivers/nv20/nv20_context.h @@ -118,8 +118,8 @@ extern void nv20_init_surface_functions(struct nv20_context *nv20); extern void nv20_screen_init_miptree_functions(struct pipe_screen *pscreen); /* nv20_clear.c */ -extern void nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue); +extern void nv20_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil); /* nv20_draw.c */ extern struct draw_stage *nv20_draw_render_stage(struct nv20_context *nv20); diff --git a/src/gallium/drivers/nv30/nv30_clear.c b/src/gallium/drivers/nv30/nv30_clear.c index 71f413588ee..c4ba9266647 100644 --- a/src/gallium/drivers/nv30/nv30_clear.c +++ b/src/gallium/drivers/nv30/nv30_clear.c @@ -1,12 +1,14 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "util/u_clear.h" #include "nv30_context.h" void -nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue) +nv30_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil) { - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); + util_clear(pipe, &nv30_context(pipe)->framebuffer, buffers, rgba, depth, + stencil); } diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h index b9337697008..4229c0a0e14 100644 --- a/src/gallium/drivers/nv30/nv30_context.h +++ b/src/gallium/drivers/nv30/nv30_context.h @@ -206,7 +206,7 @@ extern boolean nv30_draw_elements(struct pipe_context *pipe, unsigned count); /* nv30_clear.c */ -extern void nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue); +extern void nv30_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil); #endif diff --git a/src/gallium/drivers/nv40/nv40_clear.c b/src/gallium/drivers/nv40/nv40_clear.c index 2c4e8f01fda..ddf13addf3b 100644 --- a/src/gallium/drivers/nv40/nv40_clear.c +++ b/src/gallium/drivers/nv40/nv40_clear.c @@ -1,12 +1,14 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "util/u_clear.h" #include "nv40_context.h" void -nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue) +nv40_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil) { - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); + util_clear(pipe, &nv40_context(pipe)->framebuffer, buffers, rgba, depth, + stencil); } diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h index adcfbdd85a8..97bc83292d4 100644 --- a/src/gallium/drivers/nv40/nv40_context.h +++ b/src/gallium/drivers/nv40/nv40_context.h @@ -227,7 +227,7 @@ extern boolean nv40_draw_elements(struct pipe_context *pipe, unsigned count); /* nv40_clear.c */ -extern void nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue); +extern void nv40_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil); #endif diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 313e435e7a5..7b67a754397 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -184,8 +184,8 @@ extern boolean nv50_draw_elements(struct pipe_context *pipe, extern void nv50_vbo_validate(struct nv50_context *nv50); /* nv50_clear.c */ -extern void nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue); +extern void nv50_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil); /* nv50_program.c */ extern void nv50_vertprog_validate(struct nv50_context *nv50); diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c index a60c6c4c16f..f72c6c63e76 100644 --- a/src/gallium/drivers/softpipe/sp_clear.c +++ b/src/gallium/drivers/softpipe/sp_clear.c @@ -2,6 +2,7 @@ * * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. + * 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 @@ -27,6 +28,7 @@ /* Author: * Brian Paul + * Michel Dänzer */ @@ -40,34 +42,15 @@ /** - * Convert packed pixel from one format to another. - */ -static unsigned -convert_color(enum pipe_format srcFormat, unsigned srcColor, - enum pipe_format dstFormat) -{ - ubyte r, g, b, a; - unsigned dstColor; - - util_unpack_color_ub(srcFormat, &srcColor, &r, &g, &b, &a); - util_pack_color_ub(r, g, b, a, dstFormat, &dstColor); - - return dstColor; -} - - - -/** - * Clear the given surface to the specified value. + * Clear the given buffers to the specified values. * No masking, no scissor (clear entire buffer). - * Note: when clearing a color buffer, the clearValue is always - * encoded as PIPE_FORMAT_A8R8G8B8_UNORM. */ void -softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue) +softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, + double depth, unsigned stencil) { struct softpipe_context *softpipe = softpipe_context(pipe); + unsigned cv; uint i; if (softpipe->no_rast) @@ -77,29 +60,29 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps, softpipe_update_derived(softpipe); /* not needed?? */ #endif - if (ps == sp_tile_cache_get_surface(softpipe->zsbuf_cache)) { - sp_tile_cache_clear(softpipe->zsbuf_cache, clearValue); -#if TILE_CLEAR_OPTIMIZATION - return; -#endif - } + if (buffers & PIPE_CLEAR_COLOR) { + for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { + struct pipe_surface *ps = softpipe->framebuffer.cbufs[i]; - for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { - if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[i])) { - unsigned cv; - if (ps->format != PIPE_FORMAT_A8R8G8B8_UNORM) { - cv = convert_color(PIPE_FORMAT_A8R8G8B8_UNORM, clearValue, - ps->format); - } - else { - cv = clearValue; - } + util_pack_color(rgba, ps->format, &cv); sp_tile_cache_clear(softpipe->cbuf_cache[i], cv); + +#if !TILE_CLEAR_OPTIMIZATION + /* non-cached surface */ + pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv); +#endif } } + if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { + struct pipe_surface *ps = softpipe->framebuffer.zsbuf; + + cv = util_pack_z_stencil(ps->format, depth, stencil); + sp_tile_cache_clear(softpipe->zsbuf_cache, cv); + #if !TILE_CLEAR_OPTIMIZATION - /* non-cached surface */ - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); + /* non-cached surface */ + pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv); #endif + } } diff --git a/src/gallium/drivers/softpipe/sp_clear.h b/src/gallium/drivers/softpipe/sp_clear.h index a8ed1c4ecc4..2e450672f58 100644 --- a/src/gallium/drivers/softpipe/sp_clear.h +++ b/src/gallium/drivers/softpipe/sp_clear.h @@ -36,8 +36,8 @@ struct pipe_context; extern void -softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue); +softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, + double depth, unsigned stencil); #endif /* SP_CLEAR_H */ diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index b69ed2cb526..6e86a5dfddf 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -973,21 +973,26 @@ trace_context_surface_fill(struct pipe_context *_pipe, static INLINE void trace_context_clear(struct pipe_context *_pipe, - struct pipe_surface *surface, - unsigned clearValue) + unsigned surfaces, + const float *rgba, + double depth, + unsigned stencil) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; - surface = trace_surface_unwrap(tr_ctx, surface); - trace_dump_call_begin("pipe_context", "clear"); trace_dump_arg(ptr, pipe); - trace_dump_arg(ptr, surface); - trace_dump_arg(uint, clearValue); - - pipe->clear(pipe, surface, clearValue);; + trace_dump_arg(uint, surfaces); + trace_dump_arg(float, rgba[0]); + trace_dump_arg(float, rgba[1]); + trace_dump_arg(float, rgba[2]); + trace_dump_arg(float, rgba[3]); + trace_dump_arg(float, depth); + trace_dump_arg(uint, stencil); + + pipe->clear(pipe, surfaces, rgba, depth, stencil); trace_dump_call_end(); } diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 2452bf3522b..29095dcdc3b 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -205,12 +205,20 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height, unsigned value); - - void (*clear)(struct pipe_context *pipe, - struct pipe_surface *ps, - unsigned clearValue); /*@}*/ + /** + * Clear the specified set of currently bound buffers to specified values. + * + * buffers is a bitfield of PIPE_CLEAR_* values. + * + * rgba is a pointer to an array of one float for each of r, g, b, a. + */ + void (*clear)(struct pipe_context *pipe, + unsigned buffers, + const float *rgba, + double depth, + unsigned stencil); /** Flush rendering (flags = bitmask of PIPE_FLUSH_x tokens) */ void (*flush)( struct pipe_context *pipe, diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 8e4f253359a..81defa445bf 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -185,6 +185,15 @@ enum pipe_texture_target { #define PIPE_SURFACE_LAYOUT_LINEAR 0 +/** + * Clear buffer bits + */ +/** All color buffers currently bound */ +#define PIPE_CLEAR_COLOR (1 << 0) +/** Depth/stencil combined */ +#define PIPE_CLEAR_DEPTHSTENCIL (1 << 1) + + /** * Transfer object usage flags */ diff --git a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c index b61b49a2f8a..16d4f1e32c9 100644 --- a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c +++ b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c @@ -98,7 +98,8 @@ static int vlResizeFrameBuffer ); /* Clear to black, in case video doesn't fill the entire window */ - pipe->clear(pipe, basic_csc->framebuffer.cbufs[0], 0); + pipe->set_framebuffer_state(pipe, &basic_csc->framebuffer); + pipe->clear(pipe, PIPE_CLEAR_COLOR, 0, 0.0f, 0); return 0; } diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index a0bf063d814..9a3003a56c4 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -308,45 +308,10 @@ error1: pipe_surface_reference(&_dst, NULL); } - void surface_clear(struct st_surface *surface, unsigned value = 0) + void clear(unsigned buffers, const float *rgba, double depth = 0.0f, + unsigned stencil = 0) { - unsigned i; - struct pipe_surface *_surface = NULL; - - if(!surface) - SWIG_exception(SWIG_TypeError, "surface must not be null"); - - for(i = 0; i < $self->framebuffer.nr_cbufs; ++i) { - struct pipe_surface *cbuf = $self->framebuffer.cbufs[i]; - if(cbuf) { - if(cbuf->texture == surface->texture && - cbuf->face == surface->face && - cbuf->level == surface->level && - cbuf->zslice == surface->zslice) { - _surface = cbuf; - break; - } - } - } - - if(!_surface) { - struct pipe_surface *zsbuf = $self->framebuffer.zsbuf; - if(zsbuf) { - if(zsbuf->texture == surface->texture && - zsbuf->face == surface->face && - zsbuf->level == surface->level && - zsbuf->zslice == surface->zslice) { - _surface = zsbuf; - } - } - } - - if(!_surface) - SWIG_exception(SWIG_ValueError, "surface not bound"); - - $self->pipe->clear($self->pipe, _surface, value); - fail: - return; + $self->pipe->clear($self->pipe, buffers, rgba, depth, stencil); } }; diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 510adcc2425..d02099389fb 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -531,8 +531,8 @@ class Context(Object): self.dirty = False return None - def clear(self, surface, value): - self.real.surface_clear(surface, value) + def clear(self, buffers, rgba, depth, stencil): + self.real.clear(buffers, rgba, depth, stencil) def _present(self): self.real.flush() diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index 4c84d121c49..4b9659861df 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -150,8 +150,12 @@ def test(dev): fb.set_cbuf(0, cbuf) fb.set_zsbuf(zbuf) ctx.set_framebuffer(fb) - ctx.surface_clear(cbuf, 0x00000000) - ctx.surface_clear(zbuf, 0xffffffff) + rgba = FloatArray(4); + rgba[0] = 0.0 + rgba[1] = 0.0 + rgba[2] = 0.0 + rgba[3] = 0.0 + ctx.clear(PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL, rgba, 1.0, 0xff) # vertex shader vs = Shader(''' diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py index 434ac9b3fc8..472769f2592 100644 --- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py @@ -122,7 +122,12 @@ def test(dev, name): fb.nr_cbufs = 1 fb.set_cbuf(0, cbuf) ctx.set_framebuffer(fb) - ctx.surface_clear(cbuf, 0x80808080) + rgba = FloatArray(4); + rgba[0] = 0.5 + rgba[1] = 0.5 + rgba[2] = 0.5 + rgba[3] = 0.5 + ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0) # vertex shader vs = Shader(file('vert-' + name + '.sh', 'rt').read()) diff --git a/src/gallium/state_trackers/python/tests/texture_render.py b/src/gallium/state_trackers/python/tests/texture_render.py index 580bf65c13b..0b76932b6ed 100755 --- a/src/gallium/state_trackers/python/tests/texture_render.py +++ b/src/gallium/state_trackers/python/tests/texture_render.py @@ -161,7 +161,12 @@ class TextureTest(TestCase): fb.nr_cbufs = 1 fb.set_cbuf(0, dst_surface) ctx.set_framebuffer(fb) - ctx.surface_clear(dst_surface, 0x00000000) + rgba = FloatArray(4); + rgba[0] = 0.0 + rgba[1] = 0.0 + rgba[2] = 0.0 + rgba[3] = 0.0 + ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0) del fb # vertex shader diff --git a/src/gallium/state_trackers/python/tests/texture_sample.py b/src/gallium/state_trackers/python/tests/texture_sample.py index f5f49f6e515..a382424667c 100755 --- a/src/gallium/state_trackers/python/tests/texture_sample.py +++ b/src/gallium/state_trackers/python/tests/texture_sample.py @@ -206,7 +206,12 @@ class TextureTest(TestCase): fb.nr_cbufs = 1 fb.set_cbuf(0, cbuf) ctx.set_framebuffer(fb) - ctx.surface_clear(cbuf, 0x00000000) + rgba = FloatArray(4); + rgba[0] = 0.5 + rgba[1] = 0.5 + rgba[2] = 0.5 + rgba[3] = 0.5 + ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0) del fb # vertex shader diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index bec32db0502..5bdc6a13309 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -2,6 +2,7 @@ * * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. + * 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 @@ -29,6 +30,7 @@ * Authors: * Keith Whitwell * Brian Paul + * Michel Dänzer */ #include "main/glheader.h" @@ -373,101 +375,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) -static void -clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) -{ - struct st_renderbuffer *strb = st_renderbuffer(rb); - - if (!strb->surface) - return; - - if (check_clear_color_with_quad( ctx, rb )) { - /* masking or scissoring */ - clear_with_quad(ctx, GL_TRUE, GL_FALSE, GL_FALSE); - } - else { - /* clear whole buffer w/out masking */ - uint clearValue; - /* NOTE: we always pass the clear color as PIPE_FORMAT_A8R8G8B8_UNORM - * at this time! - */ - util_pack_color(ctx->Color.ClearColor, PIPE_FORMAT_A8R8G8B8_UNORM, &clearValue); - ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); - } -} - - -static void -clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) -{ - struct st_renderbuffer *strb = st_renderbuffer(rb); - - if (!strb->surface) - return; - - if (check_clear_depth_with_quad(ctx, rb)) { - /* scissoring or we have a combined depth/stencil buffer */ - clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_FALSE); - } - else { - /* simple clear of whole buffer */ - uint clearValue = util_pack_z(strb->surface->format, ctx->Depth.Clear); - ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); - } -} - - -static void -clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) -{ - struct st_renderbuffer *strb = st_renderbuffer(rb); - - if (!strb->surface) - return; - - if (check_clear_stencil_with_quad(ctx, rb)) { - /* masking or scissoring or combined depth/stencil buffer */ - clear_with_quad(ctx, GL_FALSE, GL_FALSE, GL_TRUE); - } - else { - /* simple clear of whole buffer */ - GLuint clearValue = ctx->Stencil.Clear; - - switch (strb->surface->format) { - case PIPE_FORMAT_S8Z24_UNORM: - clearValue <<= 24; - break; - default: - ; /* no-op, stencil value is in least significant bits */ - } - - ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); - } -} - - -static void -clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) -{ - struct st_renderbuffer *strb = st_renderbuffer(rb); - - if (!strb->surface) - return; - - if (check_clear_depth_stencil_with_quad(ctx, rb)) { - /* masking or scissoring */ - clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_TRUE); - } - else { - /* clear whole buffer w/out masking */ - GLuint clearValue = util_pack_z_stencil(strb->surface->format, - ctx->Depth.Clear, - ctx->Stencil.Clear); - ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); - } -} - - void st_flush_clear( struct st_context *st ) { /* Release vertex buffer to avoid synchronous rendering if we were @@ -493,51 +400,89 @@ static void st_clear(GLcontext *ctx, GLbitfield mask) = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; struct gl_renderbuffer *stencilRb = ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; - GLbitfield cmask = mask & BUFFER_BITS_COLOR; + GLbitfield quad_buffers = 0; + GLbitfield clear_buffers = 0; + GLuint i; - /* This makes sure the softpipe has the latest scissor, etc values */ + /* This makes sure the pipe has the latest scissor, etc values */ st_validate_state( st ); - /* - * XXX TO-DO: - * If we're going to use clear_with_quad() for any reason, use it to - * clear as many other buffers as possible. - * As it is now, we sometimes call clear_with_quad() three times to clear - * color/depth/stencil individually... - */ + if (mask & BUFFER_BITS_COLOR) { + for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { + GLuint b = ctx->DrawBuffer->_ColorDrawBufferIndexes[i]; - if (cmask) { - GLuint b; - for (b = 0; cmask; b++) { - if (cmask & (1 << b)) { + if (mask & (1 << b)) { struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[b].Renderbuffer; + struct st_renderbuffer *strb; + assert(rb); - clear_color_buffer(ctx, rb); - cmask &= ~(1 << b); /* turn off bit */ + + strb = st_renderbuffer(rb); + + if (!strb->surface) + continue; + + if (check_clear_color_with_quad( ctx, rb )) + quad_buffers |= PIPE_CLEAR_COLOR; + else + clear_buffers |= PIPE_CLEAR_COLOR; } - assert(b < BUFFER_COUNT); } } - if (mask & BUFFER_BIT_ACCUM) { - st_clear_accum_buffer(ctx, - ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer); - } - if ((mask & BUFFER_BITS_DS) == BUFFER_BITS_DS && depthRb == stencilRb) { /* clearing combined depth + stencil */ - clear_depth_stencil_buffer(ctx, depthRb); + struct st_renderbuffer *strb = st_renderbuffer(depthRb); + + if (strb->surface) { + if (check_clear_depth_stencil_with_quad(ctx, depthRb)) + quad_buffers |= PIPE_CLEAR_DEPTHSTENCIL; + else + clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL; + } } else { /* separate depth/stencil clears */ if (mask & BUFFER_BIT_DEPTH) { - clear_depth_buffer(ctx, depthRb); + struct st_renderbuffer *strb = st_renderbuffer(depthRb); + + if (strb->surface) { + if (check_clear_depth_with_quad(ctx, depthRb)) + quad_buffers |= PIPE_CLEAR_DEPTHSTENCIL; + else + clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL; + } } if (mask & BUFFER_BIT_STENCIL) { - clear_stencil_buffer(ctx, stencilRb); + struct st_renderbuffer *strb = st_renderbuffer(stencilRb); + + if (strb->surface) { + if (check_clear_stencil_with_quad(ctx, stencilRb)) + quad_buffers |= PIPE_CLEAR_DEPTHSTENCIL; + else + clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL; + } } } + + /* + * If we're going to use clear_with_quad() for any reason, use it for + * everything possible. + */ + if (quad_buffers) { + quad_buffers |= clear_buffers; + clear_with_quad(ctx, + quad_buffers & PIPE_CLEAR_COLOR, + mask & BUFFER_BIT_DEPTH, + mask & BUFFER_BIT_STENCIL); + } else if (clear_buffers) + ctx->st->pipe->clear(ctx->st->pipe, clear_buffers, ctx->Color.ClearColor, + ctx->Depth.Clear, ctx->Stencil.Clear); + + if (mask & BUFFER_BIT_ACCUM) + st_clear_accum_buffer(ctx, + ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer); } -- cgit v1.2.3 From 1bf6af141f0d50f5efb1c4e03819b875fab57905 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Sat, 4 Apr 2009 21:16:37 +0200 Subject: python/regress: Clean up driver clear() interface. --- .../python/tests/regress/fragment-shader/fragment-shader.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py index 9f6c0572630..d60fb38d1ae 100644 --- a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py @@ -122,7 +122,12 @@ def test(dev, name): fb.nr_cbufs = 1 fb.set_cbuf(0, cbuf) ctx.set_framebuffer(fb) - ctx.surface_clear(cbuf, 0x80808080) + rgba = FloatArray(4); + rgba[0] = 0.5 + rgba[1] = 0.5 + rgba[2] = 0.5 + rgba[3] = 0.5 + ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0) # vertex shader vs = Shader(''' -- cgit v1.2.3 From 7a164411ab678622d6f3194cf708b2884bfde90e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 4 Apr 2009 13:45:14 -0600 Subject: cell: update clear() code to catch up to gallium changes --- src/gallium/drivers/cell/ppu/cell_clear.c | 56 ++++++++++++----------------- src/gallium/drivers/cell/ppu/cell_clear.h | 6 ++-- src/gallium/drivers/cell/ppu/cell_context.c | 2 +- 3 files changed, 25 insertions(+), 39 deletions(-) diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c index 34be5f3dc7d..79ad687ea94 100644 --- a/src/gallium/drivers/cell/ppu/cell_clear.c +++ b/src/gallium/drivers/cell/ppu/cell_clear.c @@ -45,54 +45,42 @@ #include "cell_state.h" -/** - * Convert packed pixel from one format to another. - */ -static unsigned -convert_color(enum pipe_format srcFormat, unsigned srcColor, - enum pipe_format dstFormat) -{ - ubyte r, g, b, a; - unsigned dstColor; - - util_unpack_color_ub(srcFormat, &srcColor, &r, &g, &b, &a); - util_pack_color_ub(r, g, b, a, dstFormat, &dstColor); - - return dstColor; -} - - - /** * Called via pipe->clear() */ void -cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue) +cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, + double depth, unsigned stencil) { struct cell_context *cell = cell_context(pipe); - uint surfIndex; if (cell->dirty) cell_update_derived(cell); - if (ps == cell->framebuffer.zsbuf) { - /* clear z/stencil buffer */ - surfIndex = 1; - } - else { - /* clear color buffer */ - surfIndex = 0; + if (buffers & PIPE_CLEAR_COLOR) { + uint surfIndex = 0; + uint clearValue; - if (ps->format != PIPE_FORMAT_A8R8G8B8_UNORM) { - clearValue = convert_color(PIPE_FORMAT_A8R8G8B8_UNORM, clearValue, - ps->format); - } + util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &clearValue); + + /* Build a CLEAR command and place it in the current batch buffer */ + STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0); + struct cell_command_clear_surface *clr + = (struct cell_command_clear_surface *) + cell_batch_alloc16(cell, sizeof(*clr)); + clr->opcode[0] = CELL_CMD_CLEAR_SURFACE; + clr->surface = surfIndex; + clr->value = clearValue; } + if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { + uint surfIndex = 1; + uint clearValue; + + clearValue = util_pack_z_stencil(cell->framebuffer.zsbuf->format, + depth, stencil); - /* Build a CLEAR command and place it in the current batch buffer */ - { + /* Build a CLEAR command and place it in the current batch buffer */ STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0); struct cell_command_clear_surface *clr = (struct cell_command_clear_surface *) diff --git a/src/gallium/drivers/cell/ppu/cell_clear.h b/src/gallium/drivers/cell/ppu/cell_clear.h index ff47d43f4cd..08e091adfdb 100644 --- a/src/gallium/drivers/cell/ppu/cell_clear.h +++ b/src/gallium/drivers/cell/ppu/cell_clear.h @@ -31,13 +31,11 @@ struct pipe_context; -struct pipe_surface; extern void -cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue); - +cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, + double depth, unsigned stencil); #endif /* CELL_CLEAR_H */ diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c index ae82ded334a..808be589bd9 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.c +++ b/src/gallium/drivers/cell/ppu/cell_context.c @@ -119,7 +119,7 @@ cell_create_context(struct pipe_screen *screen, cell->pipe.screen = screen; cell->pipe.destroy = cell_destroy_context; - cell->pipe.clear = cell_clear_surface; + cell->pipe.clear = cell_clear; cell->pipe.flush = cell_flush; #if 0 -- cgit v1.2.3 From a4a853e593c257d3b25f8229706d11b92e1ec8c8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 22:30:14 -0700 Subject: r300-gallium: Update clear() code. We have a huge optimization opportunity, but for now we'll just use the util. --- src/gallium/drivers/r300/r300_clear.c | 13 ++++++++----- src/gallium/drivers/r300/r300_clear.h | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/r300/r300_clear.c b/src/gallium/drivers/r300/r300_clear.c index 8506ed29424..8b9cb819ae6 100644 --- a/src/gallium/drivers/r300/r300_clear.c +++ b/src/gallium/drivers/r300/r300_clear.c @@ -22,11 +22,14 @@ #include "r300_clear.h" -/* This gets its own file because Intel's is in its own file. - * I assume there's a good reason. */ +/* Clears currently bound buffers. */ void r300_clear(struct pipe_context* pipe, - struct pipe_surface* ps, - unsigned color) + unsigned buffers, + const float* rgba, + double depth, + unsigned stencil) { - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color); + /* XXX we can and should do one clear if both color and zs are set */ + util_clear(pipe, &r300_context(pipe)->framebuffer_state, + buffers, rgba, depth, stencil); } diff --git a/src/gallium/drivers/r300/r300_clear.h b/src/gallium/drivers/r300/r300_clear.h index e24a0690c9b..cd5900565e8 100644 --- a/src/gallium/drivers/r300/r300_clear.h +++ b/src/gallium/drivers/r300/r300_clear.h @@ -20,8 +20,17 @@ * 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" +#ifndef R300_CLEAR_H +#define R300_CLEAR_H + +#include "util/u_clear.h" + +#include "r300_context.h" void r300_clear(struct pipe_context* pipe, - struct pipe_surface* ps, - unsigned color); + unsigned buffers, + const float* rgba, + double depth, + unsigned stencil); + +#endif /* R300_CLEAR_H */ -- cgit v1.2.3 From 7cd535b47805cc086783cc4aa857292b5986672e Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 22:57:45 -0700 Subject: r300-gallium: vs: Expand instruction emission. --- src/gallium/drivers/r300/r300_state_tcl.c | 57 +++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index ddf43604b9a..457da5b7ef1 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -54,6 +54,34 @@ static void r300_vs_declare(struct r300_vs_asm* assembler, assembler->temp_offset = assembler->color_count + assembler->tex_count; } +static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler, + struct tgsi_src_register* src) +{ + switch (src->File) { + case TGSI_FILE_TEMPORARY: + return R300_PVS_SRC_REG_TEMPORARY; + break; + default: + debug_printf("r300: vs: Unimplemented src type %d\n", src->File); + break; + } + return 0; +} + +static INLINE unsigned r300_vs_dst_type(struct r300_vs_asm* assembler, + struct tgsi_dst_register* dst) +{ + switch (dst->File) { + case TGSI_FILE_OUTPUT: + return R300_PVS_DST_REG_OUT; + break; + default: + debug_printf("r300: vs: Unimplemented dst type %d\n", dst->File); + break; + } + return 0; +} + static INLINE unsigned r300_vs_src(struct r300_vs_asm* assembler, struct tgsi_src_register* src) { @@ -105,12 +133,37 @@ static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler, static void r300_vs_emit_inst(struct r300_vertex_shader* vs, struct r300_vs_asm* assembler, struct tgsi_full_src_register* src, - struct tgsi_full_dst_register* dst) + struct tgsi_full_dst_register* dst, + unsigned op, + unsigned count) { int i = vs->instruction_count; vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | - R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) | + R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, dst->DstRegister)) | R300_PVS_DST_OFFSET(dst->DstRegister.Index); + switch (count) { + case 3: + vs->instructions[i].inst3 = + R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, + &src[2].SrcRegister)) | + R300_PVS_SRC_OFFSET(src[2].SrcRegister.Index) | + R300_PVS_SRC_SWIZZLE(R300_PVS_SRC_SWIZZLE_XYZW); + /* Fall through */ + case 2: + vs->instructions[i].inst2 = + R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, + &src[1].SrcRegister)) | + R300_PVS_SRC_OFFSET(src[1].SrcRegister.Index) | + R300_PVS_SRC_SWIZZLE(R300_PVS_SRC_SWIZZLE_XYZW); + /* Fall through */ + case 1: + vs->instructions[i].inst1 = + R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, + &src[0].SrcRegister)) | + R300_PVS_SRC_OFFSET(src[0].SrcRegister.Index) | + R300_PVS_SRC_SWIZZLE(R300_PVS_SRC_SWIZZLE_XYZW); + break; + } } static void r300_vs_instruction(struct r300_vertex_shader* vs, -- cgit v1.2.3 From 316b244ff1b18b3916ebd31078ba4c920e9585c1 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 4 Apr 2009 23:44:37 -0700 Subject: r300-gallium: vs: Moar vert shaders. --- src/gallium/drivers/r300/r300_state_tcl.c | 34 ++++++++++++++++++++++++++----- src/gallium/drivers/r300/r300_state_tcl.h | 9 ++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index 457da5b7ef1..f01db2df3a2 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -58,6 +58,9 @@ static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler, struct tgsi_src_register* src) { switch (src->File) { + case TGSI_FILE_INPUT: + return R300_PVS_SRC_REG_INPUT; + break; case TGSI_FILE_TEMPORARY: return R300_PVS_SRC_REG_TEMPORARY; break; @@ -72,6 +75,9 @@ static INLINE unsigned r300_vs_dst_type(struct r300_vs_asm* assembler, struct tgsi_dst_register* dst) { switch (dst->File) { + case TGSI_FILE_TEMPORARY: + return R300_PVS_DST_REG_TEMPORARY; + break; case TGSI_FILE_OUTPUT: return R300_PVS_DST_REG_OUT; break; @@ -130,6 +136,21 @@ static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler, return 0; } +static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg) +{ + if (reg->SrcRegister.Extended) { + return reg->SrcRegisterExtSwz.ExtSwizzleX | + (reg->SrcRegisterExtSwz.ExtSwizzleY << 3) | + (reg->SrcRegisterExtSwz.ExtSwizzleZ << 6) | + (reg->SrcRegisterExtSwz.ExtSwizzleW << 9); + } else { + return reg->SrcRegister.SwizzleX | + (reg->SrcRegister.SwizzleY << 3) | + (reg->SrcRegister.SwizzleZ << 6) | + (reg->SrcRegister.SwizzleW << 9); + } +} + static void r300_vs_emit_inst(struct r300_vertex_shader* vs, struct r300_vs_asm* assembler, struct tgsi_full_src_register* src, @@ -139,7 +160,7 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs, { int i = vs->instruction_count; vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | - R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, dst->DstRegister)) | + R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, &dst->DstRegister)) | R300_PVS_DST_OFFSET(dst->DstRegister.Index); switch (count) { case 3: @@ -147,21 +168,21 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs, R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, &src[2].SrcRegister)) | R300_PVS_SRC_OFFSET(src[2].SrcRegister.Index) | - R300_PVS_SRC_SWIZZLE(R300_PVS_SRC_SWIZZLE_XYZW); + R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[2])); /* Fall through */ case 2: vs->instructions[i].inst2 = R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, &src[1].SrcRegister)) | R300_PVS_SRC_OFFSET(src[1].SrcRegister.Index) | - R300_PVS_SRC_SWIZZLE(R300_PVS_SRC_SWIZZLE_XYZW); + R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[1])); /* Fall through */ case 1: vs->instructions[i].inst1 = R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, &src[0].SrcRegister)) | R300_PVS_SRC_OFFSET(src[0].SrcRegister.Index) | - R300_PVS_SRC_SWIZZLE(R300_PVS_SRC_SWIZZLE_XYZW); + R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[0])); break; } } @@ -172,8 +193,11 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, { switch (inst->Instruction.Opcode) { case TGSI_OPCODE_MOV: + case TGSI_OPCODE_SWZ: + inst->FullSrcRegisters[1] = r300_constant_zero; r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, - &inst->FullDstRegisters[0]); + &inst->FullDstRegisters[0], inst->Instruction.Opcode, + 2); break; case TGSI_OPCODE_END: break; diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index b947f0d1cf6..ae8ff6c3147 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -69,6 +69,15 @@ (R300_PVS_SRC_SELECT_FORCE_1 << 6) | \ (R300_PVS_SRC_SELECT_FORCE_1 << 9)) << 13) +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 { -- cgit v1.2.3 From 484795ff14faa794b7a150f29554a73e0113f67d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 5 Apr 2009 00:15:19 -0700 Subject: r300-gallium: Update state handlers/setters for vertex shaders. --- src/gallium/drivers/r300/r300_state.c | 65 ++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index b1d85260cc1..4dee4ab8ce1 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -333,9 +333,12 @@ static void* r300_create_rs_state(struct pipe_context* pipe, { struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state); - /* XXX this is part of HW TCL */ /* XXX endian control */ - rs->vap_control_status = R300_VAP_TCL_BYPASS; + if (r300_screen(pipe->screen)->caps->has_tcl) { + rs->vap_control_status = 0; + } else { + rs->vap_control_status = R300_VAP_TCL_BYPASS; + } rs->point_size = pack_float_16_6x(state->point_size) | (pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT); @@ -584,31 +587,61 @@ static void r300_set_vertex_elements(struct pipe_context* pipe, const struct pipe_vertex_element* elements) { struct r300_context* r300 = r300_context(pipe); - /* XXX Draw */ + draw_flush(r300->draw); draw_set_vertex_elements(r300->draw, count, elements); } static void* r300_create_vs_state(struct pipe_context* pipe, - const struct pipe_shader_state* state) + const struct pipe_shader_state* shader) { - struct r300_context* context = r300_context(pipe); - tgsi_dump(state->tokens); - /* XXX handing this off to Draw for now */ - return draw_create_vertex_shader(context->draw, state); + struct r300_context* r300 = r300_context(pipe); + + if (r300_screen(pipe->screen)->caps->has_tcl) { + struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader); + /* Copy state directly into shader. */ + vs->state = *shader; + + tgsi_scan_shader(shader->tokens, &vs->info); + + return (void*)vs; + } else { + return draw_create_vertex_shader(r300->draw, shader); + } } -static void r300_bind_vs_state(struct pipe_context* pipe, void* state) { - struct r300_context* context = r300_context(pipe); - /* XXX handing this off to Draw for now */ - draw_bind_vertex_shader(context->draw, (struct draw_vertex_shader*)state); +static void r300_bind_vs_state(struct pipe_context* pipe, void* shader) +{ + struct r300_context* r300 = r300_context(pipe); + + if (r300_screen(pipe->screen)->caps->has_tcl) { + struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader; + + if (vs == NULL) { + r300->vs = NULL; + return; + } else if (!vs->translated) { + r300_translate_vertex_shader(r300, vs); + } + + r300->vs = vs; + r300->dirty_state |= R300_NEW_VERTEX_SHADER; + } else { + draw_bind_vertex_shader(r300->draw, + (struct draw_vertex_shader*)shader); + } } -static void r300_delete_vs_state(struct pipe_context* pipe, void* state) +static void r300_delete_vs_state(struct pipe_context* pipe, void* shader) { - struct r300_context* context = r300_context(pipe); - /* XXX handing this off to Draw for now */ - draw_delete_vertex_shader(context->draw, (struct draw_vertex_shader*)state); + struct r300_context* r300 = r300_context(pipe); + + if (r300_screen(pipe->screen)->caps->has_tcl) { + FREE(shader); + } else { + draw_delete_vertex_shader(r300->draw, + (struct draw_vertex_shader*)shader); + } } void r300_init_state_functions(struct r300_context* r300) -- cgit v1.2.3 From ce7963f338ab95b06619074bc6aaf99c96ff5f11 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 5 Apr 2009 01:00:25 -0700 Subject: r300-gallium: Properly interface with Draw for vert shaders. --- src/gallium/drivers/r300/r300_context.h | 3 +++ src/gallium/drivers/r300/r300_debug.c | 12 ++++++++++++ src/gallium/drivers/r300/r300_debug.h | 3 +++ src/gallium/drivers/r300/r300_state.c | 12 ++++++++++++ src/gallium/drivers/r300/r300_state_tcl.c | 1 + 5 files changed, 31 insertions(+) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 9d2a07a7d97..fec2bad5461 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -236,6 +236,9 @@ struct r300_vertex_shader { struct pipe_shader_state state; struct tgsi_shader_info info; + /* Fallback shader, because Draw has issues */ + struct draw_vertex_shader* draw; + /* Has this shader been translated yet? */ boolean translated; diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 8d44756c332..dd63136c9d6 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -224,3 +224,15 @@ void r500_fs_dump(struct r500_fragment_shader* fs) } } } + +void r300_vs_dump(struct r300_vertex_shader* vs) +{ + int i; + + for (i = 0; i < vs->instruction_count; i++) { + debug_printf("inst0: 0x%x\n", vs->instructions[i].inst0); + debug_printf("inst1: 0x%x\n", vs->instructions[i].inst1); + debug_printf("inst2: 0x%x\n", vs->instructions[i].inst2); + debug_printf("inst3: 0x%x\n", vs->instructions[i].inst3); + } +} diff --git a/src/gallium/drivers/r300/r300_debug.h b/src/gallium/drivers/r300/r300_debug.h index de5d701ed9c..a1f873656dc 100644 --- a/src/gallium/drivers/r300/r300_debug.h +++ b/src/gallium/drivers/r300/r300_debug.h @@ -25,7 +25,10 @@ #include "r300_reg.h" #include "r300_state_shader.h" +#include "r300_state_tcl.h" void r500_fs_dump(struct r500_fragment_shader* fs); +void r300_vs_dump(struct r300_vertex_shader* vs); + #endif /* R300_DEBUG_H */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 4dee4ab8ce1..5b3bb328ddf 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -403,6 +403,11 @@ static void* r300_create_rs_state(struct pipe_context* pipe, rs->rs = *state; + /* If using HW TCL, tell Draw to not do its magic. */ + if (r300_screen(pipe->screen)->caps->has_tcl) { + rs->rs.bypass_vs_clip_and_viewport = TRUE; + } + return (void*)rs; } @@ -604,6 +609,9 @@ static void* r300_create_vs_state(struct pipe_context* pipe, tgsi_scan_shader(shader->tokens, &vs->info); + /* Appease Draw. */ + vs->draw = draw_create_vertex_shader(r300->draw, shader); + return (void*)vs; } else { return draw_create_vertex_shader(r300->draw, shader); @@ -624,6 +632,7 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader) r300_translate_vertex_shader(r300, vs); } + draw_bind_vertex_shader(r300->draw, vs->draw); r300->vs = vs; r300->dirty_state |= R300_NEW_VERTEX_SHADER; } else { @@ -637,6 +646,9 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader) struct r300_context* r300 = r300_context(pipe); if (r300_screen(pipe->screen)->caps->has_tcl) { + struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader; + + draw_delete_vertex_shader(r300->draw, vs->draw); FREE(shader); } else { draw_delete_vertex_shader(r300->draw, diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index f01db2df3a2..d0dc4ef1114 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -267,6 +267,7 @@ void r300_translate_vertex_shader(struct r300_context* r300, tgsi_dump(vs->state.tokens); /* XXX finish r300 vertex shader dumper */ + r300_vs_dump(vs); tgsi_parse_free(&parser); FREE(assembler); -- cgit v1.2.3 From 50ee103cf02b66d68a2728840c9c2f990773576b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 5 Apr 2009 01:32:00 -0700 Subject: r300-gallium: Re-translate shaders if constants change. --- src/gallium/drivers/r300/r300_state.c | 9 +++++++-- src/gallium/drivers/r300/r300_state_derived.c | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 5b3bb328ddf..095df04630f 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -153,8 +153,13 @@ static void /* If the number of constants have changed, invalidate the shader. */ if (r300->shader_constants[shader].user_count != i) { - r300->fs->translated = FALSE; - r300_translate_fragment_shader(r300, r300->fs); + if (shader == PIPE_SHADER_FRAGMENT && r300->fs) { + r300->fs->translated = FALSE; + r300_translate_fragment_shader(r300, r300->fs); + } else if (shader == PIPE_SHADER_VERTEX && r300->vs) { + r300->vs->translated = FALSE; + r300_translate_vertex_shader(r300, r300->vs); + } } } diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 2f34698e359..f1feafbcf91 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -305,7 +305,8 @@ static void r300_update_rs_block(struct r300_context* r300) void r300_update_derived_state(struct r300_context* r300) { - if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER) { + if (r300->dirty_state & + (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) { r300_update_vertex_layout(r300); } -- cgit v1.2.3 From 84d76607ec0e43edd7dd28d1d5b6a538fd087434 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 5 Apr 2009 01:32:55 -0700 Subject: r300-gallium: vs: Use a tab to properly set up OVM. --- src/gallium/drivers/r300/r300_state_tcl.c | 55 +++++++++---------------------- src/gallium/drivers/r300/r300_state_tcl.h | 6 ++-- 2 files changed, 17 insertions(+), 44 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index d0dc4ef1114..a00abfd02fd 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -27,12 +27,18 @@ static void r300_vs_declare(struct r300_vs_asm* assembler, { switch (decl->Declaration.File) { case TGSI_FILE_INPUT: + break; + case TGSI_FILE_OUTPUT: switch (decl->Semantic.SemanticName) { + case TGSI_SEMANTIC_POSITION: + assembler->tab[decl->DeclarationRange.First] = 0; + break; case TGSI_SEMANTIC_COLOR: - assembler->color_count++; + assembler->tab[decl->DeclarationRange.First] = 2; break; case TGSI_SEMANTIC_GENERIC: - assembler->tex_count++; + /* XXX multiple? */ + assembler->tab[decl->DeclarationRange.First] = 6; break; default: debug_printf("r300: vs: Bad semantic declaration %d\n", @@ -40,7 +46,6 @@ static void r300_vs_declare(struct r300_vs_asm* assembler, break; } break; - case TGSI_FILE_OUTPUT: case TGSI_FILE_CONSTANT: break; case TGSI_FILE_TEMPORARY: @@ -50,8 +55,6 @@ static void r300_vs_declare(struct r300_vs_asm* assembler, debug_printf("r300: vs: Bad file %d\n", decl->Declaration.File); break; } - - assembler->temp_offset = assembler->color_count + assembler->tex_count; } static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler, @@ -88,46 +91,15 @@ static INLINE unsigned r300_vs_dst_type(struct r300_vs_asm* assembler, return 0; } -static INLINE unsigned r300_vs_src(struct r300_vs_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: vs: Unimplemented src %d\n", src->File); - break; - } - return 0; -} - static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler, struct tgsi_dst_register* dst) { switch (dst->File) { - case TGSI_FILE_NULL: - /* This happens during KIL instructions. */ - return 0; + case TGSI_FILE_TEMPORARY: + return dst->Index; break; case TGSI_FILE_OUTPUT: - return 0; - break; - case TGSI_FILE_TEMPORARY: - return dst->Index + assembler->temp_offset; + return assembler->tab[dst->Index]; break; default: debug_printf("r300: vs: Unimplemented dst %d\n", dst->File); @@ -161,7 +133,7 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs, int i = vs->instruction_count; vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, &dst->DstRegister)) | - R300_PVS_DST_OFFSET(dst->DstRegister.Index); + R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister)); switch (count) { case 3: vs->instructions[i].inst3 = @@ -265,6 +237,9 @@ void r300_translate_vertex_shader(struct r300_context* r300, "%d from user and %d from immediates\n", consts->count, consts->user_count, assembler->imm_count); + 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); /* 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_state_tcl.h index ae8ff6c3147..75fe44aec50 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -87,10 +87,6 @@ struct r300_vs_asm { 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 @@ -99,6 +95,8 @@ struct r300_vs_asm { unsigned imm_offset; /* Number of immediate constants. */ unsigned imm_count; + /* Offsets into vertex output memory. */ + unsigned tab[16]; }; static struct r300_vertex_shader r300_passthrough_vertex_shader = { -- cgit v1.2.3 From 36ae0766b90a1545ea3d9381974602d8e6fe8642 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 5 Apr 2009 02:05:08 -0700 Subject: r300-gallium: vp: Moar. --- src/gallium/drivers/r300/r300_state_tcl.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index a00abfd02fd..0f9abb598f0 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -61,6 +61,10 @@ static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler, struct tgsi_src_register* src) { switch (src->File) { + case TGSI_FILE_NULL: + /* Probably a zero or one swizzle */ + return R300_PVS_SRC_REG_INPUT; + break; case TGSI_FILE_INPUT: return R300_PVS_SRC_REG_INPUT; break; @@ -108,6 +112,19 @@ static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler, return 0; } +static uint32_t r300_vs_op(unsigned op) +{ + switch (op) { + case TGSI_OPCODE_ADD: + case TGSI_OPCODE_MOV: + case TGSI_OPCODE_SWZ: + return R300_VE_ADD; + default: + break; + } + return 0; +} + static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg) { if (reg->SrcRegister.Extended) { @@ -131,9 +148,10 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs, unsigned count) { int i = vs->instruction_count; - vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | + vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(r300_vs_op(op)) | R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, &dst->DstRegister)) | - R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister)); + R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister)) | + R300_PVS_DST_WE_XYZW; switch (count) { case 3: vs->instructions[i].inst3 = @@ -157,6 +175,7 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs, R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[0])); break; } + vs->instruction_count++; } static void r300_vs_instruction(struct r300_vertex_shader* vs, @@ -164,6 +183,11 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, struct tgsi_full_instruction* inst) { switch (inst->Instruction.Opcode) { + case TGSI_OPCODE_ADD: + r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], inst->Instruction.Opcode, + 2); + break; case TGSI_OPCODE_MOV: case TGSI_OPCODE_SWZ: inst->FullSrcRegisters[1] = r300_constant_zero; -- cgit v1.2.3 From e798bf8053612516420a4ec42e2ff58433abd521 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 6 Apr 2009 08:59:57 +0200 Subject: radeon: Expose a 32 bit RGBA fbconfig even when the screen depth is 16. Otherwise current xserver / libGL no longer expose a 32 bit RGBA GLX visual, and compiz fails. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20479 . --- src/mesa/drivers/dri/radeon/radeon_screen.c | 35 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index e964feb9cc4..882853344bb 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -261,8 +261,6 @@ radeonFillInModes( __DRIscreenPrivate *psp, __GLcontextModes *m; unsigned depth_buffer_factor; unsigned back_buffer_factor; - GLenum fb_format; - GLenum fb_type; int i; /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy @@ -293,20 +291,27 @@ radeonFillInModes( __DRIscreenPrivate *psp, depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; - if ( pixel_bits == 16 ) { - fb_format = GL_RGB; - fb_type = GL_UNSIGNED_SHORT_5_6_5; - } - else { - fb_format = GL_BGRA; - fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; - } + if (pixel_bits == 16) { + __DRIconfig **configs_a8r8g8b8; + __DRIconfig **configs_r5g6b5; + + configs_r5g6b5 = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor, msaa_samples_array, + 1); + configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + depth_bits_array, stencil_bits_array, + 1, back_buffer_modes, 1, + msaa_samples_array, 1); + configs = driConcatConfigs(configs_r5g6b5, configs_a8r8g8b8); + } else + configs = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, back_buffer_factor, + msaa_samples_array, 1); - configs = driCreateConfigs(fb_format, fb_type, - depth_bits_array, stencil_bits_array, - depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); -- cgit v1.2.3 From 2d56d0839e6db0861131893d67fe23734800085a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 6 Apr 2009 15:51:27 +0100 Subject: r300-gallium: Skeleton for integrating into the python statetracker. --- src/gallium/winsys/drm/radeon/python/README | 15 + src/gallium/winsys/drm/radeon/python/SConscript | 33 ++ .../drm/radeon/python/radeon_hardpipe_winsys.c | 140 +++++ src/gallium/winsys/drm/radeon/python/xf86dri.c | 605 +++++++++++++++++++++ src/gallium/winsys/drm/radeon/python/xf86dri.h | 123 +++++ src/gallium/winsys/drm/radeon/python/xf86dristr.h | 389 +++++++++++++ 6 files changed, 1305 insertions(+) create mode 100644 src/gallium/winsys/drm/radeon/python/README create mode 100644 src/gallium/winsys/drm/radeon/python/SConscript create mode 100644 src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c create mode 100644 src/gallium/winsys/drm/radeon/python/xf86dri.c create mode 100644 src/gallium/winsys/drm/radeon/python/xf86dri.h create mode 100644 src/gallium/winsys/drm/radeon/python/xf86dristr.h diff --git a/src/gallium/winsys/drm/radeon/python/README b/src/gallium/winsys/drm/radeon/python/README new file mode 100644 index 00000000000..d9e49bce67b --- /dev/null +++ b/src/gallium/winsys/drm/radeon/python/README @@ -0,0 +1,15 @@ +Python bindings for the radeon gallium driver. + + +See gallium/src/gallium/state_trackers/python/README for more information. + + +Build as: + + scons debug=1 statetrackers=python winsys=drm/radeon/python + +Run as: + + export PYTHONPATH=$PWD/build/linux-x86-debug/gallium/winsys/drm/radeon/python:$PWD/build/linux-x86-debug/gallium/state_trackers/python + + python src/gallium/state_trackers/python/samples/tri.py diff --git a/src/gallium/winsys/drm/radeon/python/SConscript b/src/gallium/winsys/drm/radeon/python/SConscript new file mode 100644 index 00000000000..3200fd8d1b0 --- /dev/null +++ b/src/gallium/winsys/drm/radeon/python/SConscript @@ -0,0 +1,33 @@ +import os.path + +Import('*') + +if env['platform'] == 'linux': + + env = env.Clone() + + env.Tool('python') + + env.ParseConfig('pkg-config --cflags --libs libdrm') + + env.Prepend(CPPPATH = [ + '#src/gallium/state_trackers/python', + '../core', + ]) + + drivers = [ + softpipe, + radeon, + trace, + ] + + sources = [ + 'radeon_hardpipe_winsys.c', + 'xf86dri.c', + ] + + env.SharedLibrary( + target ='_gallium', + source = sources, + LIBS = [pyst] + drivers + auxiliaries + env['LIBS'], + ) diff --git a/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c b/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c new file mode 100644 index 00000000000..c3ec24aaf78 --- /dev/null +++ b/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c @@ -0,0 +1,140 @@ + /************************************************************************** + * + * 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 +#include +#include + +#include +#include +#include + +#include "pipe/p_screen.h" +#include "pipe/p_context.h" + +#include "st_winsys.h" + +#include "radeon_winsys.h" + +#include "xf86dri.h" + + +/* XXX: Force init_gallium symbol to be linked */ +extern void init_gallium(void); +void (*force_init_gallium_linkage)(void) = &init_gallium; + + +static struct pipe_screen * +radeon_hardpipe_screen_create(void) +{ + Display *dpy; + Window rootWin; + XWindowAttributes winAttr; + int isCapable; + int screen; + char *driverName; + char *curBusID; + unsigned magic; + int ddxDriverMajor; + int ddxDriverMinor; + int ddxDriverPatch; + drm_handle_t sAreaOffset; + int ret; + int drmFD; + drm_context_t hHWContext; + XID id; + + dpy = XOpenDisplay(":0"); + if (!dpy) { + fprintf(stderr, "Open Display Failed\n"); + return NULL; + } + + screen = DefaultScreen(dpy); + rootWin = RootWindow(dpy, screen); + XGetWindowAttributes(dpy, rootWin, &winAttr); + + ret = uniDRIQueryDirectRenderingCapable(dpy, screen, &isCapable); + if (!ret || !isCapable) { + fprintf(stderr, "No DRI on this display:sceen\n"); + goto error; + } + + if (!uniDRIOpenConnection(dpy, screen, &sAreaOffset, + &curBusID)) { + fprintf(stderr, "Could not open DRI connection.\n"); + goto error; + } + + if (!uniDRIGetClientDriverName(dpy, screen, &ddxDriverMajor, + &ddxDriverMinor, &ddxDriverPatch, + &driverName)) { + fprintf(stderr, "Could not get DRI driver name.\n"); + goto error; + } + + if ((drmFD = drmOpen(NULL, curBusID)) < 0) { + perror("DRM Device could not be opened"); + goto error; + } + + drmGetMagic(drmFD, &magic); + if (!uniDRIAuthConnection(dpy, screen, magic)) { + fprintf(stderr, "Could not get X server to authenticate us.\n"); + goto error; + } + + if (!uniDRICreateContext(dpy, screen, winAttr.visual, + &id, &hHWContext)) { + fprintf(stderr, "Could not create DRI context.\n"); + goto error; + } + + /* FIXME: create a radeon pipe_screen from drmFD and hHWContext */ + + return NULL; + +error: + return NULL; +} + + +static struct pipe_context * +radeon_hardpipe_context_create(struct pipe_screen *screen) +{ + /* FIXME: create a radon pipe_context from screen */ + + return NULL; +} + + +const struct st_winsys st_hardpipe_winsys = { + &radeon_hardpipe_screen_create, + &radeon_hardpipe_context_create, +}; + diff --git a/src/gallium/winsys/drm/radeon/python/xf86dri.c b/src/gallium/winsys/drm/radeon/python/xf86dri.c new file mode 100644 index 00000000000..1736f1e54f8 --- /dev/null +++ b/src/gallium/winsys/drm/radeon/python/xf86dri.c @@ -0,0 +1,605 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin + * Jens Owen + * Rickard E. (Rik) Faith + * + */ + +/* THIS IS NOT AN X CONSORTIUM STANDARD */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define NEED_REPLIES +#include +#include +#include +#include "xf86dristr.h" + +static XExtensionInfo _xf86dri_info_data; +static XExtensionInfo *xf86dri_info = &_xf86dri_info_data; +static char xf86dri_extension_name[] = XF86DRINAME; + +#define uniDRICheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, xf86dri_extension_name, val) + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +static int close_display(Display * dpy, XExtCodes * extCodes); +static /* const */ XExtensionHooks xf86dri_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + close_display, /* close_display */ + NULL, /* wire_to_event */ + NULL, /* event_to_wire */ + NULL, /* error */ + NULL, /* error_string */ +}; + +static +XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info, + xf86dri_extension_name, &xf86dri_extension_hooks, + 0, NULL) + + static XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info) + +/***************************************************************************** + * * + * public XFree86-DRI Extension routines * + * * + *****************************************************************************/ +#if 0 +#include +#define TRACE(msg) fprintf(stderr,"uniDRI%s\n", msg); +#else +#define TRACE(msg) +#endif + Bool uniDRIQueryExtension(dpy, event_basep, error_basep) + Display *dpy; + int *event_basep, *error_basep; +{ + XExtDisplayInfo *info = find_display(dpy); + + TRACE("QueryExtension..."); + if (XextHasExtension(info)) { + *event_basep = info->codes->first_event; + *error_basep = info->codes->first_error; + TRACE("QueryExtension... return True"); + return True; + } else { + TRACE("QueryExtension... return False"); + return False; + } +} + +Bool +uniDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion) + Display *dpy; + int *majorVersion; + int *minorVersion; + int *patchVersion; +{ + XExtDisplayInfo *info = find_display(dpy); + xXF86DRIQueryVersionReply rep; + xXF86DRIQueryVersionReq *req; + + TRACE("QueryVersion..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIQueryVersion, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIQueryVersion; + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + TRACE("QueryVersion... return False"); + return False; + } + *majorVersion = rep.majorVersion; + *minorVersion = rep.minorVersion; + *patchVersion = rep.patchVersion; + UnlockDisplay(dpy); + SyncHandle(); + TRACE("QueryVersion... return True"); + return True; +} + +Bool +uniDRIQueryDirectRenderingCapable(dpy, screen, isCapable) + Display *dpy; + int screen; + Bool *isCapable; +{ + XExtDisplayInfo *info = find_display(dpy); + xXF86DRIQueryDirectRenderingCapableReply rep; + xXF86DRIQueryDirectRenderingCapableReq *req; + + TRACE("QueryDirectRenderingCapable..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIQueryDirectRenderingCapable, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIQueryDirectRenderingCapable; + req->screen = screen; + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + TRACE("QueryDirectRenderingCapable... return False"); + return False; + } + *isCapable = rep.isCapable; + UnlockDisplay(dpy); + SyncHandle(); + TRACE("QueryDirectRenderingCapable... return True"); + return True; +} + +Bool +uniDRIOpenConnection(dpy, screen, hSAREA, busIdString) + Display *dpy; + int screen; + drm_handle_t *hSAREA; + char **busIdString; +{ + XExtDisplayInfo *info = find_display(dpy); + xXF86DRIOpenConnectionReply rep; + xXF86DRIOpenConnectionReq *req; + + TRACE("OpenConnection..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIOpenConnection, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIOpenConnection; + req->screen = screen; + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + TRACE("OpenConnection... return False"); + return False; + } + + *hSAREA = rep.hSAREALow; +#ifdef LONG64 + if (sizeof(drm_handle_t) == 8) { + *hSAREA |= ((unsigned long)rep.hSAREAHigh) << 32; + } +#endif + if (rep.length) { + if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) { + _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3)); + UnlockDisplay(dpy); + SyncHandle(); + TRACE("OpenConnection... return False"); + return False; + } + _XReadPad(dpy, *busIdString, rep.busIdStringLength); + } else { + *busIdString = NULL; + } + UnlockDisplay(dpy); + SyncHandle(); + TRACE("OpenConnection... return True"); + return True; +} + +Bool +uniDRIAuthConnection(dpy, screen, magic) + Display *dpy; + int screen; + drm_magic_t magic; +{ + XExtDisplayInfo *info = find_display(dpy); + xXF86DRIAuthConnectionReq *req; + xXF86DRIAuthConnectionReply rep; + + TRACE("AuthConnection..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIAuthConnection, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIAuthConnection; + req->screen = screen; + req->magic = magic; + rep.authenticated = 0; + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) { + UnlockDisplay(dpy); + SyncHandle(); + TRACE("AuthConnection... return False"); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + TRACE("AuthConnection... return True"); + return True; +} + +Bool +uniDRICloseConnection(dpy, screen) + Display *dpy; + int screen; +{ + XExtDisplayInfo *info = find_display(dpy); + xXF86DRICloseConnectionReq *req; + + TRACE("CloseConnection..."); + + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRICloseConnection, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRICloseConnection; + req->screen = screen; + UnlockDisplay(dpy); + SyncHandle(); + TRACE("CloseConnection... return True"); + return True; +} + +Bool +uniDRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion, + ddxDriverMinorVersion, ddxDriverPatchVersion, + clientDriverName) + Display *dpy; + int screen; + int *ddxDriverMajorVersion; + int *ddxDriverMinorVersion; + int *ddxDriverPatchVersion; + char **clientDriverName; +{ + XExtDisplayInfo *info = find_display(dpy); + xXF86DRIGetClientDriverNameReply rep; + xXF86DRIGetClientDriverNameReq *req; + + TRACE("GetClientDriverName..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIGetClientDriverName, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIGetClientDriverName; + req->screen = screen; + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + TRACE("GetClientDriverName... return False"); + return False; + } + + *ddxDriverMajorVersion = rep.ddxDriverMajorVersion; + *ddxDriverMinorVersion = rep.ddxDriverMinorVersion; + *ddxDriverPatchVersion = rep.ddxDriverPatchVersion; + + if (rep.length) { + if (!(*clientDriverName = + (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) { + _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3)); + UnlockDisplay(dpy); + SyncHandle(); + TRACE("GetClientDriverName... return False"); + return False; + } + _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength); + } else { + *clientDriverName = NULL; + } + UnlockDisplay(dpy); + SyncHandle(); + TRACE("GetClientDriverName... return True"); + return True; +} + +Bool +uniDRICreateContextWithConfig(dpy, screen, configID, context, hHWContext) + Display *dpy; + int screen; + int configID; + XID *context; + drm_context_t *hHWContext; +{ + XExtDisplayInfo *info = find_display(dpy); + xXF86DRICreateContextReply rep; + xXF86DRICreateContextReq *req; + + TRACE("CreateContext..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRICreateContext, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRICreateContext; + req->visual = configID; + req->screen = screen; + *context = XAllocID(dpy); + req->context = *context; + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + TRACE("CreateContext... return False"); + return False; + } + *hHWContext = rep.hHWContext; + UnlockDisplay(dpy); + SyncHandle(); + TRACE("CreateContext... return True"); + return True; +} + +Bool +uniDRICreateContext(dpy, screen, visual, context, hHWContext) + Display *dpy; + int screen; + Visual *visual; + XID *context; + drm_context_t *hHWContext; +{ + return uniDRICreateContextWithConfig(dpy, screen, visual->visualid, + context, hHWContext); +} + +Bool +uniDRIDestroyContext(Display * ndpy, int screen, XID context) +{ + Display *const dpy = (Display *) ndpy; + XExtDisplayInfo *info = find_display(dpy); + xXF86DRIDestroyContextReq *req; + + TRACE("DestroyContext..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIDestroyContext, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIDestroyContext; + req->screen = screen; + req->context = context; + UnlockDisplay(dpy); + SyncHandle(); + TRACE("DestroyContext... return True"); + return True; +} + +Bool +uniDRICreateDrawable(Display * ndpy, int screen, + Drawable drawable, drm_drawable_t * hHWDrawable) +{ + Display *const dpy = (Display *) ndpy; + XExtDisplayInfo *info = find_display(dpy); + xXF86DRICreateDrawableReply rep; + xXF86DRICreateDrawableReq *req; + + TRACE("CreateDrawable..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRICreateDrawable, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRICreateDrawable; + req->screen = screen; + req->drawable = drawable; + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + TRACE("CreateDrawable... return False"); + return False; + } + *hHWDrawable = rep.hHWDrawable; + UnlockDisplay(dpy); + SyncHandle(); + TRACE("CreateDrawable... return True"); + return True; +} + +Bool +uniDRIDestroyDrawable(Display * ndpy, int screen, Drawable drawable) +{ + Display *const dpy = (Display *) ndpy; + XExtDisplayInfo *info = find_display(dpy); + xXF86DRIDestroyDrawableReq *req; + + TRACE("DestroyDrawable..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIDestroyDrawable, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIDestroyDrawable; + req->screen = screen; + req->drawable = drawable; + UnlockDisplay(dpy); + SyncHandle(); + TRACE("DestroyDrawable... return True"); + return True; +} + +Bool +uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, + unsigned int *index, unsigned int *stamp, + int *X, int *Y, int *W, int *H, + int *numClipRects, drm_clip_rect_t ** pClipRects, + int *backX, int *backY, + int *numBackClipRects, + drm_clip_rect_t ** pBackClipRects) +{ + XExtDisplayInfo *info = find_display(dpy); + xXF86DRIGetDrawableInfoReply rep; + xXF86DRIGetDrawableInfoReq *req; + int total_rects; + + TRACE("GetDrawableInfo..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIGetDrawableInfo, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIGetDrawableInfo; + req->screen = screen; + req->drawable = drawable; + + if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + TRACE("GetDrawableInfo... return False"); + return False; + } + *index = rep.drawableTableIndex; + *stamp = rep.drawableTableStamp; + *X = (int)rep.drawableX; + *Y = (int)rep.drawableY; + *W = (int)rep.drawableWidth; + *H = (int)rep.drawableHeight; + *numClipRects = rep.numClipRects; + total_rects = *numClipRects; + + *backX = rep.backX; + *backY = rep.backY; + *numBackClipRects = rep.numBackClipRects; + total_rects += *numBackClipRects; + +#if 0 + /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks + * backwards compatibility (Because of the >> 2 shift) but the fix + * enables multi-threaded apps to work. + */ + if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) - + SIZEOF(xGenericReply) + + total_rects * sizeof(drm_clip_rect_t)) + + 3) & ~3) >> 2)) { + _XEatData(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + TRACE("GetDrawableInfo... return False"); + return False; + } +#endif + + if (*numClipRects) { + int len = sizeof(drm_clip_rect_t) * (*numClipRects); + + *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1); + if (*pClipRects) + _XRead(dpy, (char *)*pClipRects, len); + } else { + *pClipRects = NULL; + } + + if (*numBackClipRects) { + int len = sizeof(drm_clip_rect_t) * (*numBackClipRects); + + *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1); + if (*pBackClipRects) + _XRead(dpy, (char *)*pBackClipRects, len); + } else { + *pBackClipRects = NULL; + } + + UnlockDisplay(dpy); + SyncHandle(); + TRACE("GetDrawableInfo... return True"); + return True; +} + +Bool +uniDRIGetDeviceInfo(dpy, screen, hFrameBuffer, + fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate) + Display *dpy; + int screen; + drm_handle_t *hFrameBuffer; + int *fbOrigin; + int *fbSize; + int *fbStride; + int *devPrivateSize; + void **pDevPrivate; +{ + XExtDisplayInfo *info = find_display(dpy); + xXF86DRIGetDeviceInfoReply rep; + xXF86DRIGetDeviceInfoReq *req; + + TRACE("GetDeviceInfo..."); + uniDRICheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIGetDeviceInfo, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIGetDeviceInfo; + req->screen = screen; + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + TRACE("GetDeviceInfo... return False"); + return False; + } + + *hFrameBuffer = rep.hFrameBufferLow; +#ifdef LONG64 + if (sizeof(drm_handle_t) == 8) { + *hFrameBuffer |= ((unsigned long)rep.hFrameBufferHigh) << 32; + } +#endif + + *fbOrigin = rep.framebufferOrigin; + *fbSize = rep.framebufferSize; + *fbStride = rep.framebufferStride; + *devPrivateSize = rep.devPrivateSize; + + if (rep.length) { + if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) { + _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3)); + UnlockDisplay(dpy); + SyncHandle(); + TRACE("GetDeviceInfo... return False"); + return False; + } + _XRead(dpy, (char *)*pDevPrivate, rep.devPrivateSize); + } else { + *pDevPrivate = NULL; + } + + UnlockDisplay(dpy); + SyncHandle(); + TRACE("GetDeviceInfo... return True"); + return True; +} diff --git a/src/gallium/winsys/drm/radeon/python/xf86dri.h b/src/gallium/winsys/drm/radeon/python/xf86dri.h new file mode 100644 index 00000000000..bf6de37d9dd --- /dev/null +++ b/src/gallium/winsys/drm/radeon/python/xf86dri.h @@ -0,0 +1,123 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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. + +**************************************************************************/ + +/** + * \file xf86dri.h + * Protocol numbers and function prototypes for DRI X protocol. + * + * \author Kevin E. Martin + * \author Jens Owen + * \author Rickard E. (Rik) Faith + */ + +#ifndef _XF86DRI_H_ +#define _XF86DRI_H_ + +#include +#include +#include + +#define X_XF86DRIQueryVersion 0 +#define X_XF86DRIQueryDirectRenderingCapable 1 +#define X_XF86DRIOpenConnection 2 +#define X_XF86DRICloseConnection 3 +#define X_XF86DRIGetClientDriverName 4 +#define X_XF86DRICreateContext 5 +#define X_XF86DRIDestroyContext 6 +#define X_XF86DRICreateDrawable 7 +#define X_XF86DRIDestroyDrawable 8 +#define X_XF86DRIGetDrawableInfo 9 +#define X_XF86DRIGetDeviceInfo 10 +#define X_XF86DRIAuthConnection 11 +#define X_XF86DRIOpenFullScreen 12 /* Deprecated */ +#define X_XF86DRICloseFullScreen 13 /* Deprecated */ + +#define XF86DRINumberEvents 0 + +#define XF86DRIClientNotLocal 0 +#define XF86DRIOperationNotSupported 1 +#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1) + +#ifndef _XF86DRI_SERVER_ + +_XFUNCPROTOBEGIN + Bool uniDRIQueryExtension(Display * dpy, int *event_base, + int *error_base); + +Bool uniDRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion, + int *patchVersion); + +Bool uniDRIQueryDirectRenderingCapable(Display * dpy, int screen, + Bool * isCapable); + +Bool uniDRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, + char **busIDString); + +Bool uniDRIAuthConnection(Display * dpy, int screen, drm_magic_t magic); + +Bool uniDRICloseConnection(Display * dpy, int screen); + +Bool uniDRIGetClientDriverName(Display * dpy, int screen, + int *ddxDriverMajorVersion, + int *ddxDriverMinorVersion, + int *ddxDriverPatchVersion, + char **clientDriverName); + +Bool uniDRICreateContext(Display * dpy, int screen, Visual * visual, + XID * ptr_to_returned_context_id, + drm_context_t * hHWContext); + +Bool uniDRICreateContextWithConfig(Display * dpy, int screen, int configID, + XID * ptr_to_returned_context_id, + drm_context_t * hHWContext); + +extern Bool uniDRIDestroyContext(Display * dpy, int screen, XID context_id); + +extern Bool uniDRICreateDrawable(Display * dpy, int screen, + Drawable drawable, + drm_drawable_t * hHWDrawable); + +extern Bool uniDRIDestroyDrawable(Display * dpy, int screen, + Drawable drawable); + +Bool uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, + unsigned int *index, unsigned int *stamp, + int *X, int *Y, int *W, int *H, + int *numClipRects, drm_clip_rect_t ** pClipRects, + int *backX, int *backY, + int *numBackClipRects, + drm_clip_rect_t ** pBackClipRects); + +Bool uniDRIGetDeviceInfo(Display * dpy, int screen, + drm_handle_t * hFrameBuffer, int *fbOrigin, + int *fbSize, int *fbStride, int *devPrivateSize, + void **pDevPrivate); + +_XFUNCPROTOEND +#endif /* _XF86DRI_SERVER_ */ +#endif /* _XF86DRI_H_ */ diff --git a/src/gallium/winsys/drm/radeon/python/xf86dristr.h b/src/gallium/winsys/drm/radeon/python/xf86dristr.h new file mode 100644 index 00000000000..d8989963609 --- /dev/null +++ b/src/gallium/winsys/drm/radeon/python/xf86dristr.h @@ -0,0 +1,389 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin + * Jens Owen + * Rickard E. (Rik) Fiath + * + */ + +#ifndef _XF86DRISTR_H_ +#define _XF86DRISTR_H_ + +#include "xf86dri.h" + +#define XF86DRINAME "XFree86-DRI" + +/* The DRI version number. This was originally set to be the same of the + * XFree86 version number. However, this version is really indepedent of + * the XFree86 version. + * + * Version History: + * 4.0.0: Original + * 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02 + * 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02 + */ +#define XF86DRI_MAJOR_VERSION 4 +#define XF86DRI_MINOR_VERSION 1 +#define XF86DRI_PATCH_VERSION 0 + +typedef struct _XF86DRIQueryVersion +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIQueryVersion */ + CARD16 length B16; +} xXF86DRIQueryVersionReq; + +#define sz_xXF86DRIQueryVersionReq 4 + +typedef struct +{ + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD16 majorVersion B16; /* major version of DRI protocol */ + CARD16 minorVersion B16; /* minor version of DRI protocol */ + CARD32 patchVersion B32; /* patch version of DRI protocol */ + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXF86DRIQueryVersionReply; + +#define sz_xXF86DRIQueryVersionReply 32 + +typedef struct _XF86DRIQueryDirectRenderingCapable +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ + CARD16 length B16; + CARD32 screen B32; +} xXF86DRIQueryDirectRenderingCapableReq; + +#define sz_xXF86DRIQueryDirectRenderingCapableReq 8 + +typedef struct +{ + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + BOOL isCapable; + BOOL pad2; + BOOL pad3; + BOOL pad4; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; + CARD32 pad8 B32; + CARD32 pad9 B32; +} xXF86DRIQueryDirectRenderingCapableReply; + +#define sz_xXF86DRIQueryDirectRenderingCapableReply 32 + +typedef struct _XF86DRIOpenConnection +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIOpenConnection */ + CARD16 length B16; + CARD32 screen B32; +} xXF86DRIOpenConnectionReq; + +#define sz_xXF86DRIOpenConnectionReq 8 + +typedef struct +{ + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 hSAREALow B32; + CARD32 hSAREAHigh B32; + CARD32 busIdStringLength B32; + CARD32 pad6 B32; + CARD32 pad7 B32; + CARD32 pad8 B32; +} xXF86DRIOpenConnectionReply; + +#define sz_xXF86DRIOpenConnectionReply 32 + +typedef struct _XF86DRIAuthConnection +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICloseConnection */ + CARD16 length B16; + CARD32 screen B32; + CARD32 magic B32; +} xXF86DRIAuthConnectionReq; + +#define sz_xXF86DRIAuthConnectionReq 12 + +typedef struct +{ + BYTE type; + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 authenticated B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXF86DRIAuthConnectionReply; + +#define zx_xXF86DRIAuthConnectionReply 32 + +typedef struct _XF86DRICloseConnection +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICloseConnection */ + CARD16 length B16; + CARD32 screen B32; +} xXF86DRICloseConnectionReq; + +#define sz_xXF86DRICloseConnectionReq 8 + +typedef struct _XF86DRIGetClientDriverName +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIGetClientDriverName */ + CARD16 length B16; + CARD32 screen B32; +} xXF86DRIGetClientDriverNameReq; + +#define sz_xXF86DRIGetClientDriverNameReq 8 + +typedef struct +{ + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 ddxDriverMajorVersion B32; + CARD32 ddxDriverMinorVersion B32; + CARD32 ddxDriverPatchVersion B32; + CARD32 clientDriverNameLength B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXF86DRIGetClientDriverNameReply; + +#define sz_xXF86DRIGetClientDriverNameReply 32 + +typedef struct _XF86DRICreateContext +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICreateContext */ + CARD16 length B16; + CARD32 screen B32; + CARD32 visual B32; + CARD32 context B32; +} xXF86DRICreateContextReq; + +#define sz_xXF86DRICreateContextReq 16 + +typedef struct +{ + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 hHWContext B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXF86DRICreateContextReply; + +#define sz_xXF86DRICreateContextReply 32 + +typedef struct _XF86DRIDestroyContext +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIDestroyContext */ + CARD16 length B16; + CARD32 screen B32; + CARD32 context B32; +} xXF86DRIDestroyContextReq; + +#define sz_xXF86DRIDestroyContextReq 12 + +typedef struct _XF86DRICreateDrawable +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICreateDrawable */ + CARD16 length B16; + CARD32 screen B32; + CARD32 drawable B32; +} xXF86DRICreateDrawableReq; + +#define sz_xXF86DRICreateDrawableReq 12 + +typedef struct +{ + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 hHWDrawable B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXF86DRICreateDrawableReply; + +#define sz_xXF86DRICreateDrawableReply 32 + +typedef struct _XF86DRIDestroyDrawable +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIDestroyDrawable */ + CARD16 length B16; + CARD32 screen B32; + CARD32 drawable B32; +} xXF86DRIDestroyDrawableReq; + +#define sz_xXF86DRIDestroyDrawableReq 12 + +typedef struct _XF86DRIGetDrawableInfo +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIGetDrawableInfo */ + CARD16 length B16; + CARD32 screen B32; + CARD32 drawable B32; +} xXF86DRIGetDrawableInfoReq; + +#define sz_xXF86DRIGetDrawableInfoReq 12 + +typedef struct +{ + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 drawableTableIndex B32; + CARD32 drawableTableStamp B32; + INT16 drawableX B16; + INT16 drawableY B16; + INT16 drawableWidth B16; + INT16 drawableHeight B16; + CARD32 numClipRects B32; + INT16 backX B16; + INT16 backY B16; + CARD32 numBackClipRects B32; +} xXF86DRIGetDrawableInfoReply; + +#define sz_xXF86DRIGetDrawableInfoReply 36 + +typedef struct _XF86DRIGetDeviceInfo +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIGetDeviceInfo */ + CARD16 length B16; + CARD32 screen B32; +} xXF86DRIGetDeviceInfoReq; + +#define sz_xXF86DRIGetDeviceInfoReq 8 + +typedef struct +{ + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 hFrameBufferLow B32; + CARD32 hFrameBufferHigh B32; + CARD32 framebufferOrigin B32; + CARD32 framebufferSize B32; + CARD32 framebufferStride B32; + CARD32 devPrivateSize B32; +} xXF86DRIGetDeviceInfoReply; + +#define sz_xXF86DRIGetDeviceInfoReply 32 + +typedef struct _XF86DRIOpenFullScreen +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIOpenFullScreen */ + CARD16 length B16; + CARD32 screen B32; + CARD32 drawable B32; +} xXF86DRIOpenFullScreenReq; + +#define sz_xXF86DRIOpenFullScreenReq 12 + +typedef struct +{ + BYTE type; + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 isFullScreen B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXF86DRIOpenFullScreenReply; + +#define sz_xXF86DRIOpenFullScreenReply 32 + +typedef struct _XF86DRICloseFullScreen +{ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICloseFullScreen */ + CARD16 length B16; + CARD32 screen B32; + CARD32 drawable B32; +} xXF86DRICloseFullScreenReq; + +#define sz_xXF86DRICloseFullScreenReq 12 + +typedef struct +{ + BYTE type; + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; +} xXF86DRICloseFullScreenReply; + +#define sz_xXF86DRICloseFullScreenReply 32 + +#endif /* _XF86DRISTR_H_ */ -- cgit v1.2.3 From 5cca1ceb814ea9c5991d8b694d99a588c40b9860 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 6 Apr 2009 09:29:14 -0700 Subject: intel: Clean up some a leftover from sedding of bufmgr context->screen move. --- src/mesa/drivers/dri/intel/intel_screen.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index d20ea151877..752195aa35c 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -613,9 +613,6 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen) &intelScreen->sarea->last_dispatch); } - /* XXX bufmgr should be per-screen, not per-context */ - intelScreen->ttm = intelScreen->ttm; - return GL_TRUE; } -- cgit v1.2.3 From e7aef006e50d0b859c621267af8376f5a0f43445 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 6 Apr 2009 09:38:16 -0700 Subject: i965: Use GTT maps when available to upload vertex arrays and system VBOs. This speeds up OA on my GM45 by 21% (more than the original CPU cost of the upload path). We might still be able to squeeze a few more percent out by avoiding repeatedly mapping/unmapping buffers as we upload elements into them. --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 66 +++++++++++++++++++++-------- src/mesa/drivers/dri/intel/intel_screen.c | 6 +++ src/mesa/drivers/dri/intel/intel_screen.h | 1 + 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 02998d59571..b91b20bec6f 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -277,6 +277,7 @@ copy_array_to_vbo_array( struct brw_context *brw, struct brw_vertex_element *element, GLuint dst_stride) { + struct intel_context *intel = &brw->intel; GLuint size = element->count * dst_stride; get_space(brw, size, &element->bo, &element->offset); @@ -289,29 +290,52 @@ copy_array_to_vbo_array( struct brw_context *brw, } if (dst_stride == element->glarray->StrideB) { - dri_bo_subdata(element->bo, - element->offset, - size, - element->glarray->Ptr); + if (intel->intelScreen->kernel_exec_fencing) { + drm_intel_gem_bo_map_gtt(element->bo); + memcpy((char *)element->bo->virtual + element->offset, + element->glarray->Ptr, size); + drm_intel_gem_bo_unmap_gtt(element->bo); + } else { + dri_bo_subdata(element->bo, + element->offset, + size, + element->glarray->Ptr); + } } else { - void *data; char *dest; const unsigned char *src = element->glarray->Ptr; int i; - data = _mesa_malloc(dst_stride * element->count); - dest = data; - for (i = 0; i < element->count; i++) { - memcpy(dest, src, dst_stride); - src += element->glarray->StrideB; - dest += dst_stride; - } + if (intel->intelScreen->kernel_exec_fencing) { + drm_intel_gem_bo_map_gtt(element->bo); + dest = element->bo->virtual; + dest += element->offset; - dri_bo_subdata(element->bo, - element->offset, - size, - data); - _mesa_free(data); + for (i = 0; i < element->count; i++) { + memcpy(dest, src, dst_stride); + src += element->glarray->StrideB; + dest += dst_stride; + } + + drm_intel_gem_bo_unmap_gtt(element->bo); + } else { + void *data; + + data = _mesa_malloc(dst_stride * element->count); + dest = data; + for (i = 0; i < element->count; i++) { + memcpy(dest, src, dst_stride); + src += element->glarray->StrideB; + dest += dst_stride; + } + + dri_bo_subdata(element->bo, + element->offset, + size, + data); + + _mesa_free(data); + } } } @@ -563,7 +587,13 @@ static void brw_prepare_indices(struct brw_context *brw) /* Straight upload */ - dri_bo_subdata(bo, offset, ib_size, index_buffer->ptr); + if (intel->intelScreen->kernel_exec_fencing) { + drm_intel_gem_bo_map_gtt(bo); + memcpy((char *)bo->virtual + offset, index_buffer->ptr, ib_size); + drm_intel_gem_bo_unmap_gtt(bo); + } else { + dri_bo_subdata(bo, offset, ib_size, index_buffer->ptr); + } } else { offset = (GLuint) (unsigned long) index_buffer->ptr; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 752195aa35c..65e62947ef6 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -563,6 +563,7 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen) GLboolean gem_supported; struct drm_i915_getparam gp; __DRIscreenPrivate *spriv = intelScreen->driScrnPriv; + int num_fences; intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL; @@ -613,6 +614,11 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen) &intelScreen->sarea->last_dispatch); } + if (intel_get_param(spriv, I915_PARAM_NUM_FENCES_AVAIL, &num_fences)) + intelScreen->kernel_exec_fencing = !!num_fences; + else + intelScreen->kernel_exec_fencing = GL_FALSE; + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h index e1036de4db8..a9b9e109a6a 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.h +++ b/src/mesa/drivers/dri/intel/intel_screen.h @@ -79,6 +79,7 @@ typedef struct GLboolean no_vbo; int ttm; dri_bufmgr *bufmgr; + GLboolean kernel_exec_fencing; /** * Configuration cache with default values for all contexts -- cgit v1.2.3 From 6b187cc8a5041fe2bba1ecc34aa86516ebe8b1b0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 6 Apr 2009 09:54:29 -0700 Subject: intel: Avoid dri2 GetBuffers round-trips for internal Viewport calls. This gets us the savings for driver-internal viewport calls that dd1c68f15123a889a3ce9d2afe724e272d163e32 was attempting, without relying on Xlib internals or clients handling X events. --- src/mesa/drivers/dri/intel/intel_context.c | 8 +++++--- src/mesa/drivers/dri/intel/intel_context.h | 1 + src/mesa/drivers/dri/intel/intel_pixel.c | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 888bb3f18f6..a664e749360 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -307,9 +307,11 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) if (!driContext->driScreenPriv->dri2.enabled) return; - intel_update_renderbuffers(driContext, driContext->driDrawablePriv); - if (driContext->driDrawablePriv != driContext->driReadablePriv) - intel_update_renderbuffers(driContext, driContext->driReadablePriv); + if (!intel->internal_viewport_call) { + intel_update_renderbuffers(driContext, driContext->driDrawablePriv); + if (driContext->driDrawablePriv != driContext->driReadablePriv) + intel_update_renderbuffers(driContext, driContext->driReadablePriv); + } old_viewport = ctx->Driver.Viewport; ctx->Driver.Viewport = NULL; diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index e520ecf220d..d635f3f50dc 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -180,6 +180,7 @@ 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 diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index 7041ff389ac..fc0ac0b79c0 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -184,7 +184,9 @@ intel_meta_set_passthrough_transform(struct intel_context *intel) 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(); @@ -206,8 +208,10 @@ intel_meta_restore_transform(struct intel_context *intel) _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; } /** -- cgit v1.2.3 From 8332925c3caadd293d0c091ef84f7268c673013c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 6 Apr 2009 20:36:54 +0100 Subject: mesa: Fix orientation adjustment for reading stencil pixels. Fixes conform spcorner.c & spclear.c failure. --- src/mesa/state_tracker/st_cb_readpixels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index ce7a8cda4e8..e151efcb88f 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -68,7 +68,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, GLint j; if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { - y = ctx->DrawBuffer->Height - y - 1; + y = ctx->DrawBuffer->Height - y - height; } /* Create a read transfer from the renderbuffer's texture */ -- cgit v1.2.3 From b48eb05f1f547e2b03a22056f3e82ee7b9065337 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Apr 2009 13:51:14 -0600 Subject: swrast: fix texture border color interpretation The texture border color must be interpreted according to the texture's base format. For example, for a GL_ALPHA texture, sampling the border color should return (0,0,0,borderAlpha). This wasn't an issue here until I removed the legacy texenv code (we always use the combiner path now). --- src/mesa/swrast/s_texfilter.c | 98 ++++++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 30 deletions(-) diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index d84f37e576b..a483023a503 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -734,6 +734,44 @@ compute_min_mag_ranges(const struct gl_texture_object *tObj, } +/** + * When we sample the border color, it must be interpreted according to + * the base texture format. Ex: if the texture base format it GL_ALPHA, + * we return (0,0,0,BorderAlpha). + */ +static INLINE void +get_border_color(const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + GLfloat rgba[4]) +{ + switch (img->TexFormat->BaseFormat) { + case GL_RGB: + rgba[0] = tObj->BorderColor[0]; + rgba[1] = tObj->BorderColor[1]; + rgba[2] = tObj->BorderColor[2]; + rgba[3] = 1.0F; + break; + case GL_ALPHA: + rgba[0] = rgba[1] = rgba[2] = 0.0; + rgba[3] = tObj->BorderColor[3]; + break; + case GL_LUMINANCE: + rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor[0]; + rgba[3] = 1.0; + break; + case GL_LUMINANCE_ALPHA: + rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor[0]; + rgba[3] = tObj->BorderColor[3]; + break; + case GL_INTENSITY: + rgba[0] = rgba[1] = rgba[2] = rgba[3] = tObj->BorderColor[0]; + break; + default: + COPY_4V(rgba, tObj->BorderColor); + } +} + + /**********************************************************************/ /* 1-D Texture Sampling Functions */ /**********************************************************************/ @@ -754,7 +792,7 @@ sample_1d_nearest(GLcontext *ctx, i += img->Border; if (i < 0 || i >= (GLint) img->Width) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_4V(rgba, tObj->BorderColor); + get_border_color(tObj, img, rgba); } else { img->FetchTexelf(img, i, 0, 0, rgba); @@ -790,13 +828,13 @@ sample_1d_linear(GLcontext *ctx, /* fetch texel colors */ if (useBorderColor & I0BIT) { - COPY_4V(t0, tObj->BorderColor); + get_border_color(tObj, img, t0); } else { img->FetchTexelf(img, i0, 0, 0, t0); } if (useBorderColor & I1BIT) { - COPY_4V(t1, tObj->BorderColor); + get_border_color(tObj, img, t1); } else { img->FetchTexelf(img, i1, 0, 0, t1); @@ -1019,7 +1057,7 @@ sample_2d_nearest(GLcontext *ctx, if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_4V(rgba, tObj->BorderColor); + get_border_color(tObj, img, rgba); } else { img->FetchTexelf(img, i, j, 0, rgba); @@ -1063,25 +1101,25 @@ sample_2d_linear(GLcontext *ctx, /* fetch four texel colors */ if (useBorderColor & (I0BIT | J0BIT)) { - COPY_4V(t00, tObj->BorderColor); + get_border_color(tObj, img, t00); } else { img->FetchTexelf(img, i0, j0, 0, t00); } if (useBorderColor & (I1BIT | J0BIT)) { - COPY_4V(t10, tObj->BorderColor); + get_border_color(tObj, img, t10); } else { img->FetchTexelf(img, i1, j0, 0, t10); } if (useBorderColor & (I0BIT | J1BIT)) { - COPY_4V(t01, tObj->BorderColor); + get_border_color(tObj, img, t01); } else { img->FetchTexelf(img, i0, j1, 0, t01); } if (useBorderColor & (I1BIT | J1BIT)) { - COPY_4V(t11, tObj->BorderColor); + get_border_color(tObj, img, t11); } else { img->FetchTexelf(img, i1, j1, 0, t11); @@ -1505,7 +1543,7 @@ sample_3d_nearest(GLcontext *ctx, j < 0 || j >= (GLint) img->Height || k < 0 || k >= (GLint) img->Depth) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_4V(rgba, tObj->BorderColor); + get_border_color(tObj, img, rgba); } else { img->FetchTexelf(img, i, j, k, rgba); @@ -1556,50 +1594,50 @@ sample_3d_linear(GLcontext *ctx, /* Fetch texels */ if (useBorderColor & (I0BIT | J0BIT | K0BIT)) { - COPY_4V(t000, tObj->BorderColor); + get_border_color(tObj, img, t000); } else { img->FetchTexelf(img, i0, j0, k0, t000); } if (useBorderColor & (I1BIT | J0BIT | K0BIT)) { - COPY_4V(t100, tObj->BorderColor); + get_border_color(tObj, img, t100); } else { img->FetchTexelf(img, i1, j0, k0, t100); } if (useBorderColor & (I0BIT | J1BIT | K0BIT)) { - COPY_4V(t010, tObj->BorderColor); + get_border_color(tObj, img, t010); } else { img->FetchTexelf(img, i0, j1, k0, t010); } if (useBorderColor & (I1BIT | J1BIT | K0BIT)) { - COPY_4V(t110, tObj->BorderColor); + get_border_color(tObj, img, t110); } else { img->FetchTexelf(img, i1, j1, k0, t110); } if (useBorderColor & (I0BIT | J0BIT | K1BIT)) { - COPY_4V(t001, tObj->BorderColor); + get_border_color(tObj, img, t001); } else { img->FetchTexelf(img, i0, j0, k1, t001); } if (useBorderColor & (I1BIT | J0BIT | K1BIT)) { - COPY_4V(t101, tObj->BorderColor); + get_border_color(tObj, img, t101); } else { img->FetchTexelf(img, i1, j0, k1, t101); } if (useBorderColor & (I0BIT | J1BIT | K1BIT)) { - COPY_4V(t011, tObj->BorderColor); + get_border_color(tObj, img, t011); } else { img->FetchTexelf(img, i0, j1, k1, t011); } if (useBorderColor & (I1BIT | J1BIT | K1BIT)) { - COPY_4V(t111, tObj->BorderColor); + get_border_color(tObj, img, t111); } else { img->FetchTexelf(img, i1, j1, k1, t111); @@ -2117,7 +2155,7 @@ sample_nearest_rect(GLcontext *ctx, col = clamp_rect_coord_nearest(tObj->WrapS, texcoords[i][0], width); row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height); if (col < 0 || col >= width || row < 0 || row >= height) - COPY_4V(rgba[i], tObj->BorderColor); + get_border_color(tObj, img, rgba[i]); else img->FetchTexelf(img, col, row, 0, rgba[i]); } @@ -2165,22 +2203,22 @@ sample_linear_rect(GLcontext *ctx, /* get four texel samples */ if (useBorderColor & (I0BIT | J0BIT)) - COPY_4V(t00, tObj->BorderColor); + get_border_color(tObj, img, t00); else img->FetchTexelf(img, i0, j0, 0, t00); if (useBorderColor & (I1BIT | J0BIT)) - COPY_4V(t10, tObj->BorderColor); + get_border_color(tObj, img, t10); else img->FetchTexelf(img, i1, j0, 0, t10); if (useBorderColor & (I0BIT | J1BIT)) - COPY_4V(t01, tObj->BorderColor); + get_border_color(tObj, img, t01); else img->FetchTexelf(img, i0, j1, 0, t01); if (useBorderColor & (I1BIT | J1BIT)) - COPY_4V(t11, tObj->BorderColor); + get_border_color(tObj, img, t11); else img->FetchTexelf(img, i1, j1, 0, t11); @@ -2257,7 +2295,7 @@ sample_2d_array_nearest(GLcontext *ctx, j < 0 || j >= (GLint) img->Height || array < 0 || array >= (GLint) img->Depth) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_4V(rgba, tObj->BorderColor); + get_border_color(tObj, img, rgba); } else { img->FetchTexelf(img, i, j, array, rgba); @@ -2308,25 +2346,25 @@ sample_2d_array_linear(GLcontext *ctx, /* Fetch texels */ if (useBorderColor & (I0BIT | J0BIT)) { - COPY_4V(t00, tObj->BorderColor); + get_border_color(tObj, img, t00); } else { img->FetchTexelf(img, i0, j0, array, t00); } if (useBorderColor & (I1BIT | J0BIT)) { - COPY_4V(t10, tObj->BorderColor); + get_border_color(tObj, img, t10); } else { img->FetchTexelf(img, i1, j0, array, t10); } if (useBorderColor & (I0BIT | J1BIT)) { - COPY_4V(t01, tObj->BorderColor); + get_border_color(tObj, img, t01); } else { img->FetchTexelf(img, i0, j1, array, t01); } if (useBorderColor & (I1BIT | J1BIT)) { - COPY_4V(t11, tObj->BorderColor); + get_border_color(tObj, img, t11); } else { img->FetchTexelf(img, i1, j1, array, t11); @@ -2564,7 +2602,7 @@ sample_1d_array_nearest(GLcontext *ctx, if (i < 0 || i >= (GLint) img->Width || array < 0 || array >= (GLint) img->Height) { /* Need this test for GL_CLAMP_TO_BORDER mode */ - COPY_4V(rgba, tObj->BorderColor); + get_border_color(tObj, img, rgba); } else { img->FetchTexelf(img, i, array, 0, rgba); @@ -2607,13 +2645,13 @@ sample_1d_array_linear(GLcontext *ctx, /* Fetch texels */ if (useBorderColor & (I0BIT | K0BIT)) { - COPY_4V(t0, tObj->BorderColor); + get_border_color(tObj, img, t0); } else { img->FetchTexelf(img, i0, array, 0, t0); } if (useBorderColor & (I1BIT | K0BIT)) { - COPY_4V(t1, tObj->BorderColor); + get_border_color(tObj, img, t1); } else { img->FetchTexelf(img, i1, array, 0, t1); -- cgit v1.2.3 From a07e68df6826d979d6a9575d17599f14afd51fe9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Apr 2009 14:00:03 -0600 Subject: st: rename a helper function --- src/mesa/state_tracker/st_atom_sampler.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index d7b904354f2..b7b0e50cbab 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -48,7 +48,7 @@ * Convert GLenum texcoord wrap tokens to pipe tokens. */ static GLuint -gl_wrap_to_sp(GLenum wrap) +gl_wrap_xlate(GLenum wrap) { switch (wrap) { case GL_REPEAT: @@ -149,9 +149,9 @@ update_samplers(struct st_context *st) texobj = st_get_default_texture(st); } - sampler->wrap_s = gl_wrap_to_sp(texobj->WrapS); - sampler->wrap_t = gl_wrap_to_sp(texobj->WrapT); - sampler->wrap_r = gl_wrap_to_sp(texobj->WrapR); + sampler->wrap_s = gl_wrap_xlate(texobj->WrapS); + sampler->wrap_t = gl_wrap_xlate(texobj->WrapT); + sampler->wrap_r = gl_wrap_xlate(texobj->WrapR); sampler->min_img_filter = gl_filter_to_img_filter(texobj->MinFilter); sampler->min_mip_filter = gl_filter_to_mip_filter(texobj->MinFilter); -- cgit v1.2.3 From 89276e2aafd837dbf4eefaa28388109271d6d07d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Apr 2009 14:06:08 -0600 Subject: st: as with swrast, interpret texture border color according to texture format Depending on the hardware driver this might not be needed, but it will cause no harm. --- src/mesa/state_tracker/st_atom_sampler.c | 41 ++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index b7b0e50cbab..50ce82811c5 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -118,6 +118,37 @@ gl_filter_to_img_filter(GLenum filter) } +static void +xlate_border_color(const GLfloat *colorIn, GLenum baseFormat, GLfloat *colorOut) +{ + switch (baseFormat) { + case GL_RGB: + colorOut[0] = colorIn[0]; + colorOut[1] = colorIn[1]; + colorOut[2] = colorIn[2]; + colorOut[3] = 1.0F; + break; + case GL_ALPHA: + colorOut[0] = colorOut[1] = colorOut[2] = 0.0; + colorOut[3] = colorIn[3]; + break; + case GL_LUMINANCE: + colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0]; + colorOut[3] = 1.0; + break; + case GL_LUMINANCE_ALPHA: + colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0]; + colorOut[3] = colorIn[3]; + break; + case GL_INTENSITY: + colorOut[0] = colorOut[1] = colorOut[2] = colorOut[3] = colorIn[0]; + break; + default: + COPY_4V(colorOut, colorIn); + } +} + + static void update_samplers(struct st_context *st) { @@ -137,6 +168,7 @@ update_samplers(struct st_context *st) if (samplersUsed & (1 << su)) { struct gl_texture_object *texobj; + struct gl_texture_image *teximg; GLuint texUnit; if (fprog->Base.SamplersUsed & (1 << su)) @@ -149,6 +181,8 @@ update_samplers(struct st_context *st) texobj = st_get_default_texture(st); } + teximg = texobj->Image[0][texobj->BaseLevel]; + sampler->wrap_s = gl_wrap_xlate(texobj->WrapS); sampler->wrap_t = gl_wrap_xlate(texobj->WrapT); sampler->wrap_r = gl_wrap_xlate(texobj->WrapR); @@ -174,10 +208,9 @@ update_samplers(struct st_context *st) assert(sampler->min_lod <= sampler->max_lod); } - sampler->border_color[0] = texobj->BorderColor[RCOMP]; - sampler->border_color[1] = texobj->BorderColor[GCOMP]; - sampler->border_color[2] = texobj->BorderColor[BCOMP]; - sampler->border_color[3] = texobj->BorderColor[ACOMP]; + xlate_border_color(texobj->BorderColor, + teximg ? teximg->TexFormat->BaseFormat : GL_RGBA, + sampler->border_color); sampler->max_anisotropy = texobj->MaxAnisotropy; if (sampler->max_anisotropy > 1.0) { -- cgit v1.2.3 From 87c356a222bb97ecf9b04e8d509b103199159b11 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Apr 2009 14:38:09 -0600 Subject: swrast: fix incorrect arithmetic for GL_ADD_SIGNED/GL_COMBINE4_NV mode --- src/mesa/swrast/s_texcombine.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 2c694c25cba..08752f34331 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -316,12 +316,12 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, if (textureUnit->EnvMode == GL_COMBINE4_NV) { /* (a * b) + (c * d) - 0.5 */ for (i = 0; i < n; i++) { - rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] * - arg2[i][RCOMP] + arg3[i][RCOMP] - 0.5) * scaleRGB; - rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] * - arg2[i][GCOMP] + arg3[i][GCOMP] - 0.5) * scaleRGB; - rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] * - arg2[i][BCOMP] + arg3[i][BCOMP] - 0.5) * scaleRGB; + rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] + + arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5) * scaleRGB; + rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] + + arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5) * scaleRGB; + rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] + + arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5) * scaleRGB; } } else { -- cgit v1.2.3 From f4d744af24e07103f0f297b485f3dbca1fb7bc3b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Apr 2009 15:31:58 -0600 Subject: softpipe: clean up the buffer clear and tile cache code a little --- src/gallium/drivers/softpipe/sp_clear.c | 5 +-- src/gallium/drivers/softpipe/sp_tile_cache.c | 46 ++++++---------------------- src/gallium/drivers/softpipe/sp_tile_cache.h | 3 +- 3 files changed, 15 insertions(+), 39 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c index f72c6c63e76..fa59277438c 100644 --- a/src/gallium/drivers/softpipe/sp_clear.c +++ b/src/gallium/drivers/softpipe/sp_clear.c @@ -65,7 +65,7 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, struct pipe_surface *ps = softpipe->framebuffer.cbufs[i]; util_pack_color(rgba, ps->format, &cv); - sp_tile_cache_clear(softpipe->cbuf_cache[i], cv); + sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, cv); #if !TILE_CLEAR_OPTIMIZATION /* non-cached surface */ @@ -75,10 +75,11 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, } if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { + static const float zero[4] = { 0.0F, 0.0F, 0.0F, 0.0F }; struct pipe_surface *ps = softpipe->framebuffer.zsbuf; cv = util_pack_z_stencil(ps->format, depth, stencil); - sp_tile_cache_clear(softpipe->zsbuf_cache, cv); + sp_tile_cache_clear(softpipe->zsbuf_cache, zero, cv); #if !TILE_CLEAR_OPTIMIZATION /* non-cached surface */ diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index fd1097f41c9..1f9b8f1f4fb 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -57,9 +57,9 @@ struct softpipe_tile_cache struct pipe_texture *texture; /**< if caching a texture */ struct softpipe_cached_tile entries[NUM_ENTRIES]; uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32]; - float clear_color[4]; - uint clear_val; - boolean depth_stencil; /** Is the surface a depth/stencil format? */ + float clear_color[4]; /**< for color bufs */ + uint clear_val; /**< for z+stencil, or packed color clear value */ + boolean depth_stencil; /**< Is the surface a depth/stencil format? */ struct pipe_transfer *tex_trans; void *tex_trans_map; @@ -599,43 +599,17 @@ sp_get_cached_tile_tex(struct softpipe_context *sp, * Save the color and set a 'clearflag' for each tile of the screen. */ void -sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue) +sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float *rgba, + uint clearValue) { - uint r, g, b, a; uint pos; - tc->clear_val = clearValue; - - switch (tc->transfer->format) { - case PIPE_FORMAT_R8G8B8A8_UNORM: - case PIPE_FORMAT_R8G8B8X8_UNORM: - r = (clearValue >> 24) & 0xff; - g = (clearValue >> 16) & 0xff; - b = (clearValue >> 8) & 0xff; - a = (clearValue ) & 0xff; - break; - case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_X8R8G8B8_UNORM: - r = (clearValue >> 16) & 0xff; - g = (clearValue >> 8) & 0xff; - b = (clearValue ) & 0xff; - a = (clearValue >> 24) & 0xff; - break; - case PIPE_FORMAT_B8G8R8A8_UNORM: - case PIPE_FORMAT_B8G8R8X8_UNORM: - r = (clearValue >> 8) & 0xff; - g = (clearValue >> 16) & 0xff; - b = (clearValue >> 24) & 0xff; - a = (clearValue ) & 0xff; - break; - default: - r = g = b = a = 0; - } + tc->clear_color[0] = rgba[0]; + tc->clear_color[1] = rgba[1]; + tc->clear_color[2] = rgba[2]; + tc->clear_color[3] = rgba[3]; - tc->clear_color[0] = r / 255.0f; - tc->clear_color[1] = g / 255.0f; - tc->clear_color[2] = b / 255.0f; - tc->clear_color[3] = a / 255.0f; + tc->clear_val = clearValue; #if TILE_CLEAR_OPTIMIZATION /* set flags to indicate all the tiles are cleared */ diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index 9ac3fdda948..8f247d0e580 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -89,7 +89,8 @@ sp_flush_tile_cache(struct softpipe_context *softpipe, struct softpipe_tile_cache *tc); extern void -sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue); +sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float *rgba, + uint clearValue); extern struct softpipe_cached_tile * sp_get_cached_tile(struct softpipe_context *softpipe, -- cgit v1.2.3 From b4c0e1f9e16ba61acd781ed6cbe448460e2b3153 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 6 Apr 2009 23:09:02 +0100 Subject: stw: Choose a color buffer format that matches the visual. The massive ifs are ugly, but it's not worth to automate this for just a handful of formats. Fixes conform bcolor.c. --- .../state_trackers/wgl/shared/stw_framebuffer.c | 42 +++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 4641884f950..c289a8aeffc 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -69,6 +69,14 @@ window_proc( return CallWindowProc( fb->WndProc, hWnd, uMsg, wParam, lParam ); } +static INLINE boolean +stw_is_supported_color(enum pipe_format format) +{ + struct pipe_screen *screen = stw_dev->screen; + return screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0); +} + static INLINE boolean stw_is_supported_depth_stencil(enum pipe_format format) { @@ -89,13 +97,33 @@ framebuffer_create( struct stw_framebuffer *fb; enum pipe_format colorFormat, depthFormat, stencilFormat; - fb = CALLOC_STRUCT( stw_framebuffer ); - if (fb == NULL) - return NULL; - /* Determine PIPE_FORMATs for buffers. */ - colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM; + + if(visual->alphaBits <= 0 && visual->redBits <= 5 && visual->blueBits <= 6 && visual->greenBits <= 5 && + stw_is_supported_color(PIPE_FORMAT_R5G6B5_UNORM)) { + colorFormat = PIPE_FORMAT_R5G6B5_UNORM; + } + else if(visual->alphaBits <= 0 && visual->redBits <= 8 && visual->blueBits <= 8 && visual->greenBits <= 8 && + stw_is_supported_color(PIPE_FORMAT_X8R8G8B8_UNORM)) { + colorFormat = PIPE_FORMAT_X8R8G8B8_UNORM; + } + else if(visual->alphaBits <= 1 && visual->redBits <= 5 && visual->blueBits <= 5 && visual->greenBits <= 5 && + stw_is_supported_color(PIPE_FORMAT_A1R5G5B5_UNORM)) { + colorFormat = PIPE_FORMAT_A1R5G5B5_UNORM; + } + else if(visual->alphaBits <= 4 && visual->redBits <= 4 && visual->blueBits <= 4 && visual->greenBits <= 4 && + stw_is_supported_color(PIPE_FORMAT_A4R4G4B4_UNORM)) { + colorFormat = PIPE_FORMAT_A4R4G4B4_UNORM; + } + else if(visual->alphaBits <= 8 && visual->redBits <= 8 && visual->blueBits <= 8 && visual->greenBits <= 8 && + stw_is_supported_color(PIPE_FORMAT_A8R8G8B8_UNORM)) { + colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM; + } + else { + assert(0); + return NULL; + } if (visual->depthBits == 0) depthFormat = PIPE_FORMAT_NONE; @@ -141,6 +169,10 @@ framebuffer_create( stencilFormat = PIPE_FORMAT_NONE; } + fb = CALLOC_STRUCT( stw_framebuffer ); + if (fb == NULL) + return NULL; + fb->stfb = st_create_framebuffer( visual, colorFormat, -- cgit v1.2.3 From 76ac75af8e5481b498981c133836efa2101be2dc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Apr 2009 17:17:52 -0600 Subject: swrast: fix secondary color add for glBitmap Also, clean up the logic involved in choosing per-vertex vs. per-fragment primary+secondary color addition. --- src/mesa/swrast/s_context.c | 36 +++++++++++++++++++++++++++--------- src/mesa/swrast/s_context.h | 1 + src/mesa/swrast/s_span.c | 4 ++-- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 56bf2033ca6..a7eaf76a0ad 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -275,6 +275,24 @@ _swrast_update_fragment_program(GLcontext *ctx, GLbitfield newState) } +/** + * See if we can do early diffuse+specular (primary+secondary) color + * add per vertex instead of per-fragment. + */ +static void +_swrast_update_specular_vertex_add(GLcontext *ctx) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLboolean separateSpecular = ctx->Fog.ColorSumEnabled || + (ctx->Light.Enabled && + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR); + + swrast->SpecularVertexAdd = (separateSpecular + && ctx->Texture._EnabledUnits == 0x0 + && !ctx->FragmentProgram._Current + && !ctx->ATIFragmentShader._Enabled); +} + #define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK | \ _NEW_TEXTURE | \ @@ -336,9 +354,7 @@ _swrast_validate_triangle( GLcontext *ctx, swrast->choose_triangle( ctx ); ASSERT(swrast->Triangle); - if (ctx->Texture._EnabledUnits == 0 - && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram._Current) { + if (swrast->SpecularVertexAdd) { /* separate specular color, but no texture */ swrast->SpecTriangle = swrast->Triangle; swrast->Triangle = _swrast_add_spec_terms_triangle; @@ -360,9 +376,7 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) swrast->choose_line( ctx ); ASSERT(swrast->Line); - if (ctx->Texture._EnabledUnits == 0 - && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram._Current) { + if (swrast->SpecularVertexAdd) { swrast->SpecLine = swrast->Line; swrast->Line = _swrast_add_spec_terms_line; } @@ -382,9 +396,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) _swrast_validate_derived( ctx ); swrast->choose_point( ctx ); - if (ctx->Texture._EnabledUnits == 0 - && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram._Current) { + if (swrast->SpecularVertexAdd) { swrast->SpecPoint = swrast->Point; swrast->Point = _swrast_add_spec_terms_point; } @@ -666,6 +678,12 @@ _swrast_validate_derived( GLcontext *ctx ) _NEW_TEXTURE)) _swrast_update_active_attribs(ctx); + if (swrast->NewState & (_NEW_FOG | + _NEW_PROGRAM | + _NEW_LIGHT | + _NEW_TEXTURE)) + _swrast_update_specular_vertex_add(ctx); + swrast->NewState = 0; swrast->StateChanges = 0; swrast->InvalidateState = _swrast_invalidate_state; diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index b7a17cb28c5..9059f9b5ecb 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -157,6 +157,7 @@ typedef struct GLbitfield NewState; GLuint StateChanges; GLenum Primitive; /* current primitive being drawn (ala glBegin) */ + GLboolean SpecularVertexAdd; /**< Add specular/secondary color per vertex */ void (*InvalidateState)( GLcontext *ctx, GLbitfield new_state ); diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 08d725c5ebf..07b39666037 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1377,8 +1377,8 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) ASSERT(span->arrayMask & SPAN_RGBA); - if (!shader) { - /* Add base and specular colors */ + if (span->primitive == GL_BITMAP || !swrast->SpecularVertexAdd) { + /* Add primary and specular (diffuse + specular) colors */ if (ctx->Fog.ColorSumEnabled || (ctx->Light.Enabled && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { -- cgit v1.2.3 From 1b2ab023673261b4b942e1126c0b599d02fbd4a0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Apr 2009 20:08:43 -0600 Subject: swrast: asst. clean-ups in texcombine code --- src/mesa/swrast/s_texcombine.c | 45 ++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 08752f34331..cec89ed2452 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -47,10 +47,10 @@ typedef float (*float4_array)[4]; * Return array of texels for given unit. */ static INLINE float4_array -get_texel_array(const GLfloat *texelBuffer, GLuint unit, GLuint numTexels) +get_texel_array(SWcontext *swrast, GLuint unit) { return (float4_array) - (texelBuffer + unit * numTexels * 4 * sizeof(GLfloat)); + (swrast->TexelBuffer + unit * MAX_WIDTH * 4 * sizeof(GLfloat)); } @@ -74,11 +74,12 @@ get_texel_array(const GLfloat *texelBuffer, GLuint unit, GLuint numTexels) * \param rgba incoming/result fragment colors */ static void -texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, +texture_combine( GLcontext *ctx, GLuint unit, GLuint n, const float4_array primary_rgba, const GLfloat *texelBuffer, GLchan (*rgbaChan)[4] ) { + SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]); const struct gl_tex_env_combine_state *combine = textureUnit->_CurrentCombine; float4_array argRGB[MAX_COMBINER_TERMS]; @@ -117,7 +118,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (srcRGB) { case GL_TEXTURE: - argRGB[term] = get_texel_array(texelBuffer, unit, n); + argRGB[term] = get_texel_array(swrast, unit); break; case GL_PRIMARY_COLOR: argRGB[term] = primary_rgba; @@ -165,7 +166,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; - argRGB[term] = get_texel_array(texelBuffer, srcUnit, n); + argRGB[term] = get_texel_array(swrast, srcUnit); } } @@ -213,7 +214,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, switch (srcA) { case GL_TEXTURE: - argA[term] = get_texel_array(texelBuffer, unit, n); + argA[term] = get_texel_array(swrast, unit); break; case GL_PRIMARY_COLOR: argA[term] = primary_rgba; @@ -255,7 +256,7 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; - argA[term] = get_texel_array(texelBuffer, srcUnit, n); + argA[term] = get_texel_array(swrast, srcUnit); } } @@ -589,26 +590,19 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) /* First must sample all bump maps */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled && - ctx->Texture.Unit[unit]._CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) { - const GLfloat (*texcoords)[4] - = (const GLfloat (*)[4]) + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + + if (texUnit->_ReallyEnabled && + texUnit->_CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) { + const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; - GLfloat (*targetcoords)[4] - = (GLfloat (*)[4]) + float4_array targetcoords = span->array->attribs[FRAG_ATTRIB_TEX0 + ctx->Texture.Unit[unit].BumpTarget - GL_TEXTURE0]; - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *curObj = texUnit->_Current; GLfloat *lambda = span->array->lambda[unit]; -#if 0 - GLchan (*texels)[4] = (GLchan (*)[4]) - (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan))); -#else - float4_array texels = get_texel_array(swrast->TexelBuffer, unit, - span->end); -#endif + float4_array texels = get_texel_array(swrast, unit); GLuint i; GLfloat rotMatrix00 = ctx->Texture.Unit[unit].RotMatrix[0]; GLfloat rotMatrix01 = ctx->Texture.Unit[unit].RotMatrix[1]; @@ -670,15 +664,14 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) * accomodate GL_ARB_texture_env_crossbar. */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled && - ctx->Texture.Unit[unit]._CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) { + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + if (texUnit->_ReallyEnabled && + texUnit->_CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) { const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *curObj = texUnit->_Current; GLfloat *lambda = span->array->lambda[unit]; - float4_array texels = - get_texel_array(swrast->TexelBuffer, unit, span->end); + float4_array texels = get_texel_array(swrast, unit); /* adjust texture lod (lambda) */ if (span->arrayMask & SPAN_LAMBDA) { -- cgit v1.2.3 From 3630da9916a4f24a03d3a63420690f8016a9b72a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Apr 2009 21:37:20 -0600 Subject: swrast: more texcombine clean-ups --- src/mesa/swrast/s_texcombine.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index cec89ed2452..fae7280efb4 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -405,22 +405,20 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n, } break; case GL_BUMP_ENVMAP_ATI: - { - /* this produces a fixed rgba color, and the coord calc is done elsewhere */ - for (i = 0; i < n; i++) { + /* this produces a fixed rgba color, and the coord calc is done elsewhere */ + for (i = 0; i < n; i++) { /* rgba result is 0,0,0,1 */ #if CHAN_TYPE == GL_FLOAT - rgba[i][RCOMP] = 0.0; - rgba[i][GCOMP] = 0.0; - rgba[i][BCOMP] = 0.0; - rgba[i][ACOMP] = 1.0; + rgba[i][RCOMP] = 0.0; + rgba[i][GCOMP] = 0.0; + rgba[i][BCOMP] = 0.0; + rgba[i][ACOMP] = 1.0; #else - rgba[i][RCOMP] = 0; - rgba[i][GCOMP] = 0; - rgba[i][BCOMP] = 0; - rgba[i][ACOMP] = CHAN_MAX; + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = CHAN_MAX; #endif - } } return; /* no alpha processing */ default: @@ -642,19 +640,10 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) not sure this can work correctly even ignoring the problem that channel is unsigned */ for (i = 0; i < span->end; i++) { -#if CHAN_TYPE == GL_FLOAT targetcoords[i][0] += (texels[i][0] * rotMatrix00 + texels[i][1] * rotMatrix01) / targetcoords[i][3]; targetcoords[i][1] += (texels[i][0] * rotMatrix10 + texels[i][1] * rotMatrix11) / targetcoords[i][3]; -#else - targetcoords[i][0] += (CHAN_TO_FLOAT(texels[i][1]) * rotMatrix00 + - CHAN_TO_FLOAT(texels[i][1]) * rotMatrix01) / - targetcoords[i][3]; - targetcoords[i][1] += (CHAN_TO_FLOAT(texels[i][0]) * rotMatrix10 + - CHAN_TO_FLOAT(texels[i][1]) * rotMatrix11) / - targetcoords[i][3]; -#endif } } } -- cgit v1.2.3 From ffbf3f4952fa9e7c2971a73d9540ed977fdc6c9a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 6 Apr 2009 23:17:33 -0700 Subject: r300-gallium: Properly setup HW/SW TCL controls. This keeps non-TCL chipsets from locking up, and also fully unbreaks RADEON_NO_TCL rendering. --- src/gallium/drivers/r300/r300_state.c | 21 ++++++++++----------- src/gallium/drivers/r300/r300_surface.c | 3 ++- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 095df04630f..2a77fd17390 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -338,11 +338,17 @@ static void* r300_create_rs_state(struct pipe_context* pipe, { struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state); - /* XXX endian control */ - if (r300_screen(pipe->screen)->caps->has_tcl) { - rs->vap_control_status = 0; - } else { + /* Copy rasterizer state for Draw. */ + rs->rs = *state; + + /* 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; + } else { + rs->rs.bypass_vs_clip_and_viewport = TRUE; + rs->vap_control_status = 0; } rs->point_size = pack_float_16_6x(state->point_size) | @@ -406,13 +412,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe, rs->color_control = R300_SHADE_MODEL_SMOOTH; } - rs->rs = *state; - - /* If using HW TCL, tell Draw to not do its magic. */ - if (r300_screen(pipe->screen)->caps->has_tcl) { - rs->rs.bypass_vs_clip_and_viewport = TRUE; - } - return (void*)rs; } diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index dc4b29eb40a..6bc39954b71 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -109,7 +109,8 @@ static void r300_surface_fill(struct pipe_context* pipe, if (caps->has_tcl) { r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader); } else { - BEGIN_CS(2); + BEGIN_CS(4); + OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VAP_TCL_BYPASS); OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) | R300_PVS_NUM_CNTLRS(5) | R300_PVS_NUM_FPUS(caps->num_vert_fpus) | -- cgit v1.2.3 From 6a1be41af93ef0ad835c75b993603c54917f934d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 6 Apr 2009 23:25:27 -0700 Subject: r300-gallium: Fix surface_copy too. --- src/gallium/drivers/r300/r300_surface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 6bc39954b71..79bed032538 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -228,7 +228,8 @@ static void r300_surface_copy(struct pipe_context* pipe, if (caps->has_tcl) { r300_emit_vertex_shader(r300, &r300_texture_vertex_shader); } else { - BEGIN_CS(2); + BEGIN_CS(4); + OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VAP_TCL_BYPASS); OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) | R300_PVS_NUM_CNTLRS(5) | R300_PVS_NUM_FPUS(caps->num_vert_fpus) | -- cgit v1.2.3 From 00bb3deed24bd721686d6db45506fffb2a442dc9 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 6 Apr 2009 23:26:38 -0700 Subject: r300-gallium: vs: Add MUL. --- src/gallium/drivers/r300/r300_state_tcl.c | 3 +++ src/gallium/drivers/r300/r300_state_tcl.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index 0f9abb598f0..24e522ce8be 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -115,6 +115,8 @@ static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler, static uint32_t r300_vs_op(unsigned op) { switch (op) { + case TGSI_OPCODE_MUL: + return R300_VE_MULTIPLY; case TGSI_OPCODE_ADD: case TGSI_OPCODE_MOV: case TGSI_OPCODE_SWZ: @@ -184,6 +186,7 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, { switch (inst->Instruction.Opcode) { case TGSI_OPCODE_ADD: + case TGSI_OPCODE_MUL: r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 2); diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index 75fe44aec50..cbad1c31fdb 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -32,6 +32,7 @@ /* XXX get these to r300_reg */ #define R300_PVS_DST_OPCODE(x) ((x) << 0) +# define R300_VE_MULTIPLY 2 # define R300_VE_ADD 3 #define R300_PVS_DST_REG_TYPE(x) ((x) << 8) # define R300_PVS_DST_REG_TEMPORARY 0 -- cgit v1.2.3 From 799f43f2e01be8b3143c44fbd45485220174febd Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 6 Apr 2009 23:36:34 -0700 Subject: r300-gallium: vs: Add MAD. --- src/gallium/drivers/r300/r300_state_tcl.c | 7 +++++++ src/gallium/drivers/r300/r300_state_tcl.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index 24e522ce8be..44365f563c4 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -121,6 +121,8 @@ static uint32_t r300_vs_op(unsigned op) case TGSI_OPCODE_MOV: case TGSI_OPCODE_SWZ: return R300_VE_ADD; + case TGSI_OPCODE_MAD: + return R300_PVS_DST_MACRO_INST | R300_PVS_MACRO_OP_2CLK_MADD; default: break; } @@ -198,6 +200,11 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 2); break; + case TGSI_OPCODE_MAD: + r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], inst->Instruction.Opcode, + 3); + break; case TGSI_OPCODE_END: break; default: diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index cbad1c31fdb..3d10e248e15 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -34,6 +34,8 @@ #define R300_PVS_DST_OPCODE(x) ((x) << 0) # define R300_VE_MULTIPLY 2 # define R300_VE_ADD 3 +#define R300_PVS_DST_MACRO_INST (1 << 7) +# define R300_PVS_MACRO_OP_2CLK_MADD 0 #define R300_PVS_DST_REG_TYPE(x) ((x) << 8) # define R300_PVS_DST_REG_TEMPORARY 0 # define R300_PVS_DST_REG_A0 1 -- cgit v1.2.3 From 3e79d650835b3431464de876699d04702df99806 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 7 Apr 2009 07:04:14 -0600 Subject: swrast: restore !shader check around add_specular() Fixes a regression from commit 76ac75af8e5481b498981c133836efa2101be2dc. --- src/mesa/swrast/s_span.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 07b39666037..cfff82b0513 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1379,10 +1379,12 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) if (span->primitive == GL_BITMAP || !swrast->SpecularVertexAdd) { /* Add primary and specular (diffuse + specular) colors */ - if (ctx->Fog.ColorSumEnabled || - (ctx->Light.Enabled && - ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { - add_specular(ctx, span); + if (!shader) { + if (ctx->Fog.ColorSumEnabled || + (ctx->Light.Enabled && + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { + add_specular(ctx, span); + } } } -- cgit v1.2.3 From 4069447f73b3ee011a4beccc6ffa80cce84fd285 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 7 Apr 2009 11:01:15 -0600 Subject: glsl: don't optimize program if MESA_GLSL=nopt --- src/mesa/shader/slang/slang_compile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 6348f799aa2..ba2fc4f85c9 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2801,7 +2801,8 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) shader->CompileStatus = success; if (success) { - if (shader->Pragmas.Optimize) { + if (shader->Pragmas.Optimize && + (ctx->Shader.Flags & GLSL_NO_OPT) == 0) { _mesa_optimize_program(ctx, shader->Program); } } -- cgit v1.2.3 From 439909a87d50723c2dba0ee1539467f1f4bf8bf0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 7 Apr 2009 11:09:53 -0600 Subject: docs: document the MESA_GLSL env var, other misc GLSL updates --- docs/shading.html | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/docs/shading.html b/docs/shading.html index b77745fbf37..77c86be3aa6 100644 --- a/docs/shading.html +++ b/docs/shading.html @@ -22,6 +22,7 @@ Last updated on 15 December 2008. Contents